Commit d6ab77ea authored by Tor Lillqvist's avatar Tor Lillqvist Committed by Tor Lillqvist

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
parent a860ec7d
......@@ -25,11 +25,26 @@
parameter of gdk_selection_send_notify_for_display() and
gdk_selection_send_notify().
* 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
* gdk/win32/gdkproperty-win32.c
* gdk/win32/gdkselection-win32.c: Add some guchar and char pointer
casts to get rid of gcc 4.4 warnings. Print GdkAtom values in
debugging output using the %p format.
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.
* gtk/gtkwindow.h
* gtk/gtkwindow.c: Change the type of the xid parameter of the
internal gtk_window_remove_embedded_xid() and
......
......@@ -429,7 +429,8 @@ gdk_win32_icon_to_pixbuf_libgtk_only (HICON hicon)
RGBQUAD colors[2];
} bmi;
HDC hdc;
gchar *pixels, *bits, buf[32];
guchar *pixels, *bits;
gchar buf[32];
gint rowstride, x, y, w, h;
if (!GDI_CALL (GetIconInfo, (hicon, &ii)))
......
......@@ -292,8 +292,11 @@ _gdk_win32_window_procedure (HWND hwnd,
retval = inner_window_procedure (hwnd, message, wparam, lparam);
debug_indent -= 2;
GDK_NOTE (EVENTS, g_print (" => %ld%s",
retval, (debug_indent == 0 ? "\n" : "")));
#ifdef _WIN64
GDK_NOTE (EVENTS, g_print (" => %I64d%s", retval, (debug_indent == 0 ? "\n" : "")));
#else
GDK_NOTE (EVENTS, g_print (" => %ld%s", retval, (debug_indent == 0 ? "\n" : "")));
#endif
return retval;
}
......@@ -2151,7 +2154,7 @@ gdk_event_translate (MSG *msg,
/* XXX Handle WM_QUIT here ? */
if (msg->message == WM_QUIT)
{
GDK_NOTE (EVENTS, g_print (" %d", msg->wParam));
GDK_NOTE (EVENTS, g_print (" %d", (int) msg->wParam));
exit (msg->wParam);
}
else if (msg->message == WM_MOVE ||
......@@ -2265,9 +2268,9 @@ gdk_event_translate (MSG *msg,
_gdk_input_codepage = atoi (buf);
_gdk_keymap_serial++;
GDK_NOTE (EVENTS,
g_print (" cs:%lu hkl:%lx%s cp:%d",
g_print (" cs:%lu hkl:%p%s cp:%d",
(gulong) msg->wParam,
msg->lParam, _gdk_input_locale_is_ime ? " (IME)" : "",
(gpointer) msg->lParam, _gdk_input_locale_is_ime ? " (IME)" : "",
_gdk_input_codepage));
break;
......@@ -2276,7 +2279,7 @@ gdk_event_translate (MSG *msg,
GDK_NOTE (EVENTS,
g_print (" %s ch:%.02x %s",
_gdk_win32_key_to_string (msg->lParam),
msg->wParam,
(int) msg->wParam,
decode_key_lparam (msg->lParam)));
/* If posted without us having keyboard focus, ignore */
......@@ -2301,7 +2304,7 @@ gdk_event_translate (MSG *msg,
GDK_NOTE (EVENTS,
g_print (" %s ch:%.02x %s",
_gdk_win32_key_to_string (msg->lParam),
msg->wParam,
(int) msg->wParam,
decode_key_lparam (msg->lParam)));
keyup_or_down:
......@@ -2408,7 +2411,7 @@ gdk_event_translate (MSG *msg,
* WM_IME_CHAR might work on NT4 or Win9x with ActiveIMM, but
* use WM_IME_COMPOSITION there, too, to simplify the code.
*/
GDK_NOTE (EVENTS, g_print (" %#lx", msg->lParam));
GDK_NOTE (EVENTS, g_print (" %#lx", (long) msg->lParam));
if (!(msg->lParam & GCS_RESULTSTR))
break;
......@@ -2590,8 +2593,8 @@ gdk_event_translate (MSG *msg,
case WM_MOUSEMOVE:
GDK_NOTE (EVENTS,
g_print (" %#x (%d,%d)",
msg->wParam,
g_print (" %p (%d,%d)",
(gpointer) msg->wParam,
GET_X_LPARAM (msg->lParam), GET_Y_LPARAM (msg->lParam)));
/* If we haven't moved, don't create any GDK event. Windows
......@@ -2877,7 +2880,7 @@ gdk_event_translate (MSG *msg,
break;
case WM_SHOWWINDOW:
GDK_NOTE (EVENTS, g_print (" %d", msg->wParam));
GDK_NOTE (EVENTS, g_print (" %d", (int) msg->wParam));
if (!(((GdkWindowObject *) window)->event_mask & GDK_STRUCTURE_MASK))
break;
......@@ -3410,7 +3413,7 @@ gdk_event_translate (MSG *msg,
event->selection.selection = GDK_SELECTION_CLIPBOARD;
event->selection.target = target;
event->selection.property = _gdk_selection_property;
event->selection.requestor = (guint32) msg->hwnd;
event->selection.requestor = msg->hwnd;
event->selection.time = msg->time;
fixup_event (event);
......@@ -3476,18 +3479,18 @@ gdk_event_translate (MSG *msg,
* constants as case labels.
*/
case WT_PACKET:
GDK_NOTE (EVENTS, g_print (" %d %#lx",
msg->wParam, msg->lParam));
GDK_NOTE (EVENTS, g_print (" %d %p",
(int) msg->wParam, (gpointer) msg->lParam));
goto wintab;
case WT_CSRCHANGE:
GDK_NOTE (EVENTS, g_print (" %d %#lx",
msg->wParam, msg->lParam));
GDK_NOTE (EVENTS, g_print (" %d %p",
(int) msg->wParam, (gpointer) msg->lParam));
goto wintab;
case WT_PROXIMITY:
GDK_NOTE (EVENTS, g_print (" %#x %d %d",
msg->wParam,
GDK_NOTE (EVENTS, g_print (" %p %d %d",
(gpointer) msg->wParam,
LOWORD (msg->lParam),
HIWORD (msg->lParam)));
/* Fall through */
......
......@@ -897,7 +897,7 @@ gdk_font_load_logfont (LOGFONT *lfp)
singlefont->charset = GetTextCharsetInfo (_gdk_display_hdc, &singlefont->fs, 0);
GetTextFace (_gdk_display_hdc, sizeof (face), face);
SelectObject (_gdk_display_hdc, oldfont);
if (TranslateCharsetInfo ((DWORD *) singlefont->charset, &csi,
if (TranslateCharsetInfo ((DWORD *) (gintptr) singlefont->charset, &csi,
TCI_SRCCHARSET)
&& singlefont->charset != MAC_CHARSET)
singlefont->codepage = csi.ciACP;
......@@ -1400,8 +1400,9 @@ gdk_font_id (const GdkFont *font)
private = (const GdkFontPrivateWin32 *) font;
/* FIXME: What to do on Win64? */
if (font->type == GDK_FONT_FONT)
return (gint) ((GdkWin32SingleFont *) private->fonts->data)->hfont;
return (gint) (gintptr) ((GdkWin32SingleFont *) private->fonts->data)->hfont;
else
return 0;
}
......@@ -1519,7 +1520,7 @@ _gdk_wchar_text_handle (GdkFont *font,
if (!list)
singlefont = NULL;
GDK_NOTE (MISC, g_print ("%d:%d:%d:%p ",
GDK_NOTE (MISC, g_print ("%" G_GSIZE_FORMAT ":%" G_GSIZE_FORMAT ":%d:%p ",
start-wcstr, wcp-wcstr, block,
(singlefont ? singlefont->hfont : 0)));
......
......@@ -504,7 +504,7 @@ gdk_keymap_get_direction (GdkKeymap *keymap)
{
update_keymap ();
switch (PRIMARYLANGID (LOWORD ((DWORD) _gdk_input_locale)))
switch (PRIMARYLANGID (LOWORD ((DWORD) (gintptr) _gdk_input_locale)))
{
case LANG_HEBREW:
case LANG_ARABIC:
......
......@@ -368,7 +368,7 @@ _gdk_win32_print_dc (HDC hdc)
_gdk_win32_psstyle_to_string (extlogpen.elpPenStyle),
_gdk_win32_psendcap_to_string (extlogpen.elpPenStyle),
_gdk_win32_psjoin_to_string (extlogpen.elpPenStyle),
extlogpen.elpWidth,
(int) extlogpen.elpWidth,
_gdk_win32_lbstyle_to_string (extlogpen.elpBrushStyle));
g_print ("rop2: %s textcolor=%06lx\n",
_gdk_win32_rop2_to_string (GetROP2 (hdc)),
......
......@@ -34,12 +34,16 @@ 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)
HANDLE *b)
{
return (*a == *b);
}
......
......@@ -2027,9 +2027,9 @@ gdk_window_set_transient_for (GdkWindow *window,
* USENET. Search on Google.
*/
SetLastError (0);
if (SetWindowLong (window_id, GWL_HWNDPARENT, (long) parent_id) == 0 &&
if (SetWindowLongPtr (window_id, GWLP_HWNDPARENT, (LONG_PTR) parent_id) == 0 &&
GetLastError () != 0)
WIN32_API_FAILED ("SetWindowLong");
WIN32_API_FAILED ("SetWindowLongPtr");
}
void
......@@ -3602,8 +3602,7 @@ gdk_window_set_skip_taskbar_hint (GdkWindow *window,
owner = gdk_window_new_internal (NULL, &wa, 0, TRUE);
}
SetWindowLong (GDK_WINDOW_HWND (window), GWL_HWNDPARENT,
(long) GDK_WINDOW_HWND (owner));
SetWindowLongPtr (GDK_WINDOW_HWND (window), GWLP_HWNDPARENT, (LONG_PTR) GDK_WINDOW_HWND (owner));
#if 0 /* Should we also turn off the minimize and maximize buttons? */
SetWindowLong (GDK_WINDOW_HWND (window), GWL_STYLE,
......@@ -3616,7 +3615,7 @@ gdk_window_set_skip_taskbar_hint (GdkWindow *window,
}
else
{
SetWindowLong (GDK_WINDOW_HWND (window), GWL_HWNDPARENT, 0);
SetWindowLongPtr (GDK_WINDOW_HWND (window), GWLP_HWNDPARENT, 0);
}
}
......
static const struct { const gchar *name; const gchar *builtin; gint type; guchar width; guchar height; guchar hotx; guchar hoty; guchar *data; } cursors[] = {
static const struct { const gchar *name; const gchar *builtin; gint type; guchar width; guchar height; guchar hotx; guchar hoty; gchar *data; } cursors[] = {
{ "X_cursor", NULL, 0, 16, 16, 7, 7,
"\125\000\000\125\152\100\001\251\152\220\006\251\152\244\032\251"
"\032\251\152\244\006\252\252\220\001\252\252\100\000\152\251\000"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment