gtk2/gdk/win32/gdkwin32id.c
Tor Lillqvist d6ab77ea70 Bug 544684 - Win64 issue, window handles are assumed to be 32-bit
2008-08-05  Tor Lillqvist  <tml@novell.com>

	Bug 544684 - Win64 issue, window handles are assumed to be 32-bit

	* gdk/win32/gdkcursor-win32.c
	* gdk/win32/xcursors.h: Change some gchar* to guchar* and vice
	versa to avoid gcc 4.4 signedness warnings.

	* gdk/win32/gdkevents-win32.c: Add some guchar and char pointer
	casts to get rid of gcc 4.4 signedness warnings. Print GdkAtom
	values in debugging output using the %p format.
	
	* gdk/win32/gdkkeys-win32.c
	* gdk/win32/gdkfont-win32.c
	* gdk/win32/gdkmain-win32.c: Add some casts to avoid gcc warnings.
 
	* gdk/win32/gdkwindow-win32.c: Use SetWindowLongPtr() instead of
	SetWindowLong().

	* gdk/win32/gdkwin32id.c (gdk_handle_hash): Use all 64 bits of a
	HANDLE on Win64.


svn path=/trunk/; revision=20994
2008-08-04 23:21:36 +00:00

84 lines
2.1 KiB
C

/* 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
* modify it under the terms of the GNU Lesser General Public
* 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
* 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.
*/
/*
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
* 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/.
*/
#include "config.h"
#include <gdk/gdk.h>
#include "gdkprivate-win32.h"
static GHashTable *handle_ht = NULL;
static guint
gdk_handle_hash (HANDLE *handle)
{
#ifdef _WIN64
return ((guint *) handle)[0] ^ ((guint *) handle)[1];
#else
return (guint) *handle;
#endif
}
static gint
gdk_handle_equal (HANDLE *a,
HANDLE *b)
{
return (*a == *b);
}
void
gdk_win32_handle_table_insert (HANDLE *handle,
gpointer data)
{
g_return_if_fail (handle != NULL);
if (!handle_ht)
handle_ht = g_hash_table_new ((GHashFunc) gdk_handle_hash,
(GEqualFunc) gdk_handle_equal);
g_hash_table_insert (handle_ht, handle, data);
}
void
gdk_win32_handle_table_remove (HANDLE handle)
{
if (!handle_ht)
handle_ht = g_hash_table_new ((GHashFunc) gdk_handle_hash,
(GEqualFunc) gdk_handle_equal);
g_hash_table_remove (handle_ht, &handle);
}
gpointer
gdk_win32_handle_table_lookup (GdkNativeWindow handle)
{
gpointer data = NULL;
if (handle_ht)
data = g_hash_table_lookup (handle_ht, &handle);
return data;
}