15
15
#include "SDL3/SDL_mutex.h"
16
16
#include "../../video/ohos/SDL_ohoskeyboard.h"
17
17
18
- OHNativeWindow * nativeWindow ;
18
+ OHNativeWindow * g_ohosNativeWindow ;
19
19
SDL_Mutex * g_ohosPageMutex = NULL ;
20
20
static OH_NativeXComponent_Callback callback ;
21
21
static OH_NativeXComponent_MouseEvent_Callback mouseCallback ;
22
22
SDL_WindowData windowData ;
23
- SDL_VideoData videoData ;
24
- struct
23
+ static struct
25
24
{
26
25
napi_env env ;
27
26
napi_threadsafe_function func ;
@@ -103,7 +102,7 @@ static napi_value sdlCallbackInit(napi_env env, napi_callback_info info)
103
102
104
103
static void OnSurfaceCreatedCB (OH_NativeXComponent * component , void * window )
105
104
{
106
- nativeWindow = (OHNativeWindow * )window ;
105
+ g_ohosNativeWindow = (OHNativeWindow * )window ;
107
106
108
107
uint64_t width ;
109
108
uint64_t height ;
@@ -112,10 +111,8 @@ static void OnSurfaceCreatedCB(OH_NativeXComponent *component, void *window)
112
111
OH_NativeXComponent_GetXComponentSize (component , window , & width , & height );
113
112
OH_NativeXComponent_GetXComponentOffset (component , window , & offsetX , & offsetY );
114
113
115
- SDL_Log ("Native Window: %p" , nativeWindow );
116
-
117
114
SDL_LockMutex (g_ohosPageMutex );
118
- windowData .native_window = nativeWindow ;
115
+ windowData .native_window = g_ohosNativeWindow ;
119
116
windowData .width = width ;
120
117
windowData .height = height ;
121
118
windowData .x = offsetX ;
@@ -124,7 +121,7 @@ static void OnSurfaceCreatedCB(OH_NativeXComponent *component, void *window)
124
121
}
125
122
static void OnSurfaceChangedCB (OH_NativeXComponent * component , void * window )
126
123
{
127
- nativeWindow = (OHNativeWindow * )window ;
124
+ g_ohosNativeWindow = (OHNativeWindow * )window ;
128
125
129
126
uint64_t width ;
130
127
uint64_t height ;
@@ -133,10 +130,8 @@ static void OnSurfaceChangedCB(OH_NativeXComponent *component, void *window)
133
130
OH_NativeXComponent_GetXComponentSize (component , window , & width , & height );
134
131
OH_NativeXComponent_GetXComponentOffset (component , window , & offsetX , & offsetY );
135
132
136
- SDL_Log ("Native Window: %p" , nativeWindow );
137
-
138
133
SDL_LockMutex (g_ohosPageMutex );
139
- windowData .native_window = nativeWindow ;
134
+ windowData .native_window = g_ohosNativeWindow ;
140
135
windowData .width = width ;
141
136
windowData .height = height ;
142
137
windowData .x = offsetX ;
@@ -184,12 +179,14 @@ static void onKeyEvent(OH_NativeXComponent *component, void *window)
184
179
}
185
180
}
186
181
}
182
+
183
+ // TODO
187
184
static void onNativeTouch (OH_NativeXComponent * component , void * window ) {}
188
185
static void onNativeMouse (OH_NativeXComponent * component , void * window ) {}
189
186
static void OnDispatchTouchEventCB (OH_NativeXComponent * component , void * window ) {}
190
- void OnHoverEvent (OH_NativeXComponent * component , bool isHover ) {}
191
- void OnFocusEvent (OH_NativeXComponent * component , void * window ) {}
192
- void OnBlurEvent (OH_NativeXComponent * component , void * window ) {}
187
+ static void OnHoverEvent (OH_NativeXComponent * component , bool isHover ) {}
188
+ static void OnFocusEvent (OH_NativeXComponent * component , void * window ) {}
189
+ static void OnBlurEvent (OH_NativeXComponent * component , void * window ) {}
193
190
194
191
static napi_value SDL_OHOS_NAPI_Init (napi_env env , napi_value exports )
195
192
{
0 commit comments