From 7a56fa276b2bfc074191f4470a1426cba2a8dcfb Mon Sep 17 00:00:00 2001 From: John Ralls Date: Fri, 22 Jul 2022 10:54:27 -0700 Subject: [PATCH] [quartz] find_toplevel_under_pointer should not return _gdk_root The macOS WM has no root window. We fake one with a 1x1 window at the origin that has no associated NSWindow. If the pointer is not on a realized GdkWindow the hierarchical search will place it in the root window even if it's nowhere near it. That's not valid, but returning it from find_toplevel_under_pointer prevents Gdk from discovering when the pointer is really over a GdkWindow. Return NULL instead so that the window discovery is re-performed. --- gdk/quartz/gdkevents-quartz.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/gdk/quartz/gdkevents-quartz.c b/gdk/quartz/gdkevents-quartz.c index 3cfc93e19d..f94fd978a0 100644 --- a/gdk/quartz/gdkevents-quartz.c +++ b/gdk/quartz/gdkevents-quartz.c @@ -659,15 +659,11 @@ find_toplevel_under_pointer (GdkDisplay *display, } - if (toplevel == NULL) - return NULL; - - /* - * Root window type does not need translation, but also does not have - * an associated NSWindow and therefore can't translate screen points + /* If the stored toplevel is NULL or _gdk_root it's not useful, + * return NULL to regenerate. */ - if (toplevel == _gdk_root) - return toplevel; + if (toplevel == NULL || toplevel == _gdk_root ) + return NULL; get_window_point_from_screen_point (toplevel, screen_point, x, y); /* If the coordinates are out of window bounds, this toplevel is not