目录

OH_NativeXComponent_Callback

typedef struct OH_NativeXComponent_Callback {...} OH_NativeXComponent_Callback

Overview

Registers callbacks for the surface lifecycle and touch event.

Since: 8

Related module: OH_NativeXComponent Native XComponent

Header file: native_interface_xcomponent.h

Summary

[h2]Member Functions

Member Function Description

[h2]OnSurfaceCreated()

void (*OnSurfaceCreated)(OH_NativeXComponent* component, void* window)

Description

Invoked when a surface is created.

Since: 8

Parameters

Name Description
OH_NativeXComponent* component Pointer to an OH_NativeXComponent instance.
void* window

Handle to the NativeWindow instance.

The NativeWindow instance obtained through the XComponent lifecycle callback is held by the system side with a reference count. After the OnSurfaceDestroyed callback is triggered, the reference count is decreased by one. After the reference count reaches zero, the NativeWindow instance will be released.

[h2]OnSurfaceChanged()

void (*OnSurfaceChanged)(OH_NativeXComponent* component, void* window)

Description

Invoked when the surface changes.

Since: 8

Parameters

Name Description
OH_NativeXComponent* component Pointer to an OH_NativeXComponent instance.
void* window Handle to the NativeWindow instance.

[h2]OnSurfaceDestroyed()

void (*OnSurfaceDestroyed)(OH_NativeXComponent* component, void* window)

Description

Invoked when the surface is destroyed.

Since: 8

Parameters

Name Description
OH_NativeXComponent* component Pointer to an OH_NativeXComponent instance.
void* window Handle to the NativeWindow instance.

[h2]DispatchTouchEvent()

void (*DispatchTouchEvent)(OH_NativeXComponent* component, void* window)

Description

Invoked when a touch event is triggered.

Since: 8

Parameters

Name Description
OH_NativeXComponent* component Pointer to an OH_NativeXComponent instance.
void* window Handle to the NativeWindow instance.