summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Thurman <tthurman@gnome.org>2008-06-29 18:44:21 +0000
committerThomas James Alexander Thurman <tthurman@src.gnome.org>2008-06-29 18:44:21 +0000
commitc05e6d079c0ba5c80589be4c151804e87e6a77b3 (patch)
treebbf3abb3cac448e88a8fbd4222d8deca6e31d89b
parentb3549979c6100d960c3fef6d50d001386b4f2b55 (diff)
downloadmetacity-c05e6d079c0ba5c80589be4c151804e87e6a77b3.tar.gz
lose meta prefix since it's static. replace our own cast with glib macro
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 svn path=/trunk/; revision=3773
-rw-r--r--ChangeLog7
-rw-r--r--src/core/stack.c69
2 files changed, 48 insertions, 28 deletions
diff --git a/ChangeLog b/ChangeLog
index 33b1a7d4..ab857581 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+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
+
2008-06-28 Thomas Thurman <tthurman@gnome.org>
* src/core/display.c, src/compositor/compositor-xrender.c: add checks
diff --git a/src/core/stack.c b/src/core/stack.c
index 60c03832..cf770bca 100644
--- a/src/core/stack.c
+++ b/src/core/stack.c
@@ -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 @@ meta_stack_add (MetaStack *stack,
"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 @@ meta_stack_remove (MetaStack *stack,
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 @@ meta_stack_update_layer (MetaStack *stack,
{
stack->need_relayer = TRUE;
- meta_stack_sync_to_server (stack);
+ stack_sync_to_server (stack);
}
void
@@ -168,7 +173,7 @@ meta_stack_update_transient (MetaStack *stack,
{
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_stack_raise (MetaStack *stack,
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_stack_lower (MetaStack *stack,
{
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 @@ meta_stack_thaw (MetaStack *stack)
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 @@ stack_do_window_deletions (MetaStack *stack)
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 @@ stack_do_resort (MetaStack *stack)
}
/**
+ * 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_ensure_sorted (MetaStack *stack)
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 @@ raise_window_relative_to_managed_windows (MetaScreen *screen,
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_stack_set_positions (MetaStack *stack,
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 @@ meta_window_set_stack_position (MetaWindow *window,
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);
}