[gtk+/gtk-3-22] GDK W32: Refuse to release mouse grab while in DnD mode



commit 7b6efc29cc1ec852ef63ad13a1646df06cfb0f25
Author: Руслан Ижбулатов <lrn1986 gmail com>
Date:   Thu Sep 14 17:43:38 2017 +0000

    GDK W32: Refuse to release mouse grab while in DnD mode
    
    Handle WM_CANCELMODE and do nothing in response to it when DnD is
    active. Otherwise pass it to DefWindowProc, which will call ReleaseCapture()
    on our behalf.
    This prevents us from losing mouse capture when alt-tabbing during DnD
    (this includes the feature of Windows Explorer where dragging stuff over
    a window button in the taskbar causes that window to receive focus, i.e.
    keyboardless alt-tabbing).
    
    https://bugzilla.gnome.org/show_bug.cgi?id=786509

 gdk/win32/gdkevents-win32.c |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)
---
diff --git a/gdk/win32/gdkevents-win32.c b/gdk/win32/gdkevents-win32.c
index efa4c2f..873d225 100644
--- a/gdk/win32/gdkevents-win32.c
+++ b/gdk/win32/gdkevents-win32.c
@@ -3281,6 +3281,23 @@ gdk_event_translate (MSG  *msg,
 
       break;
 
+    /*
+     * Handle WM_CANCELMODE and do nothing in response to it when DnD is
+     * active. Otherwise pass it to DefWindowProc, which will call ReleaseCapture()
+     * on our behalf.
+     * This prevents us from losing mouse capture when alt-tabbing during DnD
+     * (this includes the feature of Windows Explorer where dragging stuff over
+     * a window button in the taskbar causes that window to receive focus, i.e.
+     * keyboardless alt-tabbing).
+     */
+    case WM_CANCELMODE:
+      if (_modal_operation_in_progress & GDK_WIN32_MODAL_OP_DND)
+        {
+          return_val = TRUE;
+          *ret_valp = 0;
+        }
+      break;
+
     case WM_CAPTURECHANGED:
       /* Sometimes we don't get WM_EXITSIZEMOVE, for instance when you
         select move/size in the menu and then click somewhere without


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]