[gtk/wip/chergert/fix-macos-popup-events] macos: fix discover of surface under cursor
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/chergert/fix-macos-popup-events] macos: fix discover of surface under cursor
- Date: Thu, 15 Oct 2020 00:02:23 +0000 (UTC)
commit 6e84c7c59e9e46b418e429bfd9a9cc9450e32f56
Author: Christian Hergert <chergert redhat com>
Date: Wed Oct 14 16:59:38 2020 -0700
macos: fix discover of surface under cursor
This was incorrectly reporting the toplevel surface instead of the
popup surface that was placed above it. This fixes event delivery
to popups for selecting menu items and more.
gdk/macos/gdkmacosdisplay-translate.c | 24 +++++++++---------------
1 file changed, 9 insertions(+), 15 deletions(-)
---
diff --git a/gdk/macos/gdkmacosdisplay-translate.c b/gdk/macos/gdkmacosdisplay-translate.c
index 5ed44d3592..a828f127d9 100644
--- a/gdk/macos/gdkmacosdisplay-translate.c
+++ b/gdk/macos/gdkmacosdisplay-translate.c
@@ -713,29 +713,23 @@ find_surface_under_pointer (GdkMacosDisplay *self,
int *y)
{
GdkPointerSurfaceInfo *info;
- GdkSurface *surface;
+ GdkMacosSurface *found;
+ GdkSurface *surface = NULL;
GdkSeat *seat;
int x_tmp, y_tmp;
seat = gdk_display_get_default_seat (GDK_DISPLAY (self));
info = _gdk_display_get_pointer_info (GDK_DISPLAY (self),
gdk_seat_get_pointer (seat));
- surface = info->surface_under_pointer;
- if (surface == NULL)
+ if ((found = _gdk_macos_display_get_surface_at_display_coords (self,
+ screen_point.x,
+ screen_point.y,
+ &x_tmp,
+ &y_tmp)))
{
- GdkMacosSurface *found;
-
- found = _gdk_macos_display_get_surface_at_display_coords (self,
- screen_point.x,
- screen_point.y,
- &x_tmp, &y_tmp);
-
- if (found)
- {
- surface = GDK_SURFACE (found);
- info->surface_under_pointer = g_object_ref (surface);
- }
+ g_set_object (&info->surface_under_pointer, surface);
+ surface = GDK_SURFACE (found);
}
if (surface)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]