From ae238d1d4d2f7abb3cdb53491a325e741118be71 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Thu, 22 Aug 2019 10:55:17 +0200 Subject: [PATCH] window: Add adjust_fullscreen_monitor_rect virtual method Add an adjust_fullscreen_monitor_rect virtual method to MetaWindowClass and call this from setup_constraint_info() if the window is fullscreen. This allows MetaWindowClass to adjust the monitor-rectangle used to size the window when going fullscreen, which will be used in further commits for a workaround related to fullscreen games under Xwayland. https://gitlab.gnome.org/GNOME/mutter/merge_requests/739 --- src/core/constraints.c | 12 +++++++----- src/core/window-private.h | 5 +++++ src/core/window.c | 10 ++++++++++ 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/src/core/constraints.c b/src/core/constraints.c index 117131b15..1b3676d20 100644 --- a/src/core/constraints.c +++ b/src/core/constraints.c @@ -413,11 +413,7 @@ setup_constraint_info (ConstraintInfo *info, logical_monitor, &info->work_area_monitor); - if (!window->fullscreen || !meta_window_has_fullscreen_monitors (window)) - { - info->entire_monitor = logical_monitor->rect; - } - else + if (window->fullscreen && meta_window_has_fullscreen_monitors (window)) { info->entire_monitor = window->fullscreen_monitors.top->rect; meta_rectangle_union (&info->entire_monitor, @@ -430,6 +426,12 @@ setup_constraint_info (ConstraintInfo *info, &window->fullscreen_monitors.right->rect, &info->entire_monitor); } + else + { + info->entire_monitor = logical_monitor->rect; + if (window->fullscreen) + meta_window_adjust_fullscreen_monitor_rect (window, &info->entire_monitor); + } cur_workspace = window->display->workspace_manager->active_workspace; info->usable_screen_region = diff --git a/src/core/window-private.h b/src/core/window-private.h index dd89fdc90..09a3aaadd 100644 --- a/src/core/window-private.h +++ b/src/core/window-private.h @@ -578,6 +578,8 @@ struct _MetaWindowClass MetaWindowUpdateMonitorFlags flags); void (*main_monitor_changed) (MetaWindow *window, const MetaLogicalMonitor *old); + void (*adjust_fullscreen_monitor_rect) (MetaWindow *window, + MetaRectangle *monitor_rect); void (*force_restore_shortcuts) (MetaWindow *window, ClutterInputDevice *source); gboolean (*shortcuts_inhibited) (MetaWindow *window, @@ -649,6 +651,9 @@ void meta_window_update_fullscreen_monitors (MetaWindow *window, gboolean meta_window_has_fullscreen_monitors (MetaWindow *window); +void meta_window_adjust_fullscreen_monitor_rect (MetaWindow *window, + MetaRectangle *monitor_rect); + void meta_window_resize_frame_with_gravity (MetaWindow *window, gboolean user_op, int w, diff --git a/src/core/window.c b/src/core/window.c index 850ee21cc..4282d4c2c 100644 --- a/src/core/window.c +++ b/src/core/window.c @@ -3624,6 +3624,16 @@ meta_window_has_fullscreen_monitors (MetaWindow *window) return window->fullscreen_monitors.top != NULL; } +void +meta_window_adjust_fullscreen_monitor_rect (MetaWindow *window, + MetaRectangle *monitor_rect) +{ + MetaWindowClass *window_class = META_WINDOW_GET_CLASS (window); + + if (window_class->adjust_fullscreen_monitor_rect) + window_class->adjust_fullscreen_monitor_rect (window, monitor_rect); +} + void meta_window_shade (MetaWindow *window, guint32 timestamp)