|
|
2c033f |
From 9604fb36121d40a7440e3dea49f907f426146e71 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 |
---
|
|
|
2c033f |
src/core/barrier.c | 15 +++++++++++----
|
|
|
2c033f |
1 file changed, 11 insertions(+), 4 deletions(-)
|
|
|
2c033f |
|
|
|
2c033f |
diff --git a/src/core/barrier.c b/src/core/barrier.c
|
|
|
2c033f |
index b869d2e..1d372e9 100644
|
|
|
2c033f |
--- a/src/core/barrier.c
|
|
|
2c033f |
+++ b/src/core/barrier.c
|
|
|
2c033f |
@@ -14,6 +14,7 @@
|
|
|
2c033f |
#include <X11/extensions/Xfixes.h>
|
|
|
2c033f |
#include <meta/util.h>
|
|
|
2c033f |
#include <meta/barrier.h>
|
|
|
2c033f |
+#include <meta/errors.h>
|
|
|
2c033f |
#include "display-private.h"
|
|
|
2c033f |
#include "mutter-enum-types.h"
|
|
|
2c033f |
#include "core.h"
|
|
|
2c033f |
@@ -183,6 +184,7 @@ meta_barrier_constructed (GObject *object)
|
|
|
2c033f |
MetaBarrierPrivate *priv = barrier->priv;
|
|
|
2c033f |
Display *dpy;
|
|
|
2c033f |
Window root;
|
|
|
2c033f |
+ PointerBarrier xbarrier;
|
|
|
2c033f |
|
|
|
2c033f |
g_return_if_fail (priv->x1 == priv->x2 || priv->y1 == priv->y2);
|
|
|
2c033f |
|
|
|
2c033f |
@@ -192,13 +194,18 @@ meta_barrier_constructed (GObject *object)
|
|
|
2c033f |
return;
|
|
|
2c033f |
}
|
|
|
2c033f |
|
|
|
2c033f |
+ meta_error_trap_push (priv->display);
|
|
|
2c033f |
dpy = priv->display->xdisplay;
|
|
|
2c033f |
root = DefaultRootWindow (dpy);
|
|
|
2c033f |
|
|
|
2c033f |
- priv->xbarrier = XFixesCreatePointerBarrier (dpy, root,
|
|
|
2c033f |
- priv->x1, priv->y1,
|
|
|
2c033f |
- priv->x2, priv->y2,
|
|
|
2c033f |
- priv->directions, 0, NULL);
|
|
|
2c033f |
+ xbarrier = XFixesCreatePointerBarrier (dpy, root,
|
|
|
2c033f |
+ priv->x1, priv->y1,
|
|
|
2c033f |
+ priv->x2, priv->y2,
|
|
|
2c033f |
+ priv->directions, 0, NULL);
|
|
|
2c033f |
+ if (meta_error_trap_pop_with_return (priv->display) != Success)
|
|
|
2c033f |
+ return NULL;
|
|
|
2c033f |
+
|
|
|
2c033f |
+ priv->xbarrier = xbarrier;
|
|
|
2c033f |
|
|
|
2c033f |
/* Take a ref that we'll release when the XID dies inside destroy(),
|
|
|
2c033f |
* so that the object stays alive and doesn't get GC'd. */
|
|
|
2c033f |
--
|
|
|
2c033f |
2.5.0
|
|
|
2c033f |
|
|
|
2c033f |
|
|
|
2c033f |
From 4485e49f3f7d1232b7bd3c312f26117f5827e816 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/compositor.c | 3 +-
|
|
|
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 +++-
|
|
|
2c033f |
src/core/window.c | 62 ++++++++++++++--------
|
|
|
2c033f |
src/core/workspace.c | 3 ++
|
|
|
2c033f |
src/x11/window-x11.c | 3 +-
|
|
|
2c033f |
9 files changed, 105 insertions(+), 57 deletions(-)
|
|
|
2c033f |
|
|
|
2c033f |
diff --git a/src/backends/x11/meta-monitor-manager-xrandr.c b/src/backends/x11/meta-monitor-manager-xrandr.c
|
|
|
2c033f |
index 2c6d65e..3abe413 100644
|
|
|
2c033f |
--- a/src/backends/x11/meta-monitor-manager-xrandr.c
|
|
|
2c033f |
+++ b/src/backends/x11/meta-monitor-manager-xrandr.c
|
|
|
2c033f |
@@ -866,7 +866,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/compositor.c b/src/compositor/compositor.c
|
|
|
2c033f |
index 250d489..8bf469f 100644
|
|
|
2c033f |
--- a/src/compositor/compositor.c
|
|
|
2c033f |
+++ b/src/compositor/compositor.c
|
|
|
2c033f |
@@ -1105,7 +1105,8 @@ static gboolean
|
|
|
2c033f |
meta_repaint_func (gpointer data)
|
|
|
2c033f |
{
|
|
|
2c033f |
MetaCompositor *compositor = data;
|
|
|
2c033f |
- pre_paint_windows (compositor);
|
|
|
2c033f |
+ if (meta_screen_get_n_monitors (compositor->display->screen) > 0)
|
|
|
2c033f |
+ pre_paint_windows (compositor);
|
|
|
2c033f |
return TRUE;
|
|
|
2c033f |
}
|
|
|
2c033f |
|
|
|
2c033f |
diff --git a/src/compositor/meta-window-actor.c b/src/compositor/meta-window-actor.c
|
|
|
2c033f |
index 3d6fab1..476abbf 100644
|
|
|
2c033f |
--- a/src/compositor/meta-window-actor.c
|
|
|
2c033f |
+++ b/src/compositor/meta-window-actor.c
|
|
|
2c033f |
@@ -956,7 +956,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
|
|
|
2c033f |
index 9f5f127..1cff417 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
|
|
|
2c033f |
@@ -331,6 +332,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 |
|
|
|
2c033f |
@@ -376,40 +379,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"
|
|
|
2c033f |
@@ -478,14 +484,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
|
|
|
2c033f |
index 56befbd..7f21556 100644
|
|
|
2c033f |
--- a/src/core/place.c
|
|
|
2c033f |
+++ b/src/core/place.c
|
|
|
2c033f |
@@ -746,6 +746,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;
|
|
|
2c033f |
@@ -791,6 +793,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
|
|
|
2c033f |
index b26137e..6eaf04f 100644
|
|
|
2c033f |
--- a/src/core/screen.c
|
|
|
2c033f |
+++ b/src/core/screen.c
|
|
|
2c033f |
@@ -385,7 +385,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
|
|
|
2c033f |
@@ -1410,6 +1413,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 |
|
|
|
2c033f |
@@ -1463,7 +1469,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 |
|
|
|
2c033f |
const MetaMonitorInfo*
|
|
|
2c033f |
diff --git a/src/core/window.c b/src/core/window.c
|
|
|
2c033f |
index 0bc85d8..694a11e 100644
|
|
|
2c033f |
--- a/src/core/window.c
|
|
|
2c033f |
+++ b/src/core/window.c
|
|
|
2c033f |
@@ -962,7 +962,8 @@ _meta_window_shared_new (MetaDisplay *display,
|
|
|
2c033f |
window->compositor_private = NULL;
|
|
|
2c033f |
|
|
|
2c033f |
window->monitor = meta_screen_get_monitor_for_window (window->screen, 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 |
|
|
|
2c033f |
@@ -1130,7 +1131,8 @@ _meta_window_shared_new (MetaDisplay *display,
|
|
|
2c033f |
meta_window_update_struts (window);
|
|
|
2c033f |
}
|
|
|
2c033f |
|
|
|
2c033f |
- g_signal_emit_by_name (window->screen, "window-entered-monitor", window->monitor->number, window);
|
|
|
2c033f |
+ if (window->monitor)
|
|
|
2c033f |
+ g_signal_emit_by_name (window->screen, "window-entered-monitor", window->monitor->number, window);
|
|
|
2c033f |
|
|
|
2c033f |
/* Must add window to stack before doing move/resize, since the
|
|
|
2c033f |
* window might have fullscreen size (i.e. should have been
|
|
|
2c033f |
@@ -2225,7 +2227,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 |
{
|
|
|
2c033f |
@@ -2622,7 +2627,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));
|
|
|
2c033f |
@@ -2802,6 +2807,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;
|
|
|
2c033f |
@@ -2825,7 +2833,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 |
/**
|
|
|
2c033f |
@@ -2978,7 +2986,10 @@ meta_window_unmaximize_internal (MetaWindow *window,
|
|
|
2c033f |
MetaRectangle work_area;
|
|
|
2c033f |
MetaRectangle old_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);
|
|
|
2c033f |
meta_window_get_frame_rect (window, &old_rect);
|
|
|
2c033f |
|
|
|
2c033f |
meta_topic (META_DEBUG_WINDOW_OPS,
|
|
|
2c033f |
@@ -3069,7 +3080,7 @@ meta_window_unmaximize_internal (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 |
|
|
|
2c033f |
@@ -3476,7 +3487,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 *
|
|
|
2c033f |
@@ -3506,14 +3517,14 @@ meta_window_update_for_monitors_changed (MetaWindow *window)
|
|
|
2c033f |
if (window->type == META_WINDOW_DESKTOP)
|
|
|
2c033f |
return;
|
|
|
2c033f |
|
|
|
2c033f |
- if (window->override_redirect)
|
|
|
2c033f |
+ old = window->monitor;
|
|
|
2c033f |
+
|
|
|
2c033f |
+ if (!old || window->screen->n_monitor_infos == 0 || window->override_redirect)
|
|
|
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 |
|
|
|
2c033f |
@@ -3568,7 +3579,8 @@ meta_window_update_monitor (MetaWindow *window,
|
|
|
2c033f |
|
|
|
2c033f |
if (old)
|
|
|
2c033f |
g_signal_emit_by_name (window->screen, "window-left-monitor", old->number, window);
|
|
|
2c033f |
- g_signal_emit_by_name (window->screen, "window-entered-monitor", window->monitor->number, window);
|
|
|
2c033f |
+ if (window->monitor)
|
|
|
2c033f |
+ g_signal_emit_by_name (window->screen, "window-entered-monitor", window->monitor->number, window);
|
|
|
2c033f |
|
|
|
2c033f |
/* If we're changing monitors, we need to update the has_maximize_func flag,
|
|
|
2c033f |
* as the working area has changed. */
|
|
|
2c033f |
@@ -3602,7 +3614,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;
|
|
|
2c033f |
@@ -3696,13 +3708,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 |
|
|
|
2c033f |
meta_window_update_monitor (window, flags & META_IS_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 &&
|
|
|
2c033f |
flags & META_IS_MOVE_ACTION && flags & META_IS_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 |
{
|
|
|
2c033f |
@@ -3808,7 +3822,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,
|
|
|
2c033f |
@@ -6198,9 +6212,17 @@ meta_window_get_work_area_current_monitor (MetaWindow *window,
|
|
|
2c033f |
monitor = meta_screen_get_monitor_for_window (window->screen,
|
|
|
2c033f |
window);
|
|
|
2c033f |
|
|
|
2c033f |
- meta_window_get_work_area_for_monitor (window,
|
|
|
2c033f |
- monitor->number,
|
|
|
2c033f |
- area);
|
|
|
2c033f |
+ if (monitor)
|
|
|
2c033f |
+ {
|
|
|
2c033f |
+ meta_window_get_work_area_for_monitor (window,
|
|
|
2c033f |
+ 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
|
|
|
2c033f |
index f275c00..d4077d7 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
|
|
|
2c033f |
index 1e2580c..879f229 100644
|
|
|
2c033f |
--- a/src/x11/window-x11.c
|
|
|
2c033f |
+++ b/src/x11/window-x11.c
|
|
|
2c033f |
@@ -1990,7 +1990,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 |
--
|
|
|
2c033f |
2.5.0
|
|
|
2c033f |
|