1 /* GDK - The GIMP Drawing Kit
2 * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
19 * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
20 * file for a list of people on the GTK+ Team. See the ChangeLog
21 * files for a list of changes. These files are distributed with
22 * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
27 #include "gdkprivate-x11.h"
28 #include "gdkdisplay-x11.h"
33 gdk_xid_hash (XID *xid)
39 gdk_xid_equal (XID *a, XID *b)
45 _gdk_x11_display_add_window (GdkDisplay *display,
49 GdkX11Display *display_x11;
51 g_return_if_fail (xid != NULL);
52 g_return_if_fail (GDK_IS_DISPLAY (display));
54 display_x11 = GDK_X11_DISPLAY (display);
56 if (!display_x11->xid_ht)
57 display_x11->xid_ht = g_hash_table_new ((GHashFunc) gdk_xid_hash,
58 (GEqualFunc) gdk_xid_equal);
60 if (g_hash_table_lookup (display_x11->xid_ht, xid))
61 g_warning ("XID collision, trouble ahead");
63 g_hash_table_insert (display_x11->xid_ht, xid, data);
67 _gdk_x11_display_remove_window (GdkDisplay *display,
70 GdkX11Display *display_x11;
72 g_return_if_fail (GDK_IS_DISPLAY (display));
74 display_x11 = GDK_X11_DISPLAY (display);
76 if (display_x11->xid_ht)
77 g_hash_table_remove (display_x11->xid_ht, &xid);
81 * gdk_x11_window_lookup_for_display:
82 * @display: (type GdkX11Window): the #GdkDisplay corresponding to the
84 * @window: an XLib <type>Window</type>
86 * Looks up the #GdkWindow that wraps the given native window handle.
88 * Return value: (transfer none): the #GdkWindow wrapper for the native
89 * window, or %NULL if there is none.
94 gdk_x11_window_lookup_for_display (GdkDisplay *display,
97 GdkX11Display *display_x11;
98 GdkWindow *data = NULL;
100 g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
102 display_x11 = GDK_X11_DISPLAY (display);
104 if (display_x11->xid_ht)
105 data = g_hash_table_lookup (display_x11->xid_ht, &window);