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
This commit is contained in:
Hans de Goede 2019-08-22 10:55:17 +02:00
parent 6051712919
commit ae238d1d4d
3 changed files with 22 additions and 5 deletions

View File

@ -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 =

View File

@ -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,

View File

@ -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)