[metacity/gnome-3-18] constraints: validate fullscreen monitors before using them



commit d0712f865451fd44cd25f2862012fb64fcf24368
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Thu May 12 19:29:36 2016 +0300

    constraints: validate fullscreen monitors before using them
    
    https://bugzilla.gnome.org/show_bug.cgi?id=766156

 src/core/constraints.c |   23 ++++++++++++++++++++++-
 1 files changed, 22 insertions(+), 1 deletions(-)
---
diff --git a/src/core/constraints.c b/src/core/constraints.c
index 167958c..65e81f6 100644
--- a/src/core/constraints.c
+++ b/src/core/constraints.c
@@ -337,6 +337,27 @@ meta_window_constrain (MetaWindow          *window,
     g_free (info.borders);
 }
 
+static gboolean
+validate_fullscreen_monitors (MetaWindow *window)
+{
+  gint i;
+
+  if (window->fullscreen_monitors[0] == -1)
+    return FALSE;
+
+  for (i = 0; i < 4; i++)
+    {
+      gint monitor;
+
+      monitor = window->fullscreen_monitors[i];
+
+      if (monitor < 0 || monitor > window->screen->n_xinerama_infos)
+        return FALSE;
+    }
+
+  return TRUE;
+}
+
 static void
 setup_constraint_info (ConstraintInfo      *info,
                        MetaWindow          *window,
@@ -412,7 +433,7 @@ setup_constraint_info (ConstraintInfo      *info,
                                           xinerama_info->number,
                                           &info->work_area_xinerama);
 
-  if (!window->fullscreen || window->fullscreen_monitors[0] == -1)
+  if (!window->fullscreen || !validate_fullscreen_monitors (window))
     {
       info->entire_xinerama = xinerama_info->rect;
     }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]