Mercurial > hg > orthanc-stone
comparison Applications/Generic/GuiAdapter.h @ 1370:28eb7106ef44 broker
Changes to GuiAdapter to allow it to work correctly with both new and old
Emscripten event selection rules that are defined by the DISABLE_DEPRECATED_FIND_EVENT_TARGET_BEHAVIOR linker flag.
Doc has been added to GuiAdapter.cpp, should you require more info on
what has been done.
author | Benjamin Golinvaux <bgo@osimis.io> |
---|---|
date | Mon, 20 Apr 2020 13:08:43 +0200 |
parents | d80a3e3cc800 |
children | f15529add7b0 |
comparison
equal
deleted
inserted
replaced
1369:aadc374bc006 | 1370:28eb7106ef44 |
---|---|
252 ORTHANC_ASSERT(instanceCount == 0); | 252 ORTHANC_ASSERT(instanceCount == 0); |
253 instanceCount = 1; | 253 instanceCount = 1; |
254 } | 254 } |
255 | 255 |
256 /** | 256 /** |
257 emscripten_set_resize_callback("#window", NULL, false, OnWindowResize); | 257 emscripten_set_resize_callback("EMSCRIPTEN_EVENT_TARGET_WINDOW", NULL, false, OnWindowResize); |
258 | 258 |
259 emscripten_set_wheel_callback("mycanvas1", widget1_.get(), false, OnXXXMouseWheel); | 259 emscripten_set_wheel_callback("#mycanvas1", widget1_.get(), false, OnXXXMouseWheel); |
260 emscripten_set_wheel_callback("mycanvas2", widget2_.get(), false, OnXXXMouseWheel); | 260 emscripten_set_wheel_callback("#mycanvas2", widget2_.get(), false, OnXXXMouseWheel); |
261 emscripten_set_wheel_callback("mycanvas3", widget3_.get(), false, OnXXXMouseWheel); | 261 emscripten_set_wheel_callback("#mycanvas3", widget3_.get(), false, OnXXXMouseWheel); |
262 | 262 |
263 emscripten_set_keydown_callback("#window", NULL, false, OnKeyDown); | 263 emscripten_set_keydown_callback(EMSCRIPTEN_EVENT_TARGET_WINDOW, NULL, false, OnKeyDown); ---> NO! |
264 emscripten_set_keyup_callback("#window", NULL, false, OnKeyUp); | 264 emscripten_set_keyup_callback(EMSCRIPTEN_EVENT_TARGET_WINDOW, NULL, false, OnKeyUp); |
265 | 265 |
266 emscripten_request_animation_frame_loop(OnAnimationFrame, NULL); | 266 emscripten_request_animation_frame_loop(OnAnimationFrame, NULL); |
267 | 267 |
268 SDL: | 268 SDL: |
269 see https://wiki.libsdl.org/SDL_CaptureMouse | 269 see https://wiki.libsdl.org/SDL_CaptureMouse |
283 void SetGenericSdlEventCallback (std::string canvasId, void* userData, bool capture, OnSdlEventCallback func); | 283 void SetGenericSdlEventCallback (std::string canvasId, void* userData, bool capture, OnSdlEventCallback func); |
284 | 284 |
285 typedef bool (*OnSdlEventCallback) (std::string canvasId, const SDL_Event& sdlEvent, void* userData); | 285 typedef bool (*OnSdlEventCallback) (std::string canvasId, const SDL_Event& sdlEvent, void* userData); |
286 | 286 |
287 // if you pass "#window", then any Window resize will trigger the callback | 287 // if you pass "#window", then any Window resize will trigger the callback |
288 // (this special string is converted to EMSCRIPTEN_EVENT_TARGET_WINDOW in DOM, when DISABLE_DEPRECATED_FIND_EVENT_TARGET_BEHAVIOR=1) | |
288 void SetSdlResizeCallback(std::string canvasId, | 289 void SetSdlResizeCallback(std::string canvasId, |
289 void* userData, | 290 void* userData, |
290 bool capture, | 291 bool capture, |
291 OnSdlWindowResizeFunc func); | 292 OnSdlWindowResizeFunc func); |
292 #endif | 293 #endif |