[mutter/wip/display-no-wayland: 27/33] MonitorManager: ignore configuration changes that disable all outputs
- From: Giovanni Campagna <gcampagna src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wip/display-no-wayland: 27/33] MonitorManager: ignore configuration changes that disable all outputs
- Date: Fri, 16 Aug 2013 14:40:54 +0000 (UTC)
commit 2200a2a49d550c4964c47bc407c225b8d2b4ab59
Author: Giovanni Campagna <gcampagn redhat com>
Date: Fri Jul 26 15:31:17 2013 +0200
MonitorManager: ignore configuration changes that disable all outputs
If we compute a screen size of 0 in either direction, we crash
later on, as it is invalid for clutter, cogl and X.
https://bugzilla.gnome.org/show_bug.cgi?id=705670
src/core/monitor.c | 42 +++++++++++++++++++++++++++++++-----------
1 files changed, 31 insertions(+), 11 deletions(-)
---
diff --git a/src/core/monitor.c b/src/core/monitor.c
index cbb4dcd..e39c987 100644
--- a/src/core/monitor.c
+++ b/src/core/monitor.c
@@ -1567,6 +1567,7 @@ meta_monitor_manager_handle_apply_configuration (MetaDBusDisplayConfig *skeleto
GVariant *properties;
guint crtc_id;
int new_mode, x, y;
+ int new_screen_width, new_screen_height;
guint transform;
guint output_id;
GPtrArray *crtc_infos, *output_infos;
@@ -1585,6 +1586,7 @@ meta_monitor_manager_handle_apply_configuration (MetaDBusDisplayConfig *skeleto
(GDestroyNotify) meta_output_info_free);
/* Validate all arguments */
+ new_screen_width = 0; new_screen_height = 0;
g_variant_iter_init (&crtc_iter, crtcs);
while (g_variant_iter_loop (&crtc_iter, "(uiiiuaua{sv})",
&crtc_id, &new_mode, &x, &y, &transform,
@@ -1619,19 +1621,29 @@ meta_monitor_manager_handle_apply_configuration (MetaDBusDisplayConfig *skeleto
mode = new_mode != -1 ? &manager->modes[new_mode] : NULL;
crtc_info->mode = mode;
- if (mode &&
- (x < 0 ||
- x + mode->width > manager->max_screen_width ||
- y < 0 ||
- y + mode->height > manager->max_screen_height))
+ if (mode)
{
- g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR,
- G_DBUS_ERROR_INVALID_ARGS,
- "Invalid CRTC geometry");
- return TRUE;
+ if (x < 0 ||
+ x + mode->width > manager->max_screen_width ||
+ y < 0 ||
+ y + mode->height > manager->max_screen_height)
+ {
+ g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR,
+ G_DBUS_ERROR_INVALID_ARGS,
+ "Invalid CRTC geometry");
+ return TRUE;
+ }
+
+ new_screen_width = MAX (new_screen_width, x + mode->width);
+ new_screen_height = MAX (new_screen_height, y + mode->height);
+ crtc_info->x = x;
+ crtc_info->y = y;
+ }
+ else
+ {
+ crtc_info->x = 0;
+ crtc_info->y = 0;
}
- crtc_info->x = x;
- crtc_info->y = y;
if (transform < WL_OUTPUT_TRANSFORM_NORMAL ||
transform > WL_OUTPUT_TRANSFORM_FLIPPED_270)
@@ -1691,6 +1703,14 @@ meta_monitor_manager_handle_apply_configuration (MetaDBusDisplayConfig *skeleto
g_ptr_array_add (crtc_infos, crtc_info);
}
+ if (new_screen_width == 0 || new_screen_height == 0)
+ {
+ g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR,
+ G_DBUS_ERROR_INVALID_ARGS,
+ "Refusing to disable all outputs");
+ return TRUE;
+ }
+
g_variant_iter_init (&output_iter, outputs);
while (g_variant_iter_loop (&output_iter, "(u a{sv})", &output_id, &properties))
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]