00001 /* GDK - The GIMP Drawing Kit 00002 * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald 00003 * 00004 * This library is free software; you can redistribute it and/or 00005 * modify it under the terms of the GNU Library General Public 00006 * License as published by the Free Software Foundation; either 00007 * version 2 of the License, or (at your option) any later version. 00008 * 00009 * This library is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 * Library General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU Library General Public 00015 * License along with this library; if not, write to the 00016 * Free Software Foundation, Inc., 59 Temple Place - Suite 330, 00017 * Boston, MA 02111-1307, USA. 00018 */ 00019 00020 /* 00021 * Modified by the GTK+ Team and others 1997-1999. See the AUTHORS 00022 * file for a list of people on the GTK+ Team. See the ChangeLog 00023 * files for a list of changes. These files are distributed with 00024 * GTK+ at ftp://ftp.gtk.org/pub/gtk/. 00025 */ 00026 00027 #include "config.h" 00028 00029 #include <stdio.h> 00030 #include <gdk/gdk.h> 00031 00032 #include "gdkprivate-win32.h" 00033 00034 static guint gdk_xid_hash(HANDLE * xid); 00035 static gint gdk_xid_compare(HANDLE * a, HANDLE * b); 00036 00037 00038 static GHashTable *xid_ht = NULL; 00039 00040 00041 void gdk_xid_table_insert(HANDLE * xid, gpointer data) 00042 { 00043 g_return_if_fail(xid != NULL); 00044 00045 if (!xid_ht) 00046 xid_ht = g_hash_table_new((GHashFunc) gdk_xid_hash, 00047 (GCompareFunc) gdk_xid_compare); 00048 00049 g_hash_table_insert(xid_ht, xid, data); 00050 } 00051 00052 void gdk_xid_table_remove(HANDLE xid) 00053 { 00054 if (!xid_ht) 00055 xid_ht = g_hash_table_new((GHashFunc) gdk_xid_hash, 00056 (GCompareFunc) gdk_xid_compare); 00057 00058 g_hash_table_remove(xid_ht, &xid); 00059 } 00060 00061 gpointer gdk_xid_table_lookup(HANDLE xid) 00062 { 00063 gpointer data = NULL; 00064 00065 if (xid_ht) 00066 data = g_hash_table_lookup(xid_ht, &xid); 00067 00068 return data; 00069 } 00070 00071 00072 static guint gdk_xid_hash(HANDLE * xid) 00073 { 00074 return (guint) * xid; 00075 } 00076 00077 static gint gdk_xid_compare(HANDLE * a, HANDLE * b) 00078 { 00079 return (*a == *b); 00080 }