[mutter/override-redirect-exclusion: 5/15] Add checks against inappropriate changes to override-redirect window



commit 268b92a4ecb949c2d4b8a9352bc015bcb85479e5
Author: Owen W. Taylor <otaylor fishsoup net>
Date:   Sun Jun 14 08:11:29 2009 -0400

    Add checks against inappropriate changes to override-redirect window
    
    Add g_return_if_fail() to check that window-management functions like
    meta_window_maximize() aren't called on override-redirect windows.
    
    This reveals that were were "unminimizing" override-redirect windows
    when adding them; avoid doing that.
    
    http://bugzilla.gnome.org/show_bug.cgi?id=582639

 src/core/window.c |   53 ++++++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 50 insertions(+), 3 deletions(-)
---
diff --git a/src/core/window.c b/src/core/window.c
index c5e68a6..58ffbbd 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -1039,7 +1039,9 @@ meta_window_new_with_attrs (MetaDisplay       *display,
    * And we shouldn't unminimize windows if they were initially
    * iconic.
    */
-  if (!display->display_opening && !window->initially_iconic)
+  if (!window->override_redirect &&
+      !display->display_opening &&
+      !window->initially_iconic)
     unminimize_window_and_all_transient_parents (window);
 
   meta_error_trap_pop (display, FALSE); /* pop the XSync()-reducing trap */
@@ -2693,6 +2695,8 @@ queue_calc_showing_func (MetaWindow *window,
 void
 meta_window_minimize (MetaWindow  *window)
 {
+  g_return_if_fail (!window->override_redirect);
+
   if (!window->minimized)
     {
       window->minimized = TRUE;
@@ -2720,6 +2724,8 @@ meta_window_minimize (MetaWindow  *window)
 void
 meta_window_unminimize (MetaWindow  *window)
 {
+  g_return_if_fail (!window->override_redirect);
+
   if (window->minimized)
     {
       window->minimized = FALSE;
@@ -2873,8 +2879,11 @@ void
 meta_window_maximize (MetaWindow        *window,
                       MetaMaximizeFlags  directions)
 {
-  /* At least one of the two directions ought to be set */
   gboolean maximize_horizontally, maximize_vertically;
+
+  g_return_if_fail (!window->override_redirect);
+
+  /* At least one of the two directions ought to be set */
   maximize_horizontally = directions & META_MAXIMIZE_HORIZONTAL;
   maximize_vertically   = directions & META_MAXIMIZE_VERTICAL;
   g_assert (maximize_horizontally || maximize_vertically);
@@ -2968,8 +2977,11 @@ void
 meta_window_unmaximize (MetaWindow        *window,
                         MetaMaximizeFlags  directions)
 {
-  /* At least one of the two directions ought to be set */
   gboolean unmaximize_horizontally, unmaximize_vertically;
+
+  g_return_if_fail (!window->override_redirect);
+
+  /* At least one of the two directions ought to be set */
   unmaximize_horizontally = directions & META_MAXIMIZE_HORIZONTAL;
   unmaximize_vertically   = directions & META_MAXIMIZE_VERTICAL;
   g_assert (unmaximize_horizontally || unmaximize_vertically);
@@ -3066,6 +3078,8 @@ meta_window_unmaximize (MetaWindow        *window,
 void
 meta_window_make_above (MetaWindow  *window)
 {
+  g_return_if_fail (!window->override_redirect);
+
   window->wm_state_above = TRUE;
   meta_window_update_layer (window);
   meta_window_raise (window);
@@ -3075,6 +3089,8 @@ meta_window_make_above (MetaWindow  *window)
 void
 meta_window_unmake_above (MetaWindow  *window)
 {
+  g_return_if_fail (!window->override_redirect);
+
   window->wm_state_above = FALSE;
   meta_window_raise (window);
   meta_window_update_layer (window);
@@ -3119,6 +3135,8 @@ meta_window_make_fullscreen_internal (MetaWindow  *window)
 void
 meta_window_make_fullscreen (MetaWindow  *window)
 {
+  g_return_if_fail (!window->override_redirect);
+
   if (!window->fullscreen)
     {
       meta_window_make_fullscreen_internal (window);
@@ -3131,6 +3149,8 @@ meta_window_make_fullscreen (MetaWindow  *window)
 void
 meta_window_unmake_fullscreen (MetaWindow  *window)
 {
+  g_return_if_fail (!window->override_redirect);
+
   if (window->fullscreen)
     {
       MetaRectangle target_rect;
@@ -3194,6 +3214,8 @@ void
 meta_window_shade (MetaWindow  *window,
                    guint32      timestamp)
 {
+  g_return_if_fail (!window->override_redirect);
+
   meta_topic (META_DEBUG_WINDOW_OPS,
               "Shading %s\n", window->desc);
   if (!window->shaded)
@@ -3218,6 +3240,8 @@ void
 meta_window_unshade (MetaWindow  *window,
                      guint32      timestamp)
 {
+  g_return_if_fail (!window->override_redirect);
+
   meta_topic (META_DEBUG_WINDOW_OPS,
               "Unshading %s\n", window->desc);
   if (window->shaded)
@@ -3339,6 +3363,8 @@ void
 meta_window_activate (MetaWindow     *window,
                       guint32         timestamp)
 {
+  g_return_if_fail (!window->override_redirect);
+
   /* We're not really a pager, but the behavior we want is the same as if
    * we were such.  If we change the pager behavior later, we could revisit
    * this and just add extra flags to window_activate.
@@ -3351,6 +3377,8 @@ meta_window_activate_with_workspace (MetaWindow     *window,
                                      guint32         timestamp,
                                      MetaWorkspace  *workspace)
 {
+  g_return_if_fail (!window->override_redirect);
+
   /* We're not really a pager, but the behavior we want is the same as if
    * we were such.  If we change the pager behavior later, we could revisit
    * this and just add extra flags to window_activate.
@@ -4451,6 +4479,8 @@ meta_window_focus (MetaWindow  *window,
 {
   MetaWindow *modal_transient;
 
+  g_return_if_fail (!window->override_redirect);
+
   meta_topic (META_DEBUG_FOCUS,
               "Setting input focus to window %s, input: %d take_focus: %d\n",
               window->desc, window->input, window->take_focus);
@@ -4582,6 +4612,8 @@ void
 meta_window_change_workspace (MetaWindow    *window,
                               MetaWorkspace *workspace)
 {
+  g_return_if_fail (!window->override_redirect);
+
   meta_window_change_workspace_without_transients (window, workspace);
 
   meta_window_foreach_transient (window, change_workspace_foreach,
@@ -4679,6 +4711,9 @@ void
 meta_window_stick (MetaWindow  *window)
 {
   gboolean stick = TRUE;
+
+  g_return_if_fail (!window->override_redirect);
+
   window_stick_impl (window);
   meta_window_foreach_transient (window,
                                  stick_foreach_func,
@@ -4689,6 +4724,9 @@ void
 meta_window_unstick (MetaWindow  *window)
 {
   gboolean stick = FALSE;
+
+  g_return_if_fail (!window->override_redirect);
+
   window_unstick_impl (window);
   meta_window_foreach_transient (window,
                                  stick_foreach_func,
@@ -4789,6 +4827,9 @@ void
 meta_window_raise (MetaWindow  *window)
 {
   MetaWindow *ancestor;
+
+  g_return_if_fail (!window->override_redirect);
+
   ancestor = meta_window_find_root_ancestor (window);
 
   meta_topic (META_DEBUG_WINDOW_OPS,
@@ -4830,6 +4871,8 @@ meta_window_raise (MetaWindow  *window)
 void
 meta_window_lower (MetaWindow  *window)
 {
+  g_return_if_fail (!window->override_redirect);
+
   meta_topic (META_DEBUG_WINDOW_OPS,
               "Lowering window %s\n", window->desc);
 
@@ -5141,6 +5184,8 @@ meta_window_change_workspace_by_index (MetaWindow *window,
   MetaWorkspace *workspace;
   MetaScreen    *screen;
 
+  g_return_if_fail (!window->override_redirect);
+
   if (space_index == -1)
     {
       meta_window_stick (window);
@@ -6989,6 +7034,8 @@ meta_window_show_menu (MetaWindow *window,
   int n_workspaces;
   gboolean ltr;
 
+  g_return_if_fail (!window->override_redirect);
+
   if (window->display->window_menu)
     {
       meta_ui_window_menu_free (window->display->window_menu);



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