macos: ensure GdkMacosWindow in surface discovery

We want to ignore windows that are not related to those controlled
by the GDK backend.

Fixes #3533
This commit is contained in:
Christian Hergert
2020-12-31 10:44:19 -08:00
parent 378bd9fab2
commit d888402bf9

View File

@@ -762,7 +762,7 @@ get_surface_from_ns_event (GdkMacosDisplay *self,
GdkSurface *surface = NULL;
NSWindow *nswindow = [nsevent window];
if (nswindow)
if (GDK_IS_MACOS_WINDOW (nswindow))
{
GdkMacosBaseView *view;
NSPoint point, view_point;
@@ -974,11 +974,11 @@ find_surface_for_ns_event (GdkMacosDisplay *self,
g_assert (x != NULL);
g_assert (y != NULL);
view = (GdkMacosBaseView *)[[nsevent window] contentView];
if (!(surface = get_surface_from_ns_event (self, nsevent, &point, x, y)))
return NULL;
view = (GdkMacosBaseView *)[GDK_MACOS_SURFACE (surface)->window contentView];
_gdk_macos_display_from_display_coords (self, point.x, point.y, &x_tmp, &y_tmp);
switch ((int)[nsevent type])