After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 763533 - GDK W32: Window under pointer is being found incorrectly
GDK W32: Window under pointer is being found incorrectly
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Backend: Win32
unspecified
Other All
: Normal normal
: ---
Assigned To: gtk-win32 maintainers
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2016-03-12 13:16 UTC by LRN
Modified: 2016-03-14 15:10 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
GDK W32: Fix pointer-under-window code for custom resize (3.71 KB, patch)
2016-03-12 13:17 UTC, LRN
none Details | Review
GDK W32: Fix pointer-under-window code for custom resize (3.73 KB, patch)
2016-03-14 15:03 UTC, LRN
none Details | Review
GDK W32: Fix pointer-under-window code for custom resize (3.73 KB, patch)
2016-03-14 15:09 UTC, LRN
committed Details | Review

Description LRN 2016-03-12 13:16:54 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.
Comment 1 LRN 2016-03-12 13:17:00 UTC
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.
Comment 2 Ignacio Casal Quinteiro (nacho) 2016-03-13 16:52:52 UTC
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
Comment 3 LRN 2016-03-13 16:58:43 UTC
(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.
Comment 4 LRN 2016-03-14 15:03:27 UTC
Created attachment 323876 [details] [review]
GDK W32: Fix pointer-under-window code for custom resize

v2:
* Fixed nitpicks
Comment 5 Ignacio Casal Quinteiro (nacho) 2016-03-14 15:07:19 UTC
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 ;
Comment 6 LRN 2016-03-14 15:09:04 UTC
Created attachment 323877 [details] [review]
GDK W32: Fix pointer-under-window code for custom resize

v3:
* Another nitpick
Comment 7 Ignacio Casal Quinteiro (nacho) 2016-03-14 15:09:41 UTC
Review of attachment 323877 [details] [review]:

Looks good.
Comment 8 LRN 2016-03-14 15:10:01 UTC
Attachment 323877 [details] pushed as ab16b19 - GDK W32: Fix pointer-under-window code for custom resize