[broadway] Track window<->id mapping

This commit is contained in:
Alexander Larsson 2010-11-20 22:38:34 +01:00
parent cdd274a55c
commit d211d78eef
3 changed files with 8 additions and 0 deletions

View File

@ -59,6 +59,7 @@ _gdk_display_broadway_class_init (GdkDisplayBroadwayClass * class)
static void
_gdk_display_broadway_init (GdkDisplayBroadway *display)
{
display->id_ht = g_hash_table_new (NULL, NULL);
}
static void

View File

@ -49,6 +49,8 @@ struct _GdkDisplayBroadway
GdkScreen *default_screen;
GdkScreen **screens;
GHashTable *id_ht;
GSource *event_source;
GdkWindow *mouse_in_toplevel;

View File

@ -251,6 +251,7 @@ gdk_window_impl_broadway_finalize (GObject *object)
GdkWindowObject *wrapper;
GdkDrawableImplBroadway *draw_impl;
GdkWindowImplBroadway *window_impl;
GdkDisplayBroadway *display_broadway;
g_return_if_fail (GDK_IS_WINDOW_IMPL_BROADWAY (object));
@ -259,6 +260,9 @@ gdk_window_impl_broadway_finalize (GObject *object)
wrapper = (GdkWindowObject*) draw_impl->wrapper;
display_broadway = GDK_DISPLAY_BROADWAY (gdk_window_get_display (wrapper));
g_hash_table_remove (display_broadway->id_ht, window_impl->id);
if (window_impl->cursor)
gdk_cursor_unref (window_impl->cursor);
@ -330,6 +334,7 @@ _gdk_window_impl_new (GdkWindow *window,
impl = g_object_new (_gdk_window_impl_get_type (), NULL);
private->impl = (GdkDrawable *)impl;
impl->id = current_id++;
g_hash_table_insert (display_broadway->id_ht, impl->id, window);
draw_impl = GDK_DRAWABLE_IMPL_BROADWAY (impl);
draw_impl->wrapper = GDK_DRAWABLE (window);