Compare commits

...

1 Commits

Author SHA1 Message Date
Patrick Storz
7f781c74a4 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.
2020-10-23 17:53:43 +02:00

View File

@@ -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));
}