window: Notify about size-change when changing monitor

When moving to another monitor the window size may change in some
cases. While unconditionally notifying a size change is not always
correct, it animates the window when moved to another monitor in
GNOME Shell.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2558>
This commit is contained in:
Alessandro Bono 2022-08-06 13:02:19 +02:00 committed by Marge Bot
parent 98adff03da
commit 33dc8ca187
2 changed files with 10 additions and 0 deletions

View File

@ -4089,9 +4089,18 @@ meta_window_move_to_monitor (MetaWindow *window,
} }
else else
{ {
MetaRectangle old_frame_rect, old_buffer_rect;
if (monitor == window->monitor->number) if (monitor == window->monitor->number)
return; return;
meta_window_get_frame_rect (window, &old_frame_rect);
meta_window_get_buffer_rect (window, &old_buffer_rect);
meta_compositor_size_change_window (window->display->compositor, window,
META_SIZE_CHANGE_MONITOR_MOVE,
&old_frame_rect, &old_buffer_rect);
meta_window_move_between_rects (window, 0, &old_area, &new_area); meta_window_move_between_rects (window, 0, &old_area, &new_area);
} }

View File

@ -64,6 +64,7 @@ typedef enum
META_SIZE_CHANGE_UNMAXIMIZE, META_SIZE_CHANGE_UNMAXIMIZE,
META_SIZE_CHANGE_FULLSCREEN, META_SIZE_CHANGE_FULLSCREEN,
META_SIZE_CHANGE_UNFULLSCREEN, META_SIZE_CHANGE_UNFULLSCREEN,
META_SIZE_CHANGE_MONITOR_MOVE,
} MetaSizeChange; } MetaSizeChange;
META_EXPORT META_EXPORT