mirror of
https://github.com/ocornut/imgui.git
synced 2026-01-11 00:04:24 +00:00
imgui_impl_glfw, imgui_impl_sdl: Workaround for Emscripten which doesn't seem to handle focus related calls. (#1941)
This commit is contained in:
parent
b217251a63
commit
b1fc988c6b
2 changed files with 9 additions and 2 deletions
|
|
@ -14,6 +14,7 @@
|
|||
|
||||
// CHANGELOG
|
||||
// (minor and older changes stripped away, please see git history for details)
|
||||
// 2018-08-01: Inputs: Workaround for Emscripten which doesn't seem to handle focus related calls.
|
||||
// 2018-06-29: Inputs: Added support for the ImGuiMouseCursor_Hand cursor.
|
||||
// 2018-06-08: Misc: Extracted imgui_impl_glfw.cpp/.h away from the old combined GLFW+OpenGL/Vulkan examples.
|
||||
// 2018-03-20: Misc: Setup io.BackendFlags ImGuiBackendFlags_HasMouseCursors flag + honor ImGuiConfigFlags_NoMouseCursorChange flag.
|
||||
|
|
@ -199,7 +200,12 @@ static void ImGui_ImplGlfw_UpdateMousePosAndButtons()
|
|||
// Update mouse position
|
||||
const ImVec2 mouse_pos_backup = io.MousePos;
|
||||
io.MousePos = ImVec2(-FLT_MAX, -FLT_MAX);
|
||||
if (glfwGetWindowAttrib(g_Window, GLFW_FOCUSED))
|
||||
#ifdef __EMSCRIPTEN__
|
||||
const bool focused = true; // Emscripten
|
||||
#else
|
||||
const bool focused = glfwGetWindowAttrib(g_Window, GLFW_FOCUSED) != 0;
|
||||
#endif
|
||||
if (focused)
|
||||
{
|
||||
if (io.WantSetMousePos)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue