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
This commit is contained in:
Thomas Thurman 2008-06-29 18:44:21 +00:00 committed by Thomas James Alexander Thurman
parent b3549979c6
commit c05e6d079c
2 changed files with 48 additions and 28 deletions

View File

@ -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> 2008-06-28 Thomas Thurman <tthurman@gnome.org>
* src/core/display.c, src/compositor/compositor-xrender.c: add checks * src/core/display.c, src/compositor/compositor-xrender.c: add checks

View File

@ -1,7 +1,7 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */ /* -*- 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) #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, static void meta_window_set_stack_position_no_sync (MetaWindow *window,
int position); int position);
static void stack_do_window_deletions (MetaStack *stack); 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 %s has stack_position initialized to %d\n",
window->desc, window->stack_position); window->desc, window->stack_position);
meta_stack_sync_to_server (stack); stack_sync_to_server (stack);
} }
void void
@ -145,12 +145,17 @@ meta_stack_remove (MetaStack *stack,
stack->added = g_list_remove (stack->added, window); stack->added = g_list_remove (stack->added, window);
stack->sorted = g_list_remove (stack->sorted, window); stack->sorted = g_list_remove (stack->sorted, window);
/* Remember the window ID to remove it from the stack array */ /* Remember the window ID to remove it from the stack array.
stack->removed = g_list_prepend (stack->removed, (void*) window->xwindow); * 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) 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 void
@ -159,7 +164,7 @@ meta_stack_update_layer (MetaStack *stack,
{ {
stack->need_relayer = TRUE; stack->need_relayer = TRUE;
meta_stack_sync_to_server (stack); stack_sync_to_server (stack);
} }
void void
@ -168,7 +173,7 @@ meta_stack_update_transient (MetaStack *stack,
{ {
stack->need_constrain = TRUE; stack->need_constrain = TRUE;
meta_stack_sync_to_server (stack); stack_sync_to_server (stack);
} }
/* raise/lower within a layer */ /* raise/lower within a layer */
@ -179,7 +184,7 @@ meta_stack_raise (MetaStack *stack,
meta_window_set_stack_position_no_sync (window, meta_window_set_stack_position_no_sync (window,
stack->n_positions - 1); stack->n_positions - 1);
meta_stack_sync_to_server (stack); stack_sync_to_server (stack);
} }
void void
@ -188,10 +193,9 @@ meta_stack_lower (MetaStack *stack,
{ {
meta_window_set_stack_position_no_sync (window, 0); 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 void
meta_stack_freeze (MetaStack *stack) meta_stack_freeze (MetaStack *stack)
{ {
@ -204,7 +208,7 @@ meta_stack_thaw (MetaStack *stack)
g_return_if_fail (stack->freeze_count > 0); g_return_if_fail (stack->freeze_count > 0);
stack->freeze_count -= 1; stack->freeze_count -= 1;
meta_stack_sync_to_server (stack); stack_sync_to_server (stack);
} }
static gboolean static gboolean
@ -736,8 +740,7 @@ stack_do_window_deletions (MetaStack *stack)
while (tmp != NULL) while (tmp != NULL)
{ {
Window xwindow; Window xwindow;
xwindow = GPOINTER_TO_UINT (tmp->data);
xwindow = (unsigned long) tmp->data;
/* We go from the end figuring removals are more /* We go from the end figuring removals are more
* likely to be recent. * 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 * 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 * 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, * (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); 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 static void
raise_window_relative_to_managed_windows (MetaScreen *screen, raise_window_relative_to_managed_windows (MetaScreen *screen,
Window xwindow) 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 ignored1, ignored2;
Window *children; Window *children;
@ -1032,8 +1038,15 @@ raise_window_relative_to_managed_windows (MetaScreen *screen,
XFree (children); 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 static void
meta_stack_sync_to_server (MetaStack *stack) stack_sync_to_server (MetaStack *stack)
{ {
GArray *stacked; GArray *stacked;
GArray *root_children_stacked; GArray *root_children_stacked;
@ -1582,7 +1595,7 @@ meta_stack_set_positions (MetaStack *stack,
meta_topic (META_DEBUG_STACK, meta_topic (META_DEBUG_STACK,
"Reset the stack positions of (nearly) all windows\n"); "Reset the stack positions of (nearly) all windows\n");
meta_stack_sync_to_server (stack); stack_sync_to_server (stack);
} }
void void
@ -1644,5 +1657,5 @@ meta_window_set_stack_position (MetaWindow *window,
int position) int position)
{ {
meta_window_set_stack_position_no_sync (window, 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);
} }