metacity r3773 - in trunk: . src/core



Author: tthurman
Date: Sun Jun 29 18:44:21 2008
New Revision: 3773
URL: http://svn.gnome.org/viewvc/metacity?rev=3773&view=rev

Log:
2008-06-29  Thomas Thurman  <tthurman gnome org>

        * src/core/stack.c (stack_sync_to_server): lose meta prefix
          since it's static. 
        * src/core/stack.c (meta_stack_remove, stack_do_window_deletions):
          replace our own cast with glib macro designed to do the same thing



Modified:
   trunk/ChangeLog
   trunk/src/core/stack.c

Modified: trunk/src/core/stack.c
==============================================================================
--- trunk/src/core/stack.c	(original)
+++ trunk/src/core/stack.c	Sun Jun 29 18:44:21 2008
@@ -1,7 +1,7 @@
 /* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
 
 /**
- * \file stack.c  Metacity window stack
+ * \file stack.c  Which windows cover which other windows
  */
 
 /* 
@@ -51,7 +51,7 @@
 
 #define WINDOW_IN_STACK(w) (w->stack_position >= 0)
 
-static void meta_stack_sync_to_server (MetaStack *stack);
+static void stack_sync_to_server (MetaStack *stack);
 static void meta_window_set_stack_position_no_sync (MetaWindow *window,
                                                     int         position);
 static void stack_do_window_deletions (MetaStack *stack);
@@ -120,7 +120,7 @@
               "Window %s has stack_position initialized to %d\n",
               window->desc, window->stack_position);
   
-  meta_stack_sync_to_server (stack);
+  stack_sync_to_server (stack);
 }
 
 void
@@ -145,12 +145,17 @@
   stack->added = g_list_remove (stack->added, window);
   stack->sorted = g_list_remove (stack->sorted, window);
 
-  /* Remember the window ID to remove it from the stack array */
-  stack->removed = g_list_prepend (stack->removed, (void*) window->xwindow);
+  /* Remember the window ID to remove it from the stack array.
+   * The macro is safe to use: Window is guaranteed to be 32 bits, and
+   * GUINT_TO_POINTER says it only works on 32 bits.
+   */
+  stack->removed = g_list_prepend (stack->removed,
+                                   GUINT_TO_POINTER (window->xwindow));
   if (window->frame)
-    stack->removed = g_list_prepend (stack->removed, (void*) window->frame->xwindow);
+    stack->removed = g_list_prepend (stack->removed,
+                                     GUINT_TO_POINTER (window->frame->xwindow));
   
-  meta_stack_sync_to_server (stack);
+  stack_sync_to_server (stack);
 }
 
 void
@@ -159,7 +164,7 @@
 {
   stack->need_relayer = TRUE;
   
-  meta_stack_sync_to_server (stack);
+  stack_sync_to_server (stack);
 }
 
 void
@@ -168,7 +173,7 @@
 {
   stack->need_constrain = TRUE;
   
-  meta_stack_sync_to_server (stack);
+  stack_sync_to_server (stack);
 }
 
 /* raise/lower within a layer */
@@ -179,7 +184,7 @@
   meta_window_set_stack_position_no_sync (window,
                                           stack->n_positions - 1);
   
-  meta_stack_sync_to_server (stack);
+  stack_sync_to_server (stack);
 }
 
 void
@@ -188,10 +193,9 @@
 {
   meta_window_set_stack_position_no_sync (window, 0);
   
-  meta_stack_sync_to_server (stack);
+  stack_sync_to_server (stack);
 }
 
-/* Prevent syncing to server until thaw */
 void
 meta_stack_freeze (MetaStack *stack)
 {
@@ -204,7 +208,7 @@
   g_return_if_fail (stack->freeze_count > 0);
   
   stack->freeze_count -= 1;
-  meta_stack_sync_to_server (stack);
+  stack_sync_to_server (stack);
 }
 
 static gboolean
@@ -736,8 +740,7 @@
   while (tmp != NULL)
     {
       Window xwindow;
-
-      xwindow = (unsigned long) tmp->data;
+      xwindow = GPOINTER_TO_UINT (tmp->data);
 
       /* We go from the end figuring removals are more
        * likely to be recent.
@@ -917,6 +920,8 @@
 }
 
 /**
+ * Puts the stack into canonical form.
+ *
  * Honour the removed and added lists of the stack, and then recalculate
  * all the layers (if the flag is set), re-run all the constraint calculations
  * (if the flag is set), and finally re-sort the stack (if the flag is set,
@@ -933,20 +938,21 @@
   stack_do_resort (stack);
 }
 
+/**
+ * This function is used to avoid raising a window above popup
+ * menus and other such things.
+ *
+ * FIXME This is sort of an expensive function, should probably
+ * do something to avoid it. One approach would be to reverse
+ * the stacking algorithm to work by placing each window above
+ * the others, and start by lowering a window to the bottom
+ * (instead of the current way, which works by placing each
+ * window below another and starting with a raise)
+ */
 static void
 raise_window_relative_to_managed_windows (MetaScreen *screen,
                                           Window      xwindow)
 {
-  /* This function is used to avoid raising a window above popup
-   * menus and other such things.
-   *
-   * FIXME This is sort of an expensive function, should probably
-   * do something to avoid it. One approach would be to reverse
-   * the stacking algorithm to work by placing each window above
-   * the others, and start by lowering a window to the bottom
-   * (instead of the current way, which works by placing each
-   * window below another and starting with a raise)
-   */
 
   Window ignored1, ignored2;
   Window *children;
@@ -1032,8 +1038,15 @@
     XFree (children);
 }
 
+/**
+ * Order the windows on the X server to be the same as in our structure.
+ * We do this using XRestackWindows if we don't know the previous order,
+ * or XConfigureWindow on a few particular windows if we do and can figure
+ * out the minimum set of changes.  After that, we set __NET_CLIENT_LIST
+ * and __NET_CLIENT_LIST_STACKING.
+ */
 static void
-meta_stack_sync_to_server (MetaStack *stack)
+stack_sync_to_server (MetaStack *stack)
 {
   GArray *stacked;
   GArray *root_children_stacked;
@@ -1582,7 +1595,7 @@
   meta_topic (META_DEBUG_STACK,
               "Reset the stack positions of (nearly) all windows\n");
 
-  meta_stack_sync_to_server (stack);
+  stack_sync_to_server (stack);
 }
 
 void
@@ -1644,5 +1657,5 @@
                                 int         position)
 {
   meta_window_set_stack_position_no_sync (window, position);
-  meta_stack_sync_to_server (window->screen->stack);
+  stack_sync_to_server (window->screen->stack);
 }



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