summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/core/monitor.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/src/core/monitor.c b/src/core/monitor.c
index b76ed9ff9..aaa67c78a 100644
--- a/src/core/monitor.c
+++ b/src/core/monitor.c
@@ -1580,6 +1580,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;
@@ -1598,6 +1599,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,
@@ -1657,9 +1659,17 @@ meta_monitor_manager_handle_apply_configuration (MetaDBusDisplayConfig *skeleto
"Invalid CRTC geometry");
return TRUE;
}
+
+ new_screen_width = MAX (new_screen_width, x + width);
+ new_screen_height = MAX (new_screen_height, y + 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 ||
@@ -1720,6 +1730,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))
{