Commit b1fc988 1 parent b217251 commit b1fc988 Copy full SHA for b1fc988
File tree 2 files changed +9
-2
lines changed
2 files changed +9
-2
lines changed Original file line number Diff line number Diff line change 14
14
15
15
// CHANGELOG
16
16
// (minor and older changes stripped away, please see git history for details)
17
+ // 2018-08-01: Inputs: Workaround for Emscripten which doesn't seem to handle focus related calls.
17
18
// 2018-06-29: Inputs: Added support for the ImGuiMouseCursor_Hand cursor.
18
19
// 2018-06-08: Misc: Extracted imgui_impl_glfw.cpp/.h away from the old combined GLFW+OpenGL/Vulkan examples.
19
20
// 2018-03-20: Misc: Setup io.BackendFlags ImGuiBackendFlags_HasMouseCursors flag + honor ImGuiConfigFlags_NoMouseCursorChange flag.
@@ -199,7 +200,12 @@ static void ImGui_ImplGlfw_UpdateMousePosAndButtons()
199
200
// Update mouse position
200
201
const ImVec2 mouse_pos_backup = io.MousePos ;
201
202
io.MousePos = ImVec2 (-FLT_MAX, -FLT_MAX);
202
- if (glfwGetWindowAttrib (g_Window, GLFW_FOCUSED))
203
+ #ifdef __EMSCRIPTEN__
204
+ const bool focused = true ; // Emscripten
205
+ #else
206
+ const bool focused = glfwGetWindowAttrib (g_Window, GLFW_FOCUSED) != 0 ;
207
+ #endif
208
+ if (focused)
203
209
{
204
210
if (io.WantSetMousePos )
205
211
{
Original file line number Diff line number Diff line change 15
15
16
16
// CHANGELOG
17
17
// (minor and older changes stripped away, please see git history for details)
18
+ // 2018-08-01: Inputs: Workaround for Emscripten which doesn't seem to handle focus related calls.
18
19
// 2018-06-29: Inputs: Added support for the ImGuiMouseCursor_Hand cursor.
19
20
// 2018-06-08: Misc: Extracted imgui_impl_sdl.cpp/.h away from the old combined SDL2+OpenGL/Vulkan examples.
20
21
// 2018-06-08: Misc: ImGui_ImplSDL2_InitForOpenGL() now takes a SDL_GLContext parameter.
@@ -214,7 +215,7 @@ static void ImGui_ImplSDL2_UpdateMousePosAndButtons()
214
215
io.MouseDown [2 ] = g_MousePressed[2 ] || (mouse_buttons & SDL_BUTTON (SDL_BUTTON_MIDDLE)) != 0 ;
215
216
g_MousePressed[0 ] = g_MousePressed[1 ] = g_MousePressed[2 ] = false ;
216
217
217
- #if SDL_HAS_CAPTURE_MOUSE
218
+ #if SDL_HAS_CAPTURE_MOUSE && !defined(__EMSCRIPTEN__)
218
219
SDL_Window* focused_window = SDL_GetKeyboardFocus ();
219
220
if (g_Window == focused_window)
220
221
{
You can’t perform that action at this time.
0 commit comments