mirror of
https://github.com/ocornut/imgui.git
synced 2024-11-16 03:53:28 +01:00
Examples: SDL: Fix for Emscripten/Android/iOS on Docking branch.
This commit is contained in:
parent
be107ba8f8
commit
f6fbb99a9c
@ -269,13 +269,12 @@ static void ImGui_ImplSDL2_UpdateMousePosAndButtons()
|
|||||||
io.MouseDown[2] = g_MousePressed[2] || (mouse_buttons & SDL_BUTTON(SDL_BUTTON_MIDDLE)) != 0;
|
io.MouseDown[2] = g_MousePressed[2] || (mouse_buttons & SDL_BUTTON(SDL_BUTTON_MIDDLE)) != 0;
|
||||||
g_MousePressed[0] = g_MousePressed[1] = g_MousePressed[2] = false;
|
g_MousePressed[0] = g_MousePressed[1] = g_MousePressed[2] = false;
|
||||||
|
|
||||||
#if SDL_HAS_CAPTURE_AND_GLOBAL_MOUSE
|
#if SDL_HAS_CAPTURE_AND_GLOBAL_MOUSE && !defined(__EMSCRIPTEN__) && !defined(__ANDROID__) && !(defined(__APPLE__) && TARGET_OS_IOS)
|
||||||
|
|
||||||
// SDL 2.0.4 and later has SDL_GetGlobalMouseState() and SDL_CaptureMouse()
|
// SDL 2.0.4 and later has SDL_GetGlobalMouseState() and SDL_CaptureMouse()
|
||||||
int mouse_x_global, mouse_y_global;
|
int mouse_x_global, mouse_y_global;
|
||||||
SDL_GetGlobalMouseState(&mouse_x_global, &mouse_y_global);
|
SDL_GetGlobalMouseState(&mouse_x_global, &mouse_y_global);
|
||||||
|
|
||||||
#if !defined(__EMSCRIPTEN__) && !defined(__ANDROID__) && !(defined(__APPLE__) && TARGET_OS_IOS)
|
|
||||||
if (io.ConfigFlags & ImGuiConfigFlags_ViewportsEnable)
|
if (io.ConfigFlags & ImGuiConfigFlags_ViewportsEnable)
|
||||||
{
|
{
|
||||||
// Multi-viewport mode: mouse position in OS absolute coordinates (io.MousePos is (0,0) when the mouse is on the upper-left of the primary monitor)
|
// Multi-viewport mode: mouse position in OS absolute coordinates (io.MousePos is (0,0) when the mouse is on the upper-left of the primary monitor)
|
||||||
@ -284,7 +283,6 @@ static void ImGui_ImplSDL2_UpdateMousePosAndButtons()
|
|||||||
io.MousePos = ImVec2((float)mouse_x_global, (float)mouse_y_global);
|
io.MousePos = ImVec2((float)mouse_x_global, (float)mouse_y_global);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
// Single-viewport mode: mouse position in client window coordinatesio.MousePos is (0,0) when the mouse is on the upper-left corner of the app window)
|
// Single-viewport mode: mouse position in client window coordinatesio.MousePos is (0,0) when the mouse is on the upper-left corner of the app window)
|
||||||
if (SDL_GetWindowFlags(g_Window) & SDL_WINDOW_INPUT_FOCUS)
|
if (SDL_GetWindowFlags(g_Window) & SDL_WINDOW_INPUT_FOCUS)
|
||||||
|
Loading…
Reference in New Issue
Block a user