window/wayland: Handle resizing when headless

We tried to get the geometry scale, which may depend on the main
logical monitor assigned to the window. To avoid dereferencing a NULL
logical monitor when headless, instead assume the geometry scale is 1.

https://bugzilla.gnome.org/show_bug.cgi?id=788764
This commit is contained in:
Jonas Ådahl 2017-10-16 17:02:51 +08:00
parent 049418cd03
commit 0add6f62b6

View File

@ -67,6 +67,8 @@ G_DEFINE_TYPE (MetaWindowWayland, meta_window_wayland, META_TYPE_WINDOW)
static int static int
get_window_geometry_scale_for_logical_monitor (MetaLogicalMonitor *logical_monitor) get_window_geometry_scale_for_logical_monitor (MetaLogicalMonitor *logical_monitor)
{ {
g_assert (logical_monitor);
if (meta_is_stage_views_scaled ()) if (meta_is_stage_views_scaled ())
return 1; return 1;
else else
@ -79,8 +81,7 @@ meta_window_wayland_manage (MetaWindow *window)
MetaWindowWayland *wl_window = META_WINDOW_WAYLAND (window); MetaWindowWayland *wl_window = META_WINDOW_WAYLAND (window);
MetaDisplay *display = window->display; MetaDisplay *display = window->display;
wl_window->geometry_scale = wl_window->geometry_scale = meta_window_wayland_get_geometry_scale (window);
get_window_geometry_scale_for_logical_monitor (window->monitor);
meta_display_register_wayland_window (display, window); meta_display_register_wayland_window (display, window);
@ -634,6 +635,9 @@ should_do_pending_move (MetaWindowWayland *wl_window,
int int
meta_window_wayland_get_geometry_scale (MetaWindow *window) meta_window_wayland_get_geometry_scale (MetaWindow *window)
{ {
if (!window->monitor)
return 1;
return get_window_geometry_scale_for_logical_monitor (window->monitor); return get_window_geometry_scale_for_logical_monitor (window->monitor);
} }