diff options
Diffstat (limited to 'gdk/macos/gdkmacostoplevelsurface.c')
-rw-r--r-- | gdk/macos/gdkmacostoplevelsurface.c | 33 |
1 files changed, 29 insertions, 4 deletions
diff --git a/gdk/macos/gdkmacostoplevelsurface.c b/gdk/macos/gdkmacostoplevelsurface.c index a399150fe0..0e5a2a0ae7 100644 --- a/gdk/macos/gdkmacostoplevelsurface.c +++ b/gdk/macos/gdkmacostoplevelsurface.c @@ -93,12 +93,15 @@ _gdk_macos_toplevel_surface_unmaximize (GdkMacosToplevelSurface *self) static gboolean _gdk_macos_toplevel_surface_present (GdkToplevel *toplevel, - int width, - int height, GdkToplevelLayout *layout) { GdkMacosToplevelSurface *self = (GdkMacosToplevelSurface *)toplevel; NSWindow *nswindow = _gdk_macos_surface_get_native (GDK_MACOS_SURFACE (self)); + GdkDisplay *display = gdk_surface_get_display (surface); + GdkMonitor *monitor; + GdkToplevelSize size; + int bounds_width, bounds_height; + int width, height; GdkGeometry geometry; GdkSurfaceHints mask; NSWindowStyleMask style_mask; @@ -108,10 +111,32 @@ _gdk_macos_toplevel_surface_present (GdkToplevel *toplevel, style_mask = [nswindow styleMask]; + monitor = gdk_display_get_monitor_at_surface (display, surface); + if (monitor) + { + GdkRectangle workarea; + + gdk_macos_monitor_get_workarea (monitor, &workarea); + bounds_width = workarea.width; + bounds_height = workarea.height; + } + else + { + bounds_width = G_MAXINT; + bounds_height = G_MAXINT; + } + + gdk_toplevel_size_init (&size, bounds_width, bounds_height); + gdk_toplevel_notify_compute_size (toplevel, &size); + g_warn_if_fail (size.width > 0); + g_warn_if_fail (size.height > 0); + width = size.width; + height = size.height; + if (gdk_toplevel_layout_get_resizable (layout)) { - geometry.min_width = gdk_toplevel_layout_get_min_width (layout); - geometry.min_height = gdk_toplevel_layout_get_min_height (layout); + geometry.min_width = size.min_width; + geometry.min_height = size.min_height; mask = GDK_HINT_MIN_SIZE; /* Only set 'Resizable' mask to get native resize zones if the window is |