core/window: Do not apply limits if no previous size has been stored

A previously stored width and height of 0 signifies that no previous window
size has been stored. This might be the case if an application starts in
maximized or fullscreen mode. If no previous window size has been stored,
the client needs to determine its own size.

https://bugzilla.gnome.org/show_bug.cgi?id=783901
https://gitlab.gnome.org/GNOME/mutter/merge_requests/801#note_607607
This commit is contained in:
Christian Rauch 2019-09-21 00:49:44 +01:00 committed by Jonas Ådahl
parent a93ef84d57
commit 20519a1486

View File

@ -3369,10 +3369,14 @@ meta_window_unmaximize (MetaWindow *window,
/* Window's size hints may have changed while maximized, making /* Window's size hints may have changed while maximized, making
* saved_rect invalid. #329152 * saved_rect invalid. #329152
* Do not enforce limits, if no previous 'saved_rect' has been stored.
*/ */
meta_window_frame_rect_to_client_rect (window, &target_rect, &target_rect); if (target_rect.width > 0 && target_rect.height > 0)
ensure_size_hints_satisfied (&target_rect, &window->size_hints); {
meta_window_client_rect_to_frame_rect (window, &target_rect, &target_rect); meta_window_frame_rect_to_client_rect (window, &target_rect, &target_rect);
ensure_size_hints_satisfied (&target_rect, &window->size_hints);
meta_window_client_rect_to_frame_rect (window, &target_rect, &target_rect);
}
meta_compositor_size_change_window (window->display->compositor, window, meta_compositor_size_change_window (window->display->compositor, window,
META_SIZE_CHANGE_UNMAXIMIZE, META_SIZE_CHANGE_UNMAXIMIZE,
@ -3526,10 +3530,14 @@ meta_window_unmake_fullscreen (MetaWindow *window)
/* Window's size hints may have changed while maximized, making /* Window's size hints may have changed while maximized, making
* saved_rect invalid. #329152 * saved_rect invalid. #329152
* Do not enforce limits, if no previous 'saved_rect' has been stored.
*/ */
meta_window_frame_rect_to_client_rect (window, &target_rect, &target_rect); if (target_rect.width > 0 && target_rect.height > 0)
ensure_size_hints_satisfied (&target_rect, &window->size_hints); {
meta_window_client_rect_to_frame_rect (window, &target_rect, &target_rect); meta_window_frame_rect_to_client_rect (window, &target_rect, &target_rect);
ensure_size_hints_satisfied (&target_rect, &window->size_hints);
meta_window_client_rect_to_frame_rect (window, &target_rect, &target_rect);
}
/* Need to update window->has_resize_func before we move_resize() /* Need to update window->has_resize_func before we move_resize()
*/ */
@ -4061,6 +4069,7 @@ meta_window_move_resize_internal (MetaWindow *window,
temporary_rect = window->rect; temporary_rect = window->rect;
if (flags & (META_MOVE_RESIZE_MOVE_ACTION | META_MOVE_RESIZE_RESIZE_ACTION) && if (flags & (META_MOVE_RESIZE_MOVE_ACTION | META_MOVE_RESIZE_RESIZE_ACTION) &&
!(flags & META_MOVE_RESIZE_WAYLAND_FINISH_MOVE_RESIZE) && !(flags & META_MOVE_RESIZE_WAYLAND_FINISH_MOVE_RESIZE) &&
(unconstrained_rect.width > 0 && unconstrained_rect.height > 0) &&
window->monitor) window->monitor)
{ {
MetaRectangle old_rect; MetaRectangle old_rect;