From d8f569eaf5b49eb01e40ae3d1df494eb9f59ea9c Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Wed, 6 Feb 2013 17:02:59 -0500 Subject: [PATCH] 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 --- src/core/barrier.c | 6 +++--- src/core/display-private.h | 2 +- src/core/display.c | 18 +++++++++--------- src/core/screen.c | 2 +- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/core/barrier.c b/src/core/barrier.c index b50a50e0f..f89b1fa9a 100644 --- a/src/core/barrier.c +++ b/src/core/barrier.c @@ -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); diff --git a/src/core/display-private.h b/src/core/display-private.h index cec849c27..e7a74aa2e 100644 --- a/src/core/display-private.h +++ b/src/core/display-private.h @@ -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); diff --git a/src/core/display.c b/src/core/display.c index 334427cf3..f82eb2c51 100644 --- a/src/core/display.c +++ b/src/core/display.c @@ -588,8 +588,8 @@ meta_display_open (void) event_callback, the_display); - the_display->window_ids = g_hash_table_new (meta_unsigned_long_hash, - meta_unsigned_long_equal); + the_display->xids = g_hash_table_new (meta_unsigned_long_hash, + meta_unsigned_long_equal); i = 0; while (i < N_IGNORED_CROSSING_SERIALS) @@ -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); diff --git a/src/core/screen.c b/src/core/screen.c index 6d525553e..70a8b6b03 100644 --- a/src/core/screen.c +++ b/src/core/screen.c @@ -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);