win32: Focus modal windows when clicking on unfocused parent
authordgsasha <dgsasha04@gmail.com>
Tue, 30 May 2023 00:13:25 +0000 (20:13 -0400)
committerdgsasha <dgsasha04@gmail.com>
Fri, 2 Jun 2023 16:33:03 +0000 (12:33 -0400)
gdk/win32/gdkevents-win32.c

index 7be0835d1efbb9aaa6d85fcf23c0b91b2addbd5b..4f8feed052cd74f469ef210cb8f95954c504c1ce 100644 (file)
@@ -2734,6 +2734,10 @@ gdk_event_translate (MSG *msg,
       if (GDK_IS_DRAG_SURFACE (window) ||
           _gdk_modal_blocked (window))
         {
+          /* Focus the modal window */
+          GdkSurface *modal_window = _gdk_modal_current ();
+          if (modal_window != NULL)
+            SetFocus (GDK_SURFACE_HWND (modal_window));
           *ret_valp = MA_NOACTIVATE;
           return_val = TRUE;
         }
@@ -2744,6 +2748,10 @@ gdk_event_translate (MSG *msg,
       if (GDK_IS_DRAG_SURFACE (window) ||
           _gdk_modal_blocked (window))
         {
+          /* Focus the modal window */
+          GdkSurface *modal_window = _gdk_modal_current ();
+          if (modal_window != NULL)
+            SetFocus (GDK_SURFACE_HWND (modal_window));
           *ret_valp = PA_NOACTIVATE;
           return_val = TRUE;
         }