1997-11-24 22:37:52 +00:00
|
|
|
/* GDK - The GIMP Drawing Kit
|
|
|
|
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
2000-07-26 11:33:08 +00:00
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
1997-11-24 22:37:52 +00:00
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
2000-07-26 11:33:08 +00:00
|
|
|
* Lesser General Public License for more details.
|
1997-11-24 22:37:52 +00:00
|
|
|
*
|
2000-07-26 11:33:08 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
1998-04-13 02:02:47 +00:00
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
1997-11-24 22:37:52 +00:00
|
|
|
*/
|
1999-02-24 07:37:18 +00:00
|
|
|
|
|
|
|
/*
|
2000-07-26 11:33:08 +00:00
|
|
|
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
|
1999-02-24 07:37:18 +00:00
|
|
|
* file for a list of people on the GTK+ Team. See the ChangeLog
|
|
|
|
* files for a list of changes. These files are distributed with
|
|
|
|
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
|
|
|
|
*/
|
|
|
|
|
1999-11-08 20:14:59 +00:00
|
|
|
#include "gdkprivate-x11.h"
|
1997-12-18 02:17:14 +00:00
|
|
|
#include <stdio.h>
|
1997-11-24 22:37:52 +00:00
|
|
|
|
2000-11-13 13:15:41 +00:00
|
|
|
static guint gdk_xid_hash (XID *xid);
|
|
|
|
static gboolean gdk_xid_equal (XID *a,
|
|
|
|
XID *b);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
|
1998-11-07 16:12:37 +00:00
|
|
|
static GHashTable *xid_ht = NULL;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
gdk_xid_table_insert (XID *xid,
|
|
|
|
gpointer data)
|
|
|
|
{
|
|
|
|
g_return_if_fail (xid != NULL);
|
|
|
|
|
|
|
|
if (!xid_ht)
|
|
|
|
xid_ht = g_hash_table_new ((GHashFunc) gdk_xid_hash,
|
2000-11-13 13:15:41 +00:00
|
|
|
(GEqualFunc) gdk_xid_equal);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
g_hash_table_insert (xid_ht, xid, data);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gdk_xid_table_remove (XID xid)
|
|
|
|
{
|
|
|
|
if (!xid_ht)
|
|
|
|
xid_ht = g_hash_table_new ((GHashFunc) gdk_xid_hash,
|
2000-11-13 13:15:41 +00:00
|
|
|
(GEqualFunc) gdk_xid_equal);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
g_hash_table_remove (xid_ht, &xid);
|
|
|
|
}
|
|
|
|
|
|
|
|
gpointer
|
|
|
|
gdk_xid_table_lookup (XID xid)
|
|
|
|
{
|
1998-07-17 14:48:35 +00:00
|
|
|
gpointer data = NULL;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
1998-07-17 14:48:35 +00:00
|
|
|
if (xid_ht)
|
|
|
|
data = g_hash_table_lookup (xid_ht, &xid);
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
return data;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static guint
|
|
|
|
gdk_xid_hash (XID *xid)
|
|
|
|
{
|
|
|
|
return *xid;
|
|
|
|
}
|
|
|
|
|
2000-11-13 13:15:41 +00:00
|
|
|
static gboolean
|
|
|
|
gdk_xid_equal (XID *a,
|
|
|
|
XID *b)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
return (*a == *b);
|
|
|
|
}
|