|
|
67f8b7 |
From 0826616da1dacf29e3e08dae6d2ffe4116e5bdff Mon Sep 17 00:00:00 2001
|
|
|
2c033f |
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
|
|
|
2c033f |
Date: Thu, 16 Jul 2015 15:07:38 +0200
|
|
|
2c033f |
Subject: [PATCH 1/2] barrier: Guard against X errors
|
|
|
2c033f |
|
|
|
2c033f |
---
|
|
|
67f8b7 |
src/backends/x11/meta-barrier-x11.c | 22 +++++++++++++++-------
|
|
|
67f8b7 |
1 file changed, 15 insertions(+), 7 deletions(-)
|
|
|
2c033f |
|
|
|
67f8b7 |
diff --git a/src/backends/x11/meta-barrier-x11.c b/src/backends/x11/meta-barrier-x11.c
|
|
|
67f8b7 |
index 054e5cdc6..1fc3fd8cc 100644
|
|
|
67f8b7 |
--- a/src/backends/x11/meta-barrier-x11.c
|
|
|
67f8b7 |
+++ b/src/backends/x11/meta-barrier-x11.c
|
|
|
67f8b7 |
@@ -38,6 +38,7 @@
|
|
|
67f8b7 |
#include <X11/extensions/XInput2.h>
|
|
|
2c033f |
#include <X11/extensions/Xfixes.h>
|
|
|
2c033f |
#include <meta/barrier.h>
|
|
|
2c033f |
+#include <meta/errors.h>
|
|
|
67f8b7 |
#include "backends/x11/meta-barrier-x11.h"
|
|
|
2c033f |
#include "display-private.h"
|
|
|
67f8b7 |
|
|
|
67f8b7 |
@@ -107,6 +108,7 @@ meta_barrier_impl_x11_new (MetaBarrier *barrier)
|
|
|
67f8b7 |
MetaDisplay *display = barrier->priv->display;
|
|
|
2c033f |
Display *dpy;
|
|
|
2c033f |
Window root;
|
|
|
2c033f |
+ PointerBarrier xbarrier;
|
|
|
67f8b7 |
unsigned int allowed_motion_dirs;
|
|
|
2c033f |
|
|
|
67f8b7 |
if (display == NULL)
|
|
|
67f8b7 |
@@ -119,18 +121,24 @@ meta_barrier_impl_x11_new (MetaBarrier *barrier)
|
|
|
67f8b7 |
priv = meta_barrier_impl_x11_get_instance_private (self);
|
|
|
67f8b7 |
priv->barrier = barrier;
|
|
|
2c033f |
|
|
|
67f8b7 |
+ meta_error_trap_push (display);
|
|
|
67f8b7 |
dpy = display->xdisplay;
|
|
|
2c033f |
root = DefaultRootWindow (dpy);
|
|
|
2c033f |
|
|
|
67f8b7 |
allowed_motion_dirs =
|
|
|
67f8b7 |
meta_border_get_allows_directions (&barrier->priv->border);
|
|
|
2c033f |
- priv->xbarrier = XFixesCreatePointerBarrier (dpy, root,
|
|
|
67f8b7 |
- barrier->priv->border.line.a.x,
|
|
|
67f8b7 |
- barrier->priv->border.line.a.y,
|
|
|
67f8b7 |
- barrier->priv->border.line.b.x,
|
|
|
67f8b7 |
- barrier->priv->border.line.b.y,
|
|
|
67f8b7 |
- allowed_motion_dirs,
|
|
|
67f8b7 |
- 0, NULL);
|
|
|
2c033f |
+ xbarrier = XFixesCreatePointerBarrier (dpy, root,
|
|
|
67f8b7 |
+ barrier->priv->border.line.a.x,
|
|
|
67f8b7 |
+ barrier->priv->border.line.a.y,
|
|
|
67f8b7 |
+ barrier->priv->border.line.b.x,
|
|
|
67f8b7 |
+ barrier->priv->border.line.b.y,
|
|
|
67f8b7 |
+ allowed_motion_dirs,
|
|
|
67f8b7 |
+ 0, NULL);
|
|
|
67f8b7 |
+
|
|
|
67f8b7 |
+ if (meta_error_trap_pop_with_return (display) != Success)
|
|
|
2c033f |
+ return NULL;
|
|
|
2c033f |
+
|
|
|
2c033f |
+ priv->xbarrier = xbarrier;
|
|
|
2c033f |
|
|
|
67f8b7 |
g_hash_table_insert (display->xids, &priv->xbarrier, barrier);
|
|
|
67f8b7 |
|
|
|
2c033f |
--
|
|
|
67f8b7 |
2.12.0
|
|
|
2c033f |
|
|
|
2c033f |
|
|
|
67f8b7 |
From 2da829399dc79b5c51ca55ab6e633c4a4769c15a Mon Sep 17 00:00:00 2001
|
|
|
2c033f |
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
|
|
|
2c033f |
Date: Thu, 16 Jul 2015 15:12:55 +0200
|
|
|
2c033f |
Subject: [PATCH 2/2] Do not crash when starting up with no monitor connected
|
|
|
2c033f |
|
|
|
2c033f |
Some parts of Mutter currently assume there's always a monitor connected
|
|
|
2c033f |
to the screen. This assumption can be incorrect - e.g. a desktop
|
|
|
2c033f |
computer can be powered on and a monitor only plugged in after the
|
|
|
2c033f |
desktop session - or the GDM login - has already been reached.
|
|
|
2c033f |
|
|
|
2c033f |
Fix the various places that assume so, making the code robust to the
|
|
|
2c033f |
above use case.
|
|
|
2c033f |
|
|
|
2c033f |
Based on an initial patch by Cosimo Cecchi.
|
|
|
2c033f |
---
|
|
|
2c033f |
src/backends/x11/meta-monitor-manager-xrandr.c | 4 +-
|
|
|
2c033f |
src/compositor/meta-window-actor.c | 2 +-
|
|
|
2c033f |
src/core/constraints.c | 71 +++++++++++++++-----------
|
|
|
2c033f |
src/core/place.c | 4 ++
|
|
|
2c033f |
src/core/screen.c | 10 +++-
|
|
|
67f8b7 |
src/core/window.c | 57 ++++++++++++++-------
|
|
|
2c033f |
src/core/workspace.c | 3 ++
|
|
|
2c033f |
src/x11/window-x11.c | 3 +-
|
|
|
67f8b7 |
8 files changed, 100 insertions(+), 54 deletions(-)
|
|
|
2c033f |
|
|
|
2c033f |
diff --git a/src/backends/x11/meta-monitor-manager-xrandr.c b/src/backends/x11/meta-monitor-manager-xrandr.c
|
|
|
67f8b7 |
index b0a77dadb..b82120af9 100644
|
|
|
2c033f |
--- a/src/backends/x11/meta-monitor-manager-xrandr.c
|
|
|
2c033f |
+++ b/src/backends/x11/meta-monitor-manager-xrandr.c
|
|
|
67f8b7 |
@@ -1141,7 +1141,9 @@ meta_monitor_manager_xrandr_apply_configuration (MetaMonitorManager *manager,
|
|
|
2c033f |
crtc->current_mode = NULL;
|
|
|
2c033f |
}
|
|
|
2c033f |
|
|
|
2c033f |
- g_assert (width > 0 && height > 0);
|
|
|
2c033f |
+ if (width == 0 || height == 0)
|
|
|
2c033f |
+ return;
|
|
|
2c033f |
+
|
|
|
2c033f |
/* The 'physical size' of an X screen is meaningless if that screen
|
|
|
2c033f |
* can consist of many monitors. So just pick a size that make the
|
|
|
2c033f |
* dpi 96.
|
|
|
2c033f |
diff --git a/src/compositor/meta-window-actor.c b/src/compositor/meta-window-actor.c
|
|
|
67f8b7 |
index 9395caac5..fb29ca1c9 100644
|
|
|
2c033f |
--- a/src/compositor/meta-window-actor.c
|
|
|
2c033f |
+++ b/src/compositor/meta-window-actor.c
|
|
|
67f8b7 |
@@ -959,7 +959,7 @@ queue_send_frame_messages_timeout (MetaWindowActor *self)
|
|
|
2c033f |
outputs = meta_monitor_manager_get_outputs (monitor_manager, &n_outputs);
|
|
|
2c033f |
for (i = 0; i < n_outputs; i++)
|
|
|
2c033f |
{
|
|
|
2c033f |
- if (outputs[i].winsys_id == window->monitor->winsys_id && outputs[i].crtc)
|
|
|
2c033f |
+ if (window->monitor && outputs[i].winsys_id == window->monitor->winsys_id && outputs[i].crtc)
|
|
|
2c033f |
{
|
|
|
2c033f |
refresh_rate = outputs[i].crtc->current_mode->refresh_rate;
|
|
|
2c033f |
break;
|
|
|
2c033f |
diff --git a/src/core/constraints.c b/src/core/constraints.c
|
|
|
67f8b7 |
index 67b52c994..3d1701e88 100644
|
|
|
2c033f |
--- a/src/core/constraints.c
|
|
|
2c033f |
+++ b/src/core/constraints.c
|
|
|
2c033f |
@@ -29,6 +29,7 @@
|
|
|
2c033f |
#include <meta/prefs.h>
|
|
|
2c033f |
|
|
|
2c033f |
#include <stdlib.h>
|
|
|
2c033f |
+#include <string.h>
|
|
|
2c033f |
#include <math.h>
|
|
|
2c033f |
|
|
|
2c033f |
#if 0
|
|
|
67f8b7 |
@@ -337,6 +338,8 @@ setup_constraint_info (ConstraintInfo *info,
|
|
|
2c033f |
const MetaMonitorInfo *monitor_info;
|
|
|
2c033f |
MetaWorkspace *cur_workspace;
|
|
|
2c033f |
|
|
|
2c033f |
+ memset (info, 0, sizeof (ConstraintInfo));
|
|
|
2c033f |
+
|
|
|
2c033f |
info->orig = *orig;
|
|
|
2c033f |
info->current = *new;
|
|
|
2c033f |
|
|
|
67f8b7 |
@@ -382,40 +385,43 @@ setup_constraint_info (ConstraintInfo *info,
|
|
|
2c033f |
if (!info->is_user_action)
|
|
|
2c033f |
info->fixed_directions = FIXED_DIRECTION_NONE;
|
|
|
2c033f |
|
|
|
2c033f |
+ cur_workspace = window->screen->active_workspace;
|
|
|
2c033f |
monitor_info =
|
|
|
2c033f |
meta_screen_get_monitor_for_rect (window->screen, &info->current);
|
|
|
2c033f |
- meta_window_get_work_area_for_monitor (window,
|
|
|
2c033f |
- monitor_info->number,
|
|
|
2c033f |
- &info->work_area_monitor);
|
|
|
2c033f |
|
|
|
2c033f |
- if (!window->fullscreen || window->fullscreen_monitors[0] == -1)
|
|
|
2c033f |
+ if (monitor_info)
|
|
|
2c033f |
{
|
|
|
2c033f |
- info->entire_monitor = monitor_info->rect;
|
|
|
2c033f |
- }
|
|
|
2c033f |
- else
|
|
|
2c033f |
- {
|
|
|
2c033f |
- int i = 0;
|
|
|
2c033f |
- long monitor;
|
|
|
2c033f |
+ meta_window_get_work_area_for_monitor (window,
|
|
|
2c033f |
+ monitor_info->number,
|
|
|
2c033f |
+ &info->work_area_monitor);
|
|
|
2c033f |
|
|
|
2c033f |
- monitor = window->fullscreen_monitors[i];
|
|
|
2c033f |
- info->entire_monitor =
|
|
|
2c033f |
- window->screen->monitor_infos[monitor].rect;
|
|
|
2c033f |
- for (i = 1; i <= 3; i++)
|
|
|
2c033f |
+ if (!window->fullscreen || window->fullscreen_monitors[0] == -1)
|
|
|
2c033f |
+ {
|
|
|
2c033f |
+ info->entire_monitor = monitor_info->rect;
|
|
|
2c033f |
+ }
|
|
|
2c033f |
+ else
|
|
|
2c033f |
{
|
|
|
2c033f |
+ int i = 0;
|
|
|
2c033f |
+ long monitor;
|
|
|
2c033f |
+
|
|
|
2c033f |
monitor = window->fullscreen_monitors[i];
|
|
|
2c033f |
- meta_rectangle_union (&info->entire_monitor,
|
|
|
2c033f |
- &window->screen->monitor_infos[monitor].rect,
|
|
|
2c033f |
- &info->entire_monitor);
|
|
|
2c033f |
+ info->entire_monitor =
|
|
|
2c033f |
+ window->screen->monitor_infos[monitor].rect;
|
|
|
2c033f |
+ for (i = 1; i <= 3; i++)
|
|
|
2c033f |
+ {
|
|
|
2c033f |
+ monitor = window->fullscreen_monitors[i];
|
|
|
2c033f |
+ meta_rectangle_union (&info->entire_monitor,
|
|
|
2c033f |
+ &window->screen->monitor_infos[monitor].rect,
|
|
|
2c033f |
+ &info->entire_monitor);
|
|
|
2c033f |
+ }
|
|
|
2c033f |
}
|
|
|
2c033f |
+ info->usable_screen_region =
|
|
|
2c033f |
+ meta_workspace_get_onscreen_region (cur_workspace);
|
|
|
2c033f |
+ info->usable_monitor_region =
|
|
|
2c033f |
+ meta_workspace_get_onmonitor_region (cur_workspace,
|
|
|
2c033f |
+ monitor_info->number);
|
|
|
2c033f |
}
|
|
|
2c033f |
|
|
|
2c033f |
- cur_workspace = window->screen->active_workspace;
|
|
|
2c033f |
- info->usable_screen_region =
|
|
|
2c033f |
- meta_workspace_get_onscreen_region (cur_workspace);
|
|
|
2c033f |
- info->usable_monitor_region =
|
|
|
2c033f |
- meta_workspace_get_onmonitor_region (cur_workspace,
|
|
|
2c033f |
- monitor_info->number);
|
|
|
2c033f |
-
|
|
|
2c033f |
/* Log all this information for debugging */
|
|
|
2c033f |
meta_topic (META_DEBUG_GEOMETRY,
|
|
|
2c033f |
"Setting up constraint info:\n"
|
|
|
67f8b7 |
@@ -489,14 +495,17 @@ place_window_if_needed(MetaWindow *window,
|
|
|
2c033f |
*/
|
|
|
2c033f |
monitor_info =
|
|
|
2c033f |
meta_screen_get_monitor_for_rect (window->screen, &placed_rect);
|
|
|
2c033f |
- info->entire_monitor = monitor_info->rect;
|
|
|
2c033f |
- meta_window_get_work_area_for_monitor (window,
|
|
|
2c033f |
- monitor_info->number,
|
|
|
2c033f |
- &info->work_area_monitor);
|
|
|
2c033f |
cur_workspace = window->screen->active_workspace;
|
|
|
2c033f |
- info->usable_monitor_region =
|
|
|
2c033f |
- meta_workspace_get_onmonitor_region (cur_workspace,
|
|
|
2c033f |
- monitor_info->number);
|
|
|
2c033f |
+ if (monitor_info)
|
|
|
2c033f |
+ {
|
|
|
2c033f |
+ info->entire_monitor = monitor_info->rect;
|
|
|
2c033f |
+ meta_window_get_work_area_for_monitor (window,
|
|
|
2c033f |
+ monitor_info->number,
|
|
|
2c033f |
+ &info->work_area_monitor);
|
|
|
2c033f |
+ info->usable_monitor_region =
|
|
|
2c033f |
+ meta_workspace_get_onmonitor_region (cur_workspace,
|
|
|
2c033f |
+ monitor_info->number);
|
|
|
2c033f |
+ }
|
|
|
2c033f |
|
|
|
2c033f |
info->current.x = placed_rect.x;
|
|
|
2c033f |
info->current.y = placed_rect.y;
|
|
|
2c033f |
diff --git a/src/core/place.c b/src/core/place.c
|
|
|
67f8b7 |
index db71b83ce..0f046f046 100644
|
|
|
2c033f |
--- a/src/core/place.c
|
|
|
2c033f |
+++ b/src/core/place.c
|
|
|
67f8b7 |
@@ -811,6 +811,8 @@ meta_window_place (MetaWindow *window,
|
|
|
2c033f |
|
|
|
2c033f |
/* Warning, this function is a round trip! */
|
|
|
2c033f |
xi = meta_screen_get_current_monitor_info (window->screen);
|
|
|
2c033f |
+ if (!xi)
|
|
|
2c033f |
+ goto done;
|
|
|
2c033f |
|
|
|
2c033f |
w = xi->rect.width;
|
|
|
2c033f |
h = xi->rect.height;
|
|
|
67f8b7 |
@@ -856,6 +858,8 @@ meta_window_place (MetaWindow *window,
|
|
|
2c033f |
|
|
|
2c033f |
/* Warning, this is a round trip! */
|
|
|
2c033f |
xi = meta_screen_get_current_monitor_info (window->screen);
|
|
|
2c033f |
+ if (!xi)
|
|
|
2c033f |
+ goto done;
|
|
|
2c033f |
|
|
|
2c033f |
/* Maximize windows if they are too big for their work area (bit of
|
|
|
2c033f |
* a hack here). Assume undecorated windows probably don't intend to
|
|
|
2c033f |
diff --git a/src/core/screen.c b/src/core/screen.c
|
|
|
67f8b7 |
index b8ac22f76..54a0b0aba 100644
|
|
|
2c033f |
--- a/src/core/screen.c
|
|
|
2c033f |
+++ b/src/core/screen.c
|
|
|
67f8b7 |
@@ -381,7 +381,10 @@ meta_screen_monitor_index_to_xinerama_index (MetaScreen *screen,
|
|
|
2c033f |
|
|
|
2c033f |
meta_screen_ensure_xinerama_indices (screen);
|
|
|
2c033f |
|
|
|
2c033f |
- return screen->monitor_infos[index].xinerama_index;
|
|
|
2c033f |
+ if (index >= 0 && index < screen->n_monitor_infos)
|
|
|
2c033f |
+ return screen->monitor_infos[index].xinerama_index;
|
|
|
2c033f |
+
|
|
|
2c033f |
+ return -1;
|
|
|
2c033f |
}
|
|
|
2c033f |
|
|
|
2c033f |
int
|
|
|
67f8b7 |
@@ -1395,6 +1398,9 @@ meta_screen_get_monitor_for_rect (MetaScreen *screen,
|
|
|
2c033f |
int i;
|
|
|
2c033f |
int best_monitor, monitor_score, rect_area;
|
|
|
2c033f |
|
|
|
2c033f |
+ if (screen->n_monitor_infos == 0)
|
|
|
2c033f |
+ return NULL;
|
|
|
2c033f |
+
|
|
|
2c033f |
if (screen->n_monitor_infos == 1)
|
|
|
2c033f |
return &screen->monitor_infos[0];
|
|
|
2c033f |
|
|
|
67f8b7 |
@@ -1448,7 +1454,7 @@ meta_screen_get_monitor_index_for_rect (MetaScreen *screen,
|
|
|
2c033f |
MetaRectangle *rect)
|
|
|
2c033f |
{
|
|
|
2c033f |
const MetaMonitorInfo *monitor = meta_screen_get_monitor_for_rect (screen, rect);
|
|
|
2c033f |
- return monitor->number;
|
|
|
2c033f |
+ return monitor ? monitor->number : -1;
|
|
|
2c033f |
}
|
|
|
2c033f |
|
|
|
67f8b7 |
const MetaMonitorInfo *
|
|
|
2c033f |
diff --git a/src/core/window.c b/src/core/window.c
|
|
|
67f8b7 |
index e3e15cf26..9745b42e0 100644
|
|
|
2c033f |
--- a/src/core/window.c
|
|
|
2c033f |
+++ b/src/core/window.c
|
|
|
67f8b7 |
@@ -1029,7 +1029,8 @@ _meta_window_shared_new (MetaDisplay *display,
|
|
|
2c033f |
|
|
|
67f8b7 |
window->monitor = meta_screen_calculate_monitor_for_window (window->screen,
|
|
|
67f8b7 |
window);
|
|
|
2c033f |
- window->preferred_output_winsys_id = window->monitor->winsys_id;
|
|
|
2c033f |
+ window->preferred_output_winsys_id = window->monitor ? window->monitor->winsys_id
|
|
|
2c033f |
+ : -1;
|
|
|
2c033f |
|
|
|
2c033f |
window->tile_match = NULL;
|
|
|
2c033f |
|
|
|
67f8b7 |
@@ -2280,7 +2281,10 @@ meta_window_show (MetaWindow *window)
|
|
|
2c033f |
if (meta_prefs_get_auto_maximize() && window->showing_for_first_time && window->has_maximize_func)
|
|
|
2c033f |
{
|
|
|
2c033f |
MetaRectangle work_area;
|
|
|
2c033f |
- meta_window_get_work_area_for_monitor (window, window->monitor->number, &work_area);
|
|
|
2c033f |
+ if (window->monitor)
|
|
|
2c033f |
+ meta_window_get_work_area_for_monitor (window, window->monitor->number, &work_area);
|
|
|
2c033f |
+ else
|
|
|
2c033f |
+ meta_window_get_work_area_current_monitor (window, &work_area);
|
|
|
2c033f |
/* Automaximize windows that map with a size > MAX_UNMAXIMIZED_WINDOW_AREA of the work area */
|
|
|
2c033f |
if (window->rect.width * window->rect.height > work_area.width * work_area.height * MAX_UNMAXIMIZED_WINDOW_AREA)
|
|
|
2c033f |
{
|
|
|
67f8b7 |
@@ -2677,7 +2681,7 @@ meta_window_maximize_internal (MetaWindow *window,
|
|
|
2c033f |
meta_window_recalc_features (window);
|
|
|
2c033f |
set_net_wm_state (window);
|
|
|
2c033f |
|
|
|
2c033f |
- if (window->monitor->in_fullscreen)
|
|
|
2c033f |
+ if (window->monitor && window->monitor->in_fullscreen)
|
|
|
2c033f |
meta_screen_queue_check_fullscreen (window->screen);
|
|
|
2c033f |
|
|
|
2c033f |
g_object_freeze_notify (G_OBJECT (window));
|
|
|
67f8b7 |
@@ -2863,6 +2867,9 @@ meta_window_is_monitor_sized (MetaWindow *window)
|
|
|
2c033f |
if (meta_window_is_screen_sized (window))
|
|
|
2c033f |
return TRUE;
|
|
|
2c033f |
|
|
|
2c033f |
+ if (!window->monitor)
|
|
|
2c033f |
+ return FALSE;
|
|
|
2c033f |
+
|
|
|
2c033f |
if (window->override_redirect)
|
|
|
2c033f |
{
|
|
|
2c033f |
MetaRectangle window_rect, monitor_rect;
|
|
|
67f8b7 |
@@ -2886,7 +2893,7 @@ meta_window_is_monitor_sized (MetaWindow *window)
|
|
|
2c033f |
gboolean
|
|
|
2c033f |
meta_window_is_on_primary_monitor (MetaWindow *window)
|
|
|
2c033f |
{
|
|
|
2c033f |
- return window->monitor->is_primary;
|
|
|
2c033f |
+ return window->monitor ? window->monitor->is_primary : FALSE;
|
|
|
2c033f |
}
|
|
|
2c033f |
|
|
|
2c033f |
/**
|
|
|
67f8b7 |
@@ -3027,7 +3034,10 @@ meta_window_unmaximize (MetaWindow *window,
|
|
|
2c033f |
MetaRectangle work_area;
|
|
|
67f8b7 |
MetaRectangle old_frame_rect, old_buffer_rect;
|
|
|
2c033f |
|
|
|
2c033f |
- meta_window_get_work_area_for_monitor (window, window->monitor->number, &work_area);
|
|
|
2c033f |
+ if (window->monitor)
|
|
|
2c033f |
+ meta_window_get_work_area_for_monitor (window, window->monitor->number, &work_area);
|
|
|
2c033f |
+ else
|
|
|
2c033f |
+ meta_window_get_work_area_current_monitor (window, &work_area);
|
|
|
67f8b7 |
meta_window_get_frame_rect (window, &old_frame_rect);
|
|
|
67f8b7 |
meta_window_get_buffer_rect (window, &old_buffer_rect);
|
|
|
2c033f |
|
|
|
67f8b7 |
@@ -3123,7 +3133,7 @@ meta_window_unmaximize (MetaWindow *window,
|
|
|
2c033f |
|
|
|
2c033f |
meta_window_recalc_features (window);
|
|
|
2c033f |
set_net_wm_state (window);
|
|
|
2c033f |
- if (!window->monitor->in_fullscreen)
|
|
|
2c033f |
+ if (window->monitor && !window->monitor->in_fullscreen)
|
|
|
2c033f |
meta_screen_queue_check_fullscreen (window->screen);
|
|
|
2c033f |
}
|
|
|
2c033f |
|
|
|
67f8b7 |
@@ -3522,7 +3532,7 @@ maybe_move_attached_dialog (MetaWindow *window,
|
|
|
2c033f |
int
|
|
|
2c033f |
meta_window_get_monitor (MetaWindow *window)
|
|
|
2c033f |
{
|
|
|
2c033f |
- return window->monitor->number;
|
|
|
2c033f |
+ return window->monitor ? window->monitor->number : -1;
|
|
|
2c033f |
}
|
|
|
2c033f |
|
|
|
2c033f |
static MetaMonitorInfo *
|
|
|
67f8b7 |
@@ -3549,14 +3559,15 @@ meta_window_update_for_monitors_changed (MetaWindow *window)
|
|
|
67f8b7 |
{
|
|
|
67f8b7 |
const MetaMonitorInfo *old, *new;
|
|
|
2c033f |
|
|
|
67f8b7 |
- if (window->override_redirect || window->type == META_WINDOW_DESKTOP)
|
|
|
2c033f |
+ old = window->monitor;
|
|
|
2c033f |
+
|
|
|
67f8b7 |
+ if (!old || window->screen->n_monitor_infos == 0 ||
|
|
|
67f8b7 |
+ window->override_redirect || window->type == META_WINDOW_DESKTOP)
|
|
|
2c033f |
{
|
|
|
2c033f |
meta_window_update_monitor (window, FALSE);
|
|
|
2c033f |
return;
|
|
|
2c033f |
}
|
|
|
2c033f |
|
|
|
2c033f |
- old = window->monitor;
|
|
|
2c033f |
-
|
|
|
2c033f |
/* Try the preferred output first */
|
|
|
2c033f |
new = find_monitor_by_winsys_id (window, window->preferred_output_winsys_id);
|
|
|
2c033f |
|
|
|
67f8b7 |
@@ -3643,7 +3654,7 @@ meta_window_move_resize_internal (MetaWindow *window,
|
|
|
2c033f |
*/
|
|
|
2c033f |
|
|
|
2c033f |
gboolean did_placement;
|
|
|
2c033f |
- guint old_output_winsys_id;
|
|
|
2c033f |
+ guint old_output_winsys_id, new_output_winsys_id;
|
|
|
2c033f |
MetaRectangle unconstrained_rect;
|
|
|
2c033f |
MetaRectangle constrained_rect;
|
|
|
2c033f |
MetaMoveResizeResultFlags result = 0;
|
|
|
67f8b7 |
@@ -3737,13 +3748,15 @@ meta_window_move_resize_internal (MetaWindow *window,
|
|
|
2c033f |
did_placement);
|
|
|
2c033f |
}
|
|
|
2c033f |
|
|
|
2c033f |
- old_output_winsys_id = window->monitor->winsys_id;
|
|
|
2c033f |
+ old_output_winsys_id = window->monitor ? window->monitor->winsys_id : -1;
|
|
|
2c033f |
|
|
|
67f8b7 |
meta_window_update_monitor (window, flags & META_MOVE_RESIZE_USER_ACTION);
|
|
|
2c033f |
|
|
|
2c033f |
- if (old_output_winsys_id != window->monitor->winsys_id &&
|
|
|
2c033f |
+ new_output_winsys_id = window->monitor ? window->monitor->winsys_id : -1;
|
|
|
2c033f |
+
|
|
|
2c033f |
+ if (old_output_winsys_id != new_output_winsys_id &&
|
|
|
67f8b7 |
flags & META_MOVE_RESIZE_MOVE_ACTION && flags & META_MOVE_RESIZE_USER_ACTION)
|
|
|
2c033f |
- window->preferred_output_winsys_id = window->monitor->winsys_id;
|
|
|
2c033f |
+ window->preferred_output_winsys_id = new_output_winsys_id;
|
|
|
2c033f |
|
|
|
2c033f |
if ((result & META_MOVE_RESIZE_RESULT_FRAME_SHAPE_CHANGED) && window->frame_bounds)
|
|
|
2c033f |
{
|
|
|
67f8b7 |
@@ -3849,7 +3862,7 @@ meta_window_move_to_monitor (MetaWindow *window,
|
|
|
2c033f |
{
|
|
|
2c033f |
MetaRectangle old_area, new_area;
|
|
|
2c033f |
|
|
|
2c033f |
- if (monitor == window->monitor->number)
|
|
|
2c033f |
+ if (!window->monitor || monitor == window->monitor->number)
|
|
|
2c033f |
return;
|
|
|
2c033f |
|
|
|
2c033f |
meta_window_get_work_area_for_monitor (window,
|
|
|
67f8b7 |
@@ -6104,9 +6117,17 @@ void
|
|
|
67f8b7 |
meta_window_get_work_area_current_monitor (MetaWindow *window,
|
|
|
67f8b7 |
MetaRectangle *area)
|
|
|
67f8b7 |
{
|
|
|
2c033f |
- meta_window_get_work_area_for_monitor (window,
|
|
|
67f8b7 |
- window->monitor->number,
|
|
|
2c033f |
- area);
|
|
|
67f8b7 |
+ if (window->monitor)
|
|
|
2c033f |
+ {
|
|
|
2c033f |
+ meta_window_get_work_area_for_monitor (window,
|
|
|
67f8b7 |
+ window->monitor->number,
|
|
|
2c033f |
+ area);
|
|
|
2c033f |
+ }
|
|
|
2c033f |
+ else if (area)
|
|
|
2c033f |
+ {
|
|
|
2c033f |
+ MetaRectangle empty = { 0, 0, 0, 0 };
|
|
|
2c033f |
+ *area = empty;
|
|
|
2c033f |
+ }
|
|
|
2c033f |
}
|
|
|
2c033f |
|
|
|
2c033f |
/**
|
|
|
2c033f |
diff --git a/src/core/workspace.c b/src/core/workspace.c
|
|
|
67f8b7 |
index cfac7dc48..a73ac6bb7 100644
|
|
|
2c033f |
--- a/src/core/workspace.c
|
|
|
2c033f |
+++ b/src/core/workspace.c
|
|
|
2c033f |
@@ -765,6 +765,9 @@ ensure_work_areas_validated (MetaWorkspace *workspace)
|
|
|
2c033f |
g_assert (workspace->screen_edges == NULL);
|
|
|
2c033f |
g_assert (workspace->monitor_edges == NULL);
|
|
|
2c033f |
|
|
|
2c033f |
+ if (workspace->screen->n_monitor_infos == 0)
|
|
|
2c033f |
+ return;
|
|
|
2c033f |
+
|
|
|
2c033f |
/* STEP 1: Get the list of struts */
|
|
|
2c033f |
|
|
|
2c033f |
workspace->all_struts = copy_strut_list (workspace->builtin_struts);
|
|
|
2c033f |
diff --git a/src/x11/window-x11.c b/src/x11/window-x11.c
|
|
|
67f8b7 |
index 376d73c78..9b102e589 100644
|
|
|
2c033f |
--- a/src/x11/window-x11.c
|
|
|
2c033f |
+++ b/src/x11/window-x11.c
|
|
|
67f8b7 |
@@ -2032,7 +2032,8 @@ meta_window_move_resize_request (MetaWindow *window,
|
|
|
2c033f |
rect.width = width;
|
|
|
2c033f |
rect.height = height;
|
|
|
2c033f |
|
|
|
2c033f |
- meta_screen_get_monitor_geometry (window->screen, window->monitor->number, &monitor_rect);
|
|
|
2c033f |
+ if (window->monitor)
|
|
|
2c033f |
+ meta_screen_get_monitor_geometry (window->screen, window->monitor->number, &monitor_rect);
|
|
|
2c033f |
|
|
|
2c033f |
/* Workaround braindead legacy apps that don't know how to
|
|
|
2c033f |
* fullscreen themselves properly - don't get fooled by
|
|
|
2c033f |
--
|
|
|
67f8b7 |
2.12.0
|
|
|
2c033f |
|