* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
/*
#include "config.h"
-#include "gdkx.h"
#include "gdkprivate-x11.h"
#include "gdkdisplay-x11.h"
#include <stdio.h>
-static guint gdk_xid_hash (XID *xid);
-static gboolean gdk_xid_equal (XID *a,
- XID *b);
+static guint
+gdk_xid_hash (XID *xid)
+{
+ return *xid;
+}
+static gboolean
+gdk_xid_equal (XID *a, XID *b)
+{
+ return (*a == *b);
+}
void
-_gdk_xid_table_insert (GdkDisplay *display,
- XID *xid,
- gpointer data)
+_gdk_x11_display_add_window (GdkDisplay *display,
+ XID *xid,
+ GdkWindow *data)
{
- GdkDisplayX11 *display_x11;
+ GdkX11Display *display_x11;
g_return_if_fail (xid != NULL);
g_return_if_fail (GDK_IS_DISPLAY (display));
- display_x11 = GDK_DISPLAY_X11 (display);
+ display_x11 = GDK_X11_DISPLAY (display);
if (!display_x11->xid_ht)
display_x11->xid_ht = g_hash_table_new ((GHashFunc) gdk_xid_hash,
- (GEqualFunc) gdk_xid_equal);
+ (GEqualFunc) gdk_xid_equal);
if (g_hash_table_lookup (display_x11->xid_ht, xid))
g_warning ("XID collision, trouble ahead");
}
void
-_gdk_xid_table_remove (GdkDisplay *display,
- XID xid)
+_gdk_x11_display_remove_window (GdkDisplay *display,
+ XID xid)
{
- GdkDisplayX11 *display_x11;
+ GdkX11Display *display_x11;
g_return_if_fail (GDK_IS_DISPLAY (display));
- display_x11 = GDK_DISPLAY_X11 (display);
+ display_x11 = GDK_X11_DISPLAY (display);
if (display_x11->xid_ht)
g_hash_table_remove (display_x11->xid_ht, &xid);
}
/**
- * gdk_xid_table_lookup_for_display:
- * @display: the #GdkDisplay.
- * @xid: an X id.
+ * gdk_x11_window_lookup_for_display:
+ * @display: (type GdkX11Window): the #GdkDisplay corresponding to the
+ * window handle
+ * @window: an XLib <type>Window</type>
*
- * Returns the GDK object associated with the given X id.
+ * Looks up the #GdkWindow that wraps the given native window handle.
*
- * Return value: (transfer none): the associated #GdkWindow, or %NULL
- * of no object is associated with the X id.
+ * Return value: (transfer none): the #GdkWindow wrapper for the native
+ * window, or %NULL if there is none.
*
- * Since: 2.2
+ * Since: 2.24
*/
-gpointer
-gdk_xid_table_lookup_for_display (GdkDisplay *display,
- XID xid)
+GdkWindow *
+gdk_x11_window_lookup_for_display (GdkDisplay *display,
+ Window window)
{
- GdkDisplayX11 *display_x11;
- gpointer data = NULL;
-
- g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
-
- display_x11 = GDK_DISPLAY_X11 (display);
+ GdkX11Display *display_x11;
+ GdkWindow *data = NULL;
- if (display_x11->xid_ht)
- data = g_hash_table_lookup (display_x11->xid_ht, &xid);
-
- return data;
-}
+ g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
+ display_x11 = GDK_X11_DISPLAY (display);
-/**
- * gdk_xid_table_lookup:
- * @xid: an X id.
- *
- * Returns the Gdk object associated with the given X id for the default
- * display.
- *
- * Return value: (transfer none): the associated #GdkWindow, or %NULL
- * if no object is associated with the X id.
- */
-gpointer
-gdk_xid_table_lookup (XID xid)
-{
- return gdk_xid_table_lookup_for_display (gdk_display_get_default (), xid);
-}
-
-static guint
-gdk_xid_hash (XID *xid)
-{
- return *xid;
-}
+ if (display_x11->xid_ht)
+ data = g_hash_table_lookup (display_x11->xid_ht, &window);
-static gboolean
-gdk_xid_equal (XID *a,
- XID *b)
-{
- return (*a == *b);
+ return data;
}