display: Rename window_ids to xids

As the hash table no longer stores only window IDs, we should rename it so
that we make sure to check if something is actually a window before using it
as a window.

https://bugzilla.gnome.org/show_bug.cgi?id=677215
This commit is contained in:
Jasper St. Pierre 2013-02-06 17:02:59 -05:00
parent 57c31a56f4
commit d8f569eaf5
4 changed files with 14 additions and 14 deletions

View File

@ -196,7 +196,7 @@ meta_barrier_constructed (GObject *object)
* so that the object stays alive and doesn't get GC'd. */
g_object_ref (barrier);
g_hash_table_insert (priv->display->window_ids, &priv->xbarrier, barrier);
g_hash_table_insert (priv->display->xids, &priv->xbarrier, barrier);
G_OBJECT_CLASS (meta_barrier_parent_class)->constructed (object);
}
@ -310,7 +310,7 @@ meta_barrier_destroy (MetaBarrier *barrier)
return;
XFixesDestroyPointerBarrier (dpy, priv->xbarrier);
g_hash_table_remove (priv->display->window_ids, &priv->xbarrier);
g_hash_table_remove (priv->display->xids, &priv->xbarrier);
priv->xbarrier = 0;
g_object_unref (barrier);
@ -360,7 +360,7 @@ meta_display_process_barrier_event (MetaDisplay *display,
{
MetaBarrier *barrier;
barrier = g_hash_table_lookup (display->window_ids, &xev->barrier);
barrier = g_hash_table_lookup (display->xids, &xev->barrier);
if (barrier != NULL)
{
meta_barrier_fire_event (barrier, xev);

View File

@ -146,7 +146,7 @@ struct _MetaDisplay
MetaEventQueue *events;
GSList *screens;
MetaScreen *active_screen;
GHashTable *window_ids;
GHashTable *xids;
int error_traps;
int (* error_trap_handler) (Display *display,
XErrorEvent *error);

View File

@ -588,7 +588,7 @@ meta_display_open (void)
event_callback,
the_display);
the_display->window_ids = g_hash_table_new (meta_unsigned_long_hash,
the_display->xids = g_hash_table_new (meta_unsigned_long_hash,
meta_unsigned_long_equal);
i = 0;
@ -1004,7 +1004,7 @@ meta_display_list_windows (MetaDisplay *display,
winlist = NULL;
g_hash_table_iter_init (&iter, display->window_ids);
g_hash_table_iter_init (&iter, display->xids);
while (g_hash_table_iter_next (&iter, &key, &value))
{
MetaWindow *window = value;
@ -1114,7 +1114,7 @@ meta_display_close (MetaDisplay *display,
/* Must be after all calls to meta_window_unmanage() since they
* unregister windows
*/
g_hash_table_destroy (display->window_ids);
g_hash_table_destroy (display->xids);
if (display->leader_window != None)
XDestroyWindow (display->xdisplay, display->leader_window);
@ -3569,7 +3569,7 @@ MetaWindow*
meta_display_lookup_x_window (MetaDisplay *display,
Window xwindow)
{
return g_hash_table_lookup (display->window_ids, &xwindow);
return g_hash_table_lookup (display->xids, &xwindow);
}
void
@ -3577,18 +3577,18 @@ meta_display_register_x_window (MetaDisplay *display,
Window *xwindowp,
MetaWindow *window)
{
g_return_if_fail (g_hash_table_lookup (display->window_ids, xwindowp) == NULL);
g_return_if_fail (g_hash_table_lookup (display->xids, xwindowp) == NULL);
g_hash_table_insert (display->window_ids, xwindowp, window);
g_hash_table_insert (display->xids, xwindowp, window);
}
void
meta_display_unregister_x_window (MetaDisplay *display,
Window xwindow)
{
g_return_if_fail (g_hash_table_lookup (display->window_ids, &xwindow) != NULL);
g_return_if_fail (g_hash_table_lookup (display->xids, &xwindow) != NULL);
g_hash_table_remove (display->window_ids, &xwindow);
g_hash_table_remove (display->xids, &xwindow);
/* Remove any pending pings */
remove_pending_pings_for_window (display, xwindow);

View File

@ -1220,7 +1220,7 @@ meta_screen_foreach_window (MetaScreen *screen,
*/
winlist = NULL;
g_hash_table_foreach (screen->display->window_ids,
g_hash_table_foreach (screen->display->xids,
listify_func,
&winlist);