diff options
author | Matthias Clasen <mclasen@redhat.com> | 2020-08-05 16:19:19 +0000 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2020-08-05 16:19:19 +0000 |
commit | d7c4f93c76eaeab7d90fef486bc6eed9e3c6580c (patch) | |
tree | abf8dfa7f2b159397c61b93ce1383dcff09262bb /gdk/win32 | |
parent | 0b0f7dc9c0d6350babaacad26156f7a06eb69585 (diff) | |
parent | 2ff74eb667c2cbe293c7309d5661fa438e8431c4 (diff) | |
download | gtk+-d7c4f93c76eaeab7d90fef486bc6eed9e3c6580c.tar.gz |
Merge branch 'wip/compute-size' into 'master'
Compute size via signal
See merge request GNOME/gtk!2325
Diffstat (limited to 'gdk/win32')
-rw-r--r-- | gdk/win32/gdksurface-win32.c | 35 |
1 files changed, 30 insertions, 5 deletions
diff --git a/gdk/win32/gdksurface-win32.c b/gdk/win32/gdksurface-win32.c index 5a61919d95..a559cb3271 100644 --- a/gdk/win32/gdksurface-win32.c +++ b/gdk/win32/gdksurface-win32.c @@ -4941,18 +4941,43 @@ show_surface (GdkSurface *surface) static gboolean gdk_win32_toplevel_present (GdkToplevel *toplevel, - int width, - int height, - GdkToplevelLayout *layout) + GdkToplevelLayout *layout) { GdkSurface *surface = GDK_SURFACE (toplevel); + GdkDisplay *display = gdk_surface_get_display (surface); + GdkMonitor *monitor; + GdkToplevelSize size; + int bounds_width, bounds_height; + int width, height; GdkGeometry geometry; GdkSurfaceHints mask; + monitor = gdk_display_get_monitor_at_surface (display, surface); + if (monitor) + { + GdkRectangle workarea; + + gdk_win32_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; } else |