#ifdef GLFW_RESIZE_NESW_CURSOR // let's be nice to people who pulled GLFW between 2019-04-16 (3.4 define) and 2019-11-29 (cursors defines) // FIXME: Remove when GLFW 3.4 is released?
#ifdef GLFW_RESIZE_NESW_CURSOR // Let's be nice to people who pulled GLFW between 2019-04-16 (3.4 define) and 2019-11-29 (cursors defines) // FIXME: Remove when GLFW 3.4 is released?
io.MouseDown[0]=bd->MousePressed[0]||(mouse_buttons&SDL_BUTTON(SDL_BUTTON_LEFT))!=0;// If a mouse press event came, always pass it as "mouse held this frame", so we don't miss click-release events that are shorter than 1 frame.
SDL_Window*focused_window=SDL_GetKeyboardFocus();// Mouse position won't be reported unless window is focused.
#if SDL_HAS_MOUSE_FOCUS_CLICKTHROUGH
SDL_Window*hovered_window=SDL_GetMouseFocus();// This is better but is only reliably useful with SDL 2.0.5+ and SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH enabled.
// Obtain focused and hovered window. We forward mouse input when focused or when hovered (and no other window is capturing)
#if SDL_HAS_CAPTURE_AND_GLOBAL_MOUSE
SDL_Window*focused_window=SDL_GetKeyboardFocus();
SDL_Window*hovered_window=SDL_HAS_MOUSE_FOCUS_CLICKTHROUGH?SDL_GetMouseFocus():NULL;// This is better but is only reliably useful with SDL 2.0.5+ and SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH.
// Set Dear ImGui mouse position from OS position + get buttons. (this is the common behavior)
if(bd->MouseCanUseGlobalState)
{
// SDL_GetMouseState() gives mouse position seemingly based on the last window entered/focused(?)
// The creation of a new windows at runtime and SDL_CaptureMouse both seems to severely mess up with that, so we retrieve that position globally.
// Won't use this workaround on SDL backends that have no global mouse position, like Wayland or RPI
intwx,wy;
SDL_GetWindowPosition(mouse_window,&wx,&wy);
SDL_GetGlobalMouseState(&mx,&my);
mx-=wx;
my-=wy;
// Single-viewport mode: mouse position in client window coordinates (io.MousePos is (0,0) when the mouse is on the upper-left corner of the app window)
// Unlike local position obtained earlier this will be valid when straying out of bounds.