[gtk/wip/chergert/quartz4u] macos: ignore tracking areas not our own
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/chergert/quartz4u] macos: ignore tracking areas not our own
- Date: Fri, 8 May 2020 22:14:10 +0000 (UTC)
commit ea00ba973ce88727d6ddf57ac1de38f2c4306634
Author: Christian Hergert <chergert redhat com>
Date: Fri May 8 15:12:19 2020 -0700
macos: ignore tracking areas not our own
gdk/macos/gdkmacosdisplay-translate.c | 16 +++++++++++-----
gdk/macos/gdkmacossurface-private.h | 2 ++
gdk/macos/gdkmacossurface.c | 19 +++++++++++++++++++
3 files changed, 32 insertions(+), 5 deletions(-)
---
diff --git a/gdk/macos/gdkmacosdisplay-translate.c b/gdk/macos/gdkmacosdisplay-translate.c
index ae5abb7a7b..ceea4621cf 100644
--- a/gdk/macos/gdkmacosdisplay-translate.c
+++ b/gdk/macos/gdkmacosdisplay-translate.c
@@ -266,7 +266,7 @@ synthesize_crossing_event (GdkMacosDisplay *display,
break;
default:
- return NULL;
+ g_return_val_if_reached (NULL);
}
state = get_keyboard_modifiers_from_ns_event (nsevent) |
@@ -753,7 +753,7 @@ _gdk_macos_display_translate (GdkMacosDisplay *self,
if (![NSApp isActive])
{
[NSApp activateIgnoringOtherApps:YES];
- return FALSE;
+ return NULL;
}
else if (![nswindow isKeyWindow])
{
@@ -785,10 +785,16 @@ _gdk_macos_display_translate (GdkMacosDisplay *self,
break;
case NSEventTypeMouseExited:
- [[NSCursor arrowCursor] set];
- /* fall through */
+ if (_gdk_macos_surface_is_tracking (surface, [nsevent trackingArea]))
+ {
+ [[NSCursor arrowCursor] set];
+ ret = synthesize_crossing_event (self, surface, nsevent, point.x, point.y);
+ }
+ break;
+
case NSEventTypeMouseEntered:
- ret = synthesize_crossing_event (self, surface, nsevent, point.x, point.y);
+ if (_gdk_macos_surface_is_tracking (surface, [nsevent trackingArea]))
+ ret = synthesize_crossing_event (self, surface, nsevent, point.x, point.y);
break;
case NSEventTypeKeyDown:
diff --git a/gdk/macos/gdkmacossurface-private.h b/gdk/macos/gdkmacossurface-private.h
index ea4e020ff7..a2d214be7b 100644
--- a/gdk/macos/gdkmacossurface-private.h
+++ b/gdk/macos/gdkmacossurface-private.h
@@ -98,6 +98,8 @@ void _gdk_macos_surface_move_resize (GdkMacosSurface
int y,
int width,
int height);
+gboolean _gdk_macos_surface_is_tracking (GdkMacosSurface *self,
+ NSTrackingArea *area);
G_END_DECLS
diff --git a/gdk/macos/gdkmacossurface.c b/gdk/macos/gdkmacossurface.c
index 1734b8a627..69187ac6c3 100644
--- a/gdk/macos/gdkmacossurface.c
+++ b/gdk/macos/gdkmacossurface.c
@@ -913,3 +913,22 @@ _gdk_macos_surface_move_resize (GdkMacosSurface *self,
[priv->window setFrame:NSMakeRect(x, y, width, height)
display:YES];
}
+
+gboolean
+_gdk_macos_surface_is_tracking (GdkMacosSurface *self,
+ NSTrackingArea *area)
+{
+ GdkMacosSurfacePrivate *priv = gdk_macos_surface_get_instance_private (self);
+ GdkMacosBaseView *view;
+
+ g_return_val_if_fail (GDK_IS_MACOS_SURFACE (self), FALSE);
+
+ if (priv->window == NULL)
+ return FALSE;
+
+ view = (GdkMacosBaseView *)[priv->window contentView];
+ if (view == NULL)
+ return FALSE;
+
+ return [view trackingArea] == area;
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]