summaryrefslogtreecommitdiff
path: root/gdk
diff options
context:
space:
mode:
authorLuca Bacci <luca.bacci982@gmail.com>2022-04-06 20:01:51 +0200
committerLuca Bacci <luca.bacci982@gmail.com>2022-04-06 20:27:46 +0200
commitcb0c1b3f0831a6522a9473a37d6ec2d8caf9c80b (patch)
treefedef73b7b5f7a83bd8f96d6cd97d2aa3856b44b /gdk
parent91f200167e8f083a4e3c48c3e6e2d1d48d304d4d (diff)
downloadgtk+-cb0c1b3f0831a6522a9473a37d6ec2d8caf9c80b.tar.gz
GdkWin32: Generate crossing event after button release
Fixes #4813
Diffstat (limited to 'gdk')
-rw-r--r--gdk/win32/gdkevents-win32.c76
1 files changed, 43 insertions, 33 deletions
diff --git a/gdk/win32/gdkevents-win32.c b/gdk/win32/gdkevents-win32.c
index de34cd8e68..a5306a42cd 100644
--- a/gdk/win32/gdkevents-win32.c
+++ b/gdk/win32/gdkevents-win32.c
@@ -2244,6 +2244,10 @@ gdk_event_translate (MSG *msg,
button = 5;
buttonup0:
+ {
+ gboolean release_implicit_grab = FALSE;
+ GdkSurface *prev_surface = NULL;
+
GDK_NOTE (EVENTS,
g_print (" (%d,%d)",
GET_X_LPARAM (msg->lParam), GET_Y_LPARAM (msg->lParam)));
@@ -2253,41 +2257,18 @@ gdk_event_translate (MSG *msg,
g_set_object (&window, find_window_for_mouse_event (window, msg));
if (pointer_grab != NULL && pointer_grab->implicit)
- {
- int state = build_pointer_event_state (msg);
-
- /* We keep the implicit grab until no buttons at all are held down */
- if ((state & GDK_ANY_BUTTON_MASK & ~(GDK_BUTTON1_MASK << (button - 1))) == 0)
- {
- ReleaseCapture ();
-
- new_window = NULL;
- hwnd = WindowFromPoint (msg->pt);
- if (hwnd != NULL)
- {
- POINT client_pt = msg->pt;
-
- ScreenToClient (hwnd, &client_pt);
- GetClientRect (hwnd, &rect);
- if (PtInRect (&rect, client_pt))
- new_window = gdk_win32_handle_table_lookup (hwnd);
- }
+ {
+ int state = build_pointer_event_state (msg);
- synthesize_crossing_events (display,
- _gdk_device_manager->system_pointer,
- pointer_grab->surface, new_window,
- GDK_CROSSING_UNGRAB,
- &msg->pt,
- 0, /* TODO: Set right mask */
- _gdk_win32_get_next_tick (msg->time),
- FALSE);
- g_set_object (&mouse_window, new_window);
- mouse_window_ignored_leave = NULL;
- }
- }
+ /* We keep the implicit grab until no buttons at all are held down */
+ if ((state & GDK_ANY_BUTTON_MASK & ~(GDK_BUTTON1_MASK << (button - 1))) == 0)
+ {
+ release_implicit_grab = TRUE;
+ prev_surface = pointer_grab->surface;
+ }
+ }
- generate_button_event (GDK_BUTTON_RELEASE, button,
- window, msg);
+ generate_button_event (GDK_BUTTON_RELEASE, button, window, msg);
impl = GDK_WIN32_SURFACE (window);
@@ -2296,8 +2277,37 @@ gdk_event_translate (MSG *msg,
impl->drag_move_resize_context.button == button)
gdk_win32_surface_end_move_resize_drag (window);
+ if (release_implicit_grab)
+ {
+ ReleaseCapture ();
+
+ new_window = NULL;
+ hwnd = WindowFromPoint (msg->pt);
+ if (hwnd != NULL)
+ {
+ POINT client_pt = msg->pt;
+
+ ScreenToClient (hwnd, &client_pt);
+ GetClientRect (hwnd, &rect);
+ if (PtInRect (&rect, client_pt))
+ new_window = gdk_win32_handle_table_lookup (hwnd);
+ }
+
+ synthesize_crossing_events (display,
+ _gdk_device_manager->system_pointer,
+ prev_surface, new_window,
+ GDK_CROSSING_UNGRAB,
+ &msg->pt,
+ 0, /* TODO: Set right mask */
+ _gdk_win32_get_next_tick (msg->time),
+ FALSE);
+ g_set_object (&mouse_window, new_window);
+ mouse_window_ignored_leave = NULL;
+ }
+
return_val = TRUE;
break;
+ }
case WM_MOUSEMOVE:
GDK_NOTE (EVENTS,