Force a window resize if the content view frame changes.

Closes: https://gitlab.gnome.org/GNOME/gtk/issues/1029

Should fix most if not all other cases where system-caused changes to
the NSWindow result in the Gdk coordinates not mapping correctly to the
AppKit coordinates.
This commit is contained in:
John Ralls 2019-03-17 10:15:30 -07:00
parent 0b4e511d05
commit 3a959e984f
2 changed files with 10 additions and 0 deletions

View File

@ -33,6 +33,7 @@
markedRange = NSMakeRange (NSNotFound, 0);
selectedRange = NSMakeRange (0, 0);
}
[self setValue: @(YES) forKey: @"postsFrameChangedNotifications"];
return self;
}

View File

@ -208,6 +208,11 @@ gdk_window_impl_quartz_finalize (GObject *object)
if (impl->transient_for)
g_object_unref (impl->transient_for);
if (impl->view)
[[NSNotificationCenter defaultCenter] removeObserver: impl->toplevel
name: @"NSViewFrameDidChangeNotification"
object: impl->view];
G_OBJECT_CLASS (parent_class)->finalize (object);
}
@ -909,6 +914,10 @@ _gdk_quartz_display_create_window_impl (GdkDisplay *display,
impl->view = [[GdkQuartzView alloc] initWithFrame:content_rect];
[impl->view setGdkWindow:window];
[impl->toplevel setContentView:impl->view];
[[NSNotificationCenter defaultCenter] addObserver: impl->toplevel
selector: @selector (windowDidResize:)
name: @"NSViewFrameDidChangeNotification"
object: impl->view];
[impl->view release];
}
break;