From 33dc8ca187e785a1eff347fcb4383907cebbf1a6 Mon Sep 17 00:00:00 2001 From: Alessandro Bono Date: Sat, 6 Aug 2022 13:02:19 +0200 Subject: [PATCH] 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: --- src/core/window.c | 9 +++++++++ src/meta/compositor.h | 1 + 2 files changed, 10 insertions(+) diff --git a/src/core/window.c b/src/core/window.c index 0a1a97547..895aa7070 100644 --- a/src/core/window.c +++ b/src/core/window.c @@ -4089,9 +4089,18 @@ meta_window_move_to_monitor (MetaWindow *window, } else { + MetaRectangle old_frame_rect, old_buffer_rect; + if (monitor == window->monitor->number) 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); } diff --git a/src/meta/compositor.h b/src/meta/compositor.h index e33abad99..9308ed852 100644 --- a/src/meta/compositor.h +++ b/src/meta/compositor.h @@ -64,6 +64,7 @@ typedef enum META_SIZE_CHANGE_UNMAXIMIZE, META_SIZE_CHANGE_FULLSCREEN, META_SIZE_CHANGE_UNFULLSCREEN, + META_SIZE_CHANGE_MONITOR_MOVE, } MetaSizeChange; META_EXPORT