[gtk/wip/Jehan/gimp-issue-1082-transparent-window] Fullscreen windows with WS_EX_NOACTIVATE | WS_EX_TRANSPARENT ...




commit 7f781c74a46921ace451795e5745a41893ad4e27
Author: Patrick Storz <eduard braun2 gmx de>
Date:   Thu Jul 9 18:13:02 2020 +0200

    Fullscreen windows with WS_EX_NOACTIVATE | WS_EX_TRANSPARENT ...
    
    ... interfere with UI events.
    
    Ignore top-level transparent windows when looking for the top-level GDK
    window at a certain pointer location, in the Win32 GDK backend.
    
    This prevents transparent top-level windows from intercepting mouse
    events as often the case with screen capturing software.
    See relevant bug reports at GIMP and Inkscape:
    https://gitlab.gnome.org/GNOME/gimp/-/issues/1082
    https://gitlab.com/inkscape/inbox/-/issues/2976
    
    The relevant issue at GTK is:
    https://gitlab.gnome.org/GNOME/gtk/-/issues/370
    This patch does not necessarily close the whole issue as some cases are
    apparently still problematic, yet it fixes most instances since reports
    have greatly diminished since it was applied on downstream builds.
    
    Originally contributed by Ell (see commit fb5354c9e5 from GIMP
    repository) for GTK+2, then ported to GTK+3 by Patrick Storz for the
    MSYS2 package.

 gdk/win32/gdkdevice-win32.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/gdk/win32/gdkdevice-win32.c b/gdk/win32/gdkdevice-win32.c
index 190372de2d..3d89290b25 100644
--- a/gdk/win32/gdkdevice-win32.c
+++ b/gdk/win32/gdkdevice-win32.c
@@ -214,6 +214,10 @@ _gdk_device_win32_window_at_position (GdkDevice       *device,
        * WindowFromPoint() can find our windows, we follow similar logic
        * here, and ignore invisible and disabled windows.
        */
+       UINT cwp_flags = CWP_SKIPDISABLED  |
+                        CWP_SKIPINVISIBLE |
+                        CWP_SKIPTRANSPARENT;
+
       hwnd = GetDesktopWindow ();
       do {
         window = gdk_win32_handle_table_lookup (hwnd);
@@ -224,8 +228,7 @@ _gdk_device_win32_window_at_position (GdkDevice       *device,
           break;
 
         screen_to_client (hwnd, screen_pt, &client_pt);
-        hwndc = ChildWindowFromPointEx (hwnd, client_pt, CWP_SKIPDISABLED  |
-                                                         CWP_SKIPINVISIBLE);
+        hwndc = ChildWindowFromPointEx (hwnd, client_pt, cwp_flags);
 
        /* Verify that we're really inside the client area of the window */
        if (hwndc != hwnd)
@@ -236,6 +239,8 @@ _gdk_device_win32_window_at_position (GdkDevice       *device,
              hwndc = hwnd;
          }
 
+        /* Only ignore top-level transparent windows */
+        cwp_flags &= ~CWP_SKIPTRANSPARENT;
       } while (hwndc != hwnd && (hwnd = hwndc, 1));
 
     }


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