[gtk/wip.win32.fixes: 244/255] Make the DND indicator not interfere with the drag and drop operation
- From: Chun-wei Fan <fanchunwei src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip.win32.fixes: 244/255] Make the DND indicator not interfere with the drag and drop operation
- Date: Mon, 4 Oct 2021 10:15:02 +0000 (UTC)
commit 287b5fb448770f0f9968ba97851932414bf69a3d
Author: Luca Bacci <luca bacci982 gmail com>
Date: Sat Sep 4 14:12:54 2021 +0200
Make the DND indicator not interfere with the drag and drop operation
gdk/win32/gdksurface-win32.c | 26 ++++++++++++++++++++------
1 file changed, 20 insertions(+), 6 deletions(-)
---
diff --git a/gdk/win32/gdksurface-win32.c b/gdk/win32/gdksurface-win32.c
index 75bf874a9e..5514215e6d 100644
--- a/gdk/win32/gdksurface-win32.c
+++ b/gdk/win32/gdksurface-win32.c
@@ -584,12 +584,6 @@ _gdk_win32_display_create_surface (GdkDisplay *display,
if (!title || !*title)
title = "";
- /* WS_EX_TRANSPARENT means "try draw this window last, and ignore input".
- * It's the last part we're after. We don't want DND indicator to accept
- * input, because that will make it a potential drop target, and if it's
- * under the mouse cursor, this will kill any DND.
- */
-
klass = RegisterGdkClass (surface_type);
wtitle = g_utf8_to_utf16 (title, -1, NULL, NULL, NULL);
@@ -652,6 +646,7 @@ _gdk_win32_display_create_surface (GdkDisplay *display,
_gdk_win32_surface_enable_transparency (surface);
_gdk_win32_surface_register_dnd (surface);
+ _gdk_win32_surface_update_style_bits (surface);
g_signal_connect (frame_clock,
"after-paint",
@@ -1842,6 +1837,8 @@ _gdk_win32_surface_update_style_bits (GdkSurface *window)
RECT rect, before, after;
gboolean was_topmost;
gboolean will_be_topmost;
+ gboolean was_layered;
+ gboolean will_be_layered;
HWND insert_after;
UINT flags;
@@ -1856,7 +1853,9 @@ _gdk_win32_surface_update_style_bits (GdkSurface *window)
AdjustWindowRectEx (&before, old_style, FALSE, old_exstyle);
was_topmost = (old_exstyle & WS_EX_TOPMOST) ? TRUE : FALSE;
+ was_layered = (old_exstyle & WS_EX_LAYERED) ? TRUE : FALSE;
will_be_topmost = was_topmost;
+ will_be_layered = was_layered;
old_exstyle &= ~WS_EX_TOPMOST;
@@ -1866,7 +1865,14 @@ _gdk_win32_surface_update_style_bits (GdkSurface *window)
if (GDK_IS_DRAG_SURFACE (window))
{
new_exstyle |= WS_EX_TOOLWINDOW;
+
+ /* WS_EX_LAYERED | WS_EX_TRANSPARENT makes the drag surface behave
+ * in pointer input passthrough mode, so it doesn't interfere with
+ * the drag and drop operation.
+ */
+ new_exstyle |= WS_EX_LAYERED | WS_EX_TRANSPARENT;
will_be_topmost = TRUE;
+ will_be_layered = TRUE;
}
else
{
@@ -1911,6 +1917,14 @@ _gdk_win32_surface_update_style_bits (GdkSurface *window)
_gdk_win32_surface_exstyle_to_string (new_exstyle)));
SetWindowLong (GDK_SURFACE_HWND (window), GWL_EXSTYLE, new_exstyle);
+
+ if (!was_layered && will_be_layered)
+ {
+ /* We have to call SetLayeredWindowAttributes when setting the
+ * WS_EX_LAYERED style anew, otherwise the window won't show up
+ */
+ API_CALL (SetLayeredWindowAttributes, (GDK_SURFACE_HWND (window), 0, 255, LWA_ALPHA));
+ }
}
AdjustWindowRectEx (&after, new_style, FALSE, new_exstyle);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]