GNOME Bugzilla – Bug 763533
GDK W32: Window under pointer is being found incorrectly
Last modified: 2016-03-14 15:10:05 UTC
The intention was to find the gdk child under cursor (the resize grab subwindow), but existing code is not only wrong by itself, it also finds the toplevel under cursor only.
Created attachment 323756 [details] [review] GDK W32: Fix pointer-under-window code for custom resize This code: > gdk_window_get_root_origin (window, &x, &y); > x -= root_x; > y -= root_y; > pointer_window = gdk_device_get_window_at_position (device, &x, &y); was meant to find the child gdk window at coordinates root_x and root_y. These 4 lines had 2 bugs: 1) x = x - root_x (same for y) is wrong, it should be x = root_x - x 2) gdk_device_get_window_at_position() does not give you the window at position x and y. It gives you the window under the device (mouse pointer) and the returns the device coordinates in x and y.
Review of attachment 323756 [details] [review]: See the comments. ::: gdk/win32/gdkwindow-win32.c @@ +2952,3 @@ + gdouble y) +{ + return mmm this look a bit ugly... and miss aligned @@ +2969,3 @@ +{ + gint x, y; + GList *i; call it l @@ +2970,3 @@ + gint x, y; + GList *i; + GList *children = gdk_window_peek_children (window); split declaration and assignment of vars assigned from methods
(In reply to Ignacio Casal Quinteiro (nacho) from comment #2) > Review of attachment 323756 [details] [review] [review]: > > See the comments. > > ::: gdk/win32/gdkwindow-win32.c > @@ +2952,3 @@ > + gdouble y) > +{ > + return > > mmm this look a bit ugly... and miss aligned It was copied verbatim from GDK.
Created attachment 323876 [details] [review] GDK W32: Fix pointer-under-window code for custom resize v2: * Fixed nitpicks
Review of attachment 323876 [details] [review]: See minor nitpick and feel free to push. ::: gdk/win32/gdkwindow-win32.c @@ +3007,3 @@ context->cursor = _gdk_win32_display_get_cursor_for_name (display, cursor_name); + pointer_window = child_window_at_coordinates (window, root_x, root_y);; double ;
Created attachment 323877 [details] [review] GDK W32: Fix pointer-under-window code for custom resize v3: * Another nitpick
Review of attachment 323877 [details] [review]: Looks good.
Attachment 323877 [details] pushed as ab16b19 - GDK W32: Fix pointer-under-window code for custom resize