gdk/win32/gdkevents-win32.c Use wide-char API for message and window

2006-09-04  Tor Lillqvist  <tml@novell.com>

	* gdk/win32/gdkevents-win32.c
	* gdk/win32/gdkwindow-win32.c: Use wide-char API for message and
	window handling (PeekMessage, PostMessage, SendMessage,
	DispatchMessage, DefWindowProc, RegisterClassEx,
	CreateWindowEx). (#321597)
This commit is contained in:
Tor Lillqvist 2006-09-03 22:50:00 +00:00 committed by Tor Lillqvist
parent c5fb65575f
commit 25b98a5935
3 changed files with 69 additions and 62 deletions

View File

@ -1,3 +1,11 @@
2006-09-04 Tor Lillqvist <tml@novell.com>
* gdk/win32/gdkevents-win32.c
* gdk/win32/gdkwindow-win32.c: Use wide-char API for message and
window handling (PeekMessage, PostMessage, SendMessage,
DispatchMessage, DefWindowProc, RegisterClassEx,
CreateWindowEx). (#321597)
2006-09-03 Kristian Rietveld <kris@imendio.com>
* gtk/gtkfilechooserdefault.c (save_entry_get_info_cb),

View File

@ -262,15 +262,15 @@ inner_window_procedure (HWND hwnd,
* the window procedure.
*/
if (modal_win32_dialog)
PostMessage (modal_win32_dialog, got_gdk_events_message,
(WPARAM) 1, 0);
PostMessageW (modal_win32_dialog, got_gdk_events_message,
(WPARAM) 1, 0);
return ret_val;
}
else
{
/* Otherwise call DefWindowProc(). */
GDK_NOTE (EVENTS, g_print (" DefWindowProc"));
return DefWindowProc (hwnd, message, wparam, lparam);
/* Otherwise call DefWindowProcW(). */
GDK_NOTE (EVENTS, g_print (" DefWindowProcW"));
return DefWindowProcW (hwnd, message, wparam, lparam);
}
}
@ -417,7 +417,7 @@ gdk_events_pending (void)
MSG msg;
return (_gdk_event_queue_find_first (_gdk_display) ||
(modal_win32_dialog == NULL &&
PeekMessage (&msg, NULL, 0, 0, PM_NOREMOVE)));
PeekMessageW (&msg, NULL, 0, 0, PM_NOREMOVE)));
}
GdkEvent*
@ -430,7 +430,7 @@ gdk_event_get_graphics_expose (GdkWindow *window)
GDK_NOTE (EVENTS, g_print ("gdk_event_get_graphics_expose\n"));
if (PeekMessage (&msg, GDK_WINDOW_HWND (window), WM_PAINT, WM_PAINT, PM_REMOVE))
if (PeekMessageW (&msg, GDK_WINDOW_HWND (window), WM_PAINT, WM_PAINT, PM_REMOVE))
{
handle_wm_paint (&msg, window, TRUE, &event);
if (event != NULL)
@ -2166,7 +2166,7 @@ gdk_event_translate (MSG *msg,
/* If result is GDK_FILTER_CONTINUE, we continue as if nothing
* happened. If it is GDK_FILTER_REMOVE or GDK_FILTER_TRANSLATE,
* we return TRUE, and DefWindowProc() will not be called.
* we return TRUE, and DefWindowProcW() will not be called.
*/
if (result == GDK_FILTER_REMOVE || result == GDK_FILTER_TRANSLATE)
return TRUE;
@ -2194,12 +2194,11 @@ gdk_event_translate (MSG *msg,
*/
GDK_NOTE (EVENTS, g_print (" (posted)"));
PostMessage (msg->hwnd, msg->message,
msg->wParam, msg->lParam);
PostMessageW (msg->hwnd, msg->message, msg->wParam, msg->lParam);
}
else if (msg->message == WM_CREATE)
{
window = (UNALIGNED GdkWindow*) (((LPCREATESTRUCT) msg->lParam)->lpCreateParams);
window = (UNALIGNED GdkWindow*) (((LPCREATESTRUCTW) msg->lParam)->lpCreateParams);
GDK_WINDOW_HWND (window) = msg->hwnd;
}
else
@ -2453,7 +2452,7 @@ gdk_event_translate (MSG *msg,
case WM_SYSCHAR:
if (msg->wParam != VK_SPACE)
{
/* To prevent beeps, don't let DefWindowProc() be called */
/* To prevent beeps, don't let DefWindowProcW() be called */
return_val = TRUE;
goto done;
}
@ -3310,7 +3309,7 @@ gdk_event_translate (MSG *msg,
if (impl->hint_flags & (GDK_HINT_MIN_SIZE | GDK_HINT_MAX_SIZE))
{
/* Don't call DefWindowProc() */
/* Don't call DefWindowProcW() */
GDK_NOTE (EVENTS, g_print (" (handled, mintrack:%ldx%ld maxtrack:%ldx%ld "
"maxpos:%+ld%+ld maxsize:%ldx%ld)",
mmi->ptMinTrackSize.x, mmi->ptMinTrackSize.y,
@ -3505,10 +3504,10 @@ _gdk_events_queue (GdkDisplay *display)
return;
while (!_gdk_event_queue_find_first (display) &&
PeekMessage (&msg, NULL, 0, 0, PM_REMOVE))
PeekMessageW (&msg, NULL, 0, 0, PM_REMOVE))
{
TranslateMessage (&msg);
DispatchMessage (&msg);
DispatchMessageW (&msg);
}
}
@ -3525,7 +3524,7 @@ gdk_event_prepare (GSource *source,
retval = (_gdk_event_queue_find_first (_gdk_display) != NULL ||
(modal_win32_dialog == NULL &&
PeekMessage (&msg, NULL, 0, 0, PM_NOREMOVE)));
PeekMessageW (&msg, NULL, 0, 0, PM_NOREMOVE)));
GDK_THREADS_LEAVE ();
@ -3543,7 +3542,7 @@ gdk_event_check (GSource *source)
if (event_poll_fd.revents & G_IO_IN)
retval = (_gdk_event_queue_find_first (_gdk_display) != NULL ||
(modal_win32_dialog == NULL &&
PeekMessage (&msg, NULL, 0, 0, PM_NOREMOVE)));
PeekMessageW (&msg, NULL, 0, 0, PM_NOREMOVE)));
else
retval = FALSE;
@ -3600,9 +3599,9 @@ gdk_event_send_client_message_for_display (GdkDisplay *display,
{
check_for_too_much_data (event);
return PostMessage ((HWND) winid, client_message,
(WPARAM) event->client.message_type,
event->client.data.l[0]);
return PostMessageW ((HWND) winid, client_message,
(WPARAM) event->client.message_type,
event->client.data.l[0]);
}
void
@ -3611,9 +3610,9 @@ gdk_screen_broadcast_client_message (GdkScreen *screen,
{
check_for_too_much_data (event);
PostMessage (HWND_BROADCAST, client_message,
PostMessageW (HWND_BROADCAST, client_message,
(WPARAM) event->client.message_type,
event->client.data.l[0]);
event->client.data.l[0]);
}
void
@ -3623,10 +3622,10 @@ gdk_flush (void)
MSG msg;
/* Process all messages currently available */
while (PeekMessage (&msg, NULL, 0, 0, PM_REMOVE))
while (PeekMessageW (&msg, NULL, 0, 0, PM_REMOVE))
{
TranslateMessage (&msg);
DispatchMessage (&msg);
DispatchMessageW (&msg);
}
#endif
@ -3641,8 +3640,8 @@ gdk_display_sync (GdkDisplay * display)
g_return_if_fail (display == _gdk_display);
/* Process all messages currently available */
while (PeekMessage (&msg, NULL, 0, 0, PM_REMOVE))
DispatchMessage (&msg);
while (PeekMessageW (&msg, NULL, 0, 0, PM_REMOVE))
DispatchMessageW (&msg);
}
void

View File

@ -368,7 +368,7 @@ RegisterGdkClass (GdkWindowType wtype)
static ATOM klassCHILD = 0;
static ATOM klassTEMP = 0;
static HICON hAppIcon = NULL;
static WNDCLASSEX wcl;
static WNDCLASSEXW wcl;
ATOM klass = 0;
wcl.cbSize = sizeof (WNDCLASSEX);
@ -418,10 +418,10 @@ RegisterGdkClass (GdkWindowType wtype)
case GDK_WINDOW_TOPLEVEL:
if (0 == klassTOPLEVEL)
{
wcl.lpszClassName = "gdkWindowToplevel";
wcl.lpszClassName = L"gdkWindowToplevel";
ONCE_PER_CLASS ();
klassTOPLEVEL = RegisterClassEx (&wcl);
klassTOPLEVEL = RegisterClassExW (&wcl);
}
klass = klassTOPLEVEL;
break;
@ -429,11 +429,11 @@ RegisterGdkClass (GdkWindowType wtype)
case GDK_WINDOW_CHILD:
if (0 == klassCHILD)
{
wcl.lpszClassName = "gdkWindowChild";
wcl.lpszClassName = L"gdkWindowChild";
wcl.style |= CS_PARENTDC; /* MSDN: ... enhances system performance. */
ONCE_PER_CLASS ();
klassCHILD = RegisterClassEx (&wcl);
klassCHILD = RegisterClassExW (&wcl);
}
klass = klassCHILD;
break;
@ -441,10 +441,10 @@ RegisterGdkClass (GdkWindowType wtype)
case GDK_WINDOW_DIALOG:
if (0 == klassDIALOG)
{
wcl.lpszClassName = "gdkWindowDialog";
wcl.lpszClassName = L"gdkWindowDialog";
wcl.style |= CS_SAVEBITS;
ONCE_PER_CLASS ();
klassDIALOG = RegisterClassEx (&wcl);
klassDIALOG = RegisterClassExW (&wcl);
}
klass = klassDIALOG;
break;
@ -452,10 +452,10 @@ RegisterGdkClass (GdkWindowType wtype)
case GDK_WINDOW_TEMP:
if (0 == klassTEMP)
{
wcl.lpszClassName = "gdkWindowTemp";
wcl.lpszClassName = L"gdkWindowTemp";
wcl.style |= CS_SAVEBITS;
ONCE_PER_CLASS ();
klassTEMP = RegisterClassEx (&wcl);
klassTEMP = RegisterClassExW (&wcl);
}
klass = klassTEMP;
break;
@ -467,7 +467,7 @@ RegisterGdkClass (GdkWindowType wtype)
if (klass == 0)
{
WIN32_API_FAILED ("RegisterClassEx");
WIN32_API_FAILED ("RegisterClassExW");
g_error ("That is a fatal error");
}
return klass;
@ -491,7 +491,7 @@ gdk_window_new_internal (GdkWindow *parent,
GdkDrawableImplWin32 *draw_impl;
GdkVisual *visual;
const gchar *title;
char *mbtitle;
wchar_t *wtitle;
gint window_width, window_height;
gint offset_x = 0, offset_y = 0;
@ -681,20 +681,20 @@ gdk_window_new_internal (GdkWindow *parent,
klass = RegisterGdkClass (private->window_type);
mbtitle = g_locale_from_utf8 (title, -1, NULL, NULL, NULL);
wtitle = g_utf8_to_utf16 (title, -1, NULL, NULL, NULL);
hwndNew = CreateWindowEx (dwExStyle,
MAKEINTRESOURCE (klass),
mbtitle,
dwStyle,
((attributes_mask & GDK_WA_X) ?
impl->position_info.x - offset_x : CW_USEDEFAULT),
impl->position_info.y - offset_y,
window_width, window_height,
hparent,
NULL,
_gdk_app_hmodule,
window);
hwndNew = CreateWindowExW (dwExStyle,
MAKEINTRESOURCEW (klass),
wtitle,
dwStyle,
((attributes_mask & GDK_WA_X) ?
impl->position_info.x - offset_x : CW_USEDEFAULT),
impl->position_info.y - offset_y,
window_width, window_height,
hparent,
NULL,
_gdk_app_hmodule,
window);
if (GDK_WINDOW_HWND (window) != hwndNew)
{
g_warning ("gdk_window_new: gdk_event_translate::WM_CREATE (%p, %p) HWND mismatch.",
@ -721,7 +721,7 @@ gdk_window_new_internal (GdkWindow *parent,
gdk_win32_handle_table_insert (&GDK_WINDOW_HWND (window), window);
GDK_NOTE (MISC, g_print ("... \"%s\" %dx%d@%+d%+d %p = %p\n",
mbtitle,
title,
window_width, window_height,
((attributes_mask & GDK_WA_X) ?
impl->position_info.x - offset_x: CW_USEDEFAULT),
@ -729,11 +729,11 @@ gdk_window_new_internal (GdkWindow *parent,
hparent,
GDK_WINDOW_HWND (window)));
g_free (mbtitle);
g_free (wtitle);
if (draw_impl->handle == NULL)
{
WIN32_API_FAILED ("CreateWindowEx");
WIN32_API_FAILED ("CreateWindowExW");
g_object_unref (window);
return NULL;
}
@ -1440,7 +1440,7 @@ _gdk_windowing_window_clear_area (GdkWindow *window,
width, height, x, y));
hdc = GetDC (GDK_WINDOW_HWND (window));
IntersectClipRect (hdc, x, y, x + width + 1, y + height + 1);
SendMessage (GDK_WINDOW_HWND (window), WM_ERASEBKGND, (WPARAM) hdc, 0);
SendMessageW (GDK_WINDOW_HWND (window), WM_ERASEBKGND, (WPARAM) hdc, 0);
GDI_CALL (ReleaseDC, (GDK_WINDOW_HWND (window), hdc));
}
}
@ -2509,10 +2509,10 @@ gdk_window_set_icon_list (GdkWindow *window,
small_hicon = _gdk_win32_pixbuf_to_hicon (small_pixbuf);
/* Set the icons */
SendMessage (GDK_WINDOW_HWND (window), WM_SETICON, ICON_BIG,
(LPARAM)big_hicon);
SendMessage (GDK_WINDOW_HWND (window), WM_SETICON, ICON_SMALL,
(LPARAM)small_hicon);
SendMessageW (GDK_WINDOW_HWND (window), WM_SETICON, ICON_BIG,
(LPARAM)big_hicon);
SendMessageW (GDK_WINDOW_HWND (window), WM_SETICON, ICON_SMALL,
(LPARAM)small_hicon);
/* Store the icons, destroying any previous icons */
if (impl->hicon_big)
@ -2941,8 +2941,8 @@ gdk_window_begin_resize_drag (GdkWindow *window,
break;
}
DefWindowProc (GDK_WINDOW_HWND (window), WM_NCLBUTTONDOWN, winedge,
MAKELPARAM (root_x - _gdk_offset_x, root_y - _gdk_offset_y));
DefWindowProcW (GDK_WINDOW_HWND (window), WM_NCLBUTTONDOWN, winedge,
MAKELPARAM (root_x - _gdk_offset_x, root_y - _gdk_offset_y));
}
void
@ -2971,8 +2971,8 @@ gdk_window_begin_move_drag (GdkWindow *window,
*/
gdk_display_pointer_ungrab (_gdk_display, 0);
DefWindowProc (GDK_WINDOW_HWND (window), WM_NCLBUTTONDOWN, HTCAPTION,
MAKELPARAM (root_x - _gdk_offset_x, root_y - _gdk_offset_y));
DefWindowProcW (GDK_WINDOW_HWND (window), WM_NCLBUTTONDOWN, HTCAPTION,
MAKELPARAM (root_x - _gdk_offset_x, root_y - _gdk_offset_y));
}