|
@@ -18,6 +18,7 @@
|
|
|
|
|
|
// CHANGELOG
|
|
// CHANGELOG
|
|
// (minor and older changes stripped away, please see git history for details)
|
|
// (minor and older changes stripped away, please see git history for details)
|
|
|
|
+// 2022-09-26: Inputs: Disable SDL 2.0.22 new "auto capture" (SDL_HINT_MOUSE_AUTO_CAPTURE) which prevents drag and drop across windows for multi-viewport support + don't capture when drag and dropping. (#5710)
|
|
// 2022-09-26: Inputs: Renamed ImGuiKey_ModXXX introduced in 1.87 to ImGuiMod_XXX (old names still supported).
|
|
// 2022-09-26: Inputs: Renamed ImGuiKey_ModXXX introduced in 1.87 to ImGuiMod_XXX (old names still supported).
|
|
// 2022-03-22: Inputs: Fix mouse position issues when dragging outside of boundaries. SDL_CaptureMouse() erroneously still gives out LEAVE events when hovering OS decorations.
|
|
// 2022-03-22: Inputs: Fix mouse position issues when dragging outside of boundaries. SDL_CaptureMouse() erroneously still gives out LEAVE events when hovering OS decorations.
|
|
// 2022-03-22: Inputs: Added support for extra mouse buttons (SDL_BUTTON_X1/SDL_BUTTON_X2).
|
|
// 2022-03-22: Inputs: Added support for extra mouse buttons (SDL_BUTTON_X1/SDL_BUTTON_X2).
|
|
@@ -76,7 +77,6 @@
|
|
#else
|
|
#else
|
|
#define SDL_HAS_CAPTURE_AND_GLOBAL_MOUSE 0
|
|
#define SDL_HAS_CAPTURE_AND_GLOBAL_MOUSE 0
|
|
#endif
|
|
#endif
|
|
-#define SDL_HAS_MOUSE_FOCUS_CLICKTHROUGH SDL_VERSION_ATLEAST(2,0,5)
|
|
|
|
#define SDL_HAS_VULKAN SDL_VERSION_ATLEAST(2,0,6)
|
|
#define SDL_HAS_VULKAN SDL_VERSION_ATLEAST(2,0,6)
|
|
|
|
|
|
// SDL Data
|
|
// SDL Data
|
|
@@ -367,15 +367,20 @@ static bool ImGui_ImplSDL2_Init(SDL_Window* window, SDL_Renderer* renderer)
|
|
(void)window;
|
|
(void)window;
|
|
#endif
|
|
#endif
|
|
|
|
|
|
- // Set SDL hint to receive mouse click events on window focus, otherwise SDL doesn't emit the event.
|
|
|
|
|
|
+ // From 2.0.5: Set SDL hint to receive mouse click events on window focus, otherwise SDL doesn't emit the event.
|
|
// Without this, when clicking to gain focus, our widgets wouldn't activate even though they showed as hovered.
|
|
// Without this, when clicking to gain focus, our widgets wouldn't activate even though they showed as hovered.
|
|
// (This is unfortunately a global SDL setting, so enabling it might have a side-effect on your application.
|
|
// (This is unfortunately a global SDL setting, so enabling it might have a side-effect on your application.
|
|
// It is unlikely to make a difference, but if your app absolutely needs to ignore the initial on-focus click:
|
|
// It is unlikely to make a difference, but if your app absolutely needs to ignore the initial on-focus click:
|
|
// you can ignore SDL_MOUSEBUTTONDOWN events coming right after a SDL_WINDOWEVENT_FOCUS_GAINED)
|
|
// you can ignore SDL_MOUSEBUTTONDOWN events coming right after a SDL_WINDOWEVENT_FOCUS_GAINED)
|
|
-#if SDL_HAS_MOUSE_FOCUS_CLICKTHROUGH
|
|
|
|
|
|
+#ifdef SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH
|
|
SDL_SetHint(SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH, "1");
|
|
SDL_SetHint(SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH, "1");
|
|
#endif
|
|
#endif
|
|
|
|
|
|
|
|
+ // From 2.0.22: Disable auto-capture, this is preventing drag and drop across multiple windows (see #5710)
|
|
|
|
+#ifdef SDL_HINT_MOUSE_AUTO_CAPTURE
|
|
|
|
+ SDL_SetHint(SDL_HINT_MOUSE_AUTO_CAPTURE, "0");
|
|
|
|
+#endif
|
|
|
|
+
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -435,7 +440,7 @@ static void ImGui_ImplSDL2_UpdateMouseData()
|
|
// We forward mouse input when hovered or captured (via SDL_MOUSEMOTION) or when focused (below)
|
|
// We forward mouse input when hovered or captured (via SDL_MOUSEMOTION) or when focused (below)
|
|
#if SDL_HAS_CAPTURE_AND_GLOBAL_MOUSE
|
|
#if SDL_HAS_CAPTURE_AND_GLOBAL_MOUSE
|
|
// SDL_CaptureMouse() let the OS know e.g. that our imgui drag outside the SDL window boundaries shouldn't e.g. trigger other operations outside
|
|
// SDL_CaptureMouse() let the OS know e.g. that our imgui drag outside the SDL window boundaries shouldn't e.g. trigger other operations outside
|
|
- SDL_CaptureMouse(bd->MouseButtonsDown != 0 ? SDL_TRUE : SDL_FALSE);
|
|
|
|
|
|
+ SDL_CaptureMouse((bd->MouseButtonsDown != 0 && ImGui::GetDragDropPayload() == NULL) ? SDL_TRUE : SDL_FALSE);
|
|
SDL_Window* focused_window = SDL_GetKeyboardFocus();
|
|
SDL_Window* focused_window = SDL_GetKeyboardFocus();
|
|
const bool is_app_focused = (bd->Window == focused_window);
|
|
const bool is_app_focused = (bd->Window == focused_window);
|
|
#else
|
|
#else
|