Commit 7c12edeb authored by Tor Lillqvist's avatar Tor Lillqvist Committed by Tor Lillqvist

New debugging function. As GetKeyNameText() returns a localized key name

2005-03-15  Tor Lillqvist  <tml@novell.com>

	* gdk/win32/gdkmain-win32.c (_gdk_win32_key_to_string): New
	debugging function. As GetKeyNameText() returns a localized key
	name we need to convert it to UTF-8.

	* gdk/win32/gdkprivate-win32.h: Declare it.

	* gdk/win32/gdkevents-win32.c: Use it.

	* gdk/win32/gdkwindow-win32.c (gdk_window_new_internal): Fix
	handling of children of foreign windows. They should be child
	windows from Windows's perspective, even if they are toplevel GDK
	windows.
parent eef20f2c
2005-03-15 Tor Lillqvist <tml@novell.com>
* gdk/win32/gdkmain-win32.c (_gdk_win32_key_to_string): New
debugging function. As GetKeyNameText() returns a localized key
name we need to convert it to UTF-8.
* gdk/win32/gdkprivate-win32.h: Declare it.
* gdk/win32/gdkevents-win32.c: Use it.
* gdk/win32/gdkwindow-win32.c (gdk_window_new_internal): Fix
handling of children of foreign windows. They should be child
windows from Windows's perspective, even if they are toplevel GDK
windows.
2005-03-13 Ivan, Wong Yat Cheung <email@ivanwong.info>
* gdk/win32/gdkgeometry-win32.c (gdk_window_scroll): A further fix
......
2005-03-15 Tor Lillqvist <tml@novell.com>
* gdk/win32/gdkmain-win32.c (_gdk_win32_key_to_string): New
debugging function. As GetKeyNameText() returns a localized key
name we need to convert it to UTF-8.
* gdk/win32/gdkprivate-win32.h: Declare it.
* gdk/win32/gdkevents-win32.c: Use it.
* gdk/win32/gdkwindow-win32.c (gdk_window_new_internal): Fix
handling of children of foreign windows. They should be child
windows from Windows's perspective, even if they are toplevel GDK
windows.
2005-03-13 Ivan, Wong Yat Cheung <email@ivanwong.info>
* gdk/win32/gdkgeometry-win32.c (gdk_window_scroll): A further fix
......
2005-03-15 Tor Lillqvist <tml@novell.com>
* gdk/win32/gdkmain-win32.c (_gdk_win32_key_to_string): New
debugging function. As GetKeyNameText() returns a localized key
name we need to convert it to UTF-8.
* gdk/win32/gdkprivate-win32.h: Declare it.
* gdk/win32/gdkevents-win32.c: Use it.
* gdk/win32/gdkwindow-win32.c (gdk_window_new_internal): Fix
handling of children of foreign windows. They should be child
windows from Windows's perspective, even if they are toplevel GDK
windows.
2005-03-13 Ivan, Wong Yat Cheung <email@ivanwong.info>
* gdk/win32/gdkgeometry-win32.c (gdk_window_scroll): A further fix
......
......@@ -2210,7 +2210,7 @@ gdk_event_translate (GdkDisplay *display,
* removed it. Repost the same message to our queue so that
* we will get it later when we are prepared.
*/
GDK_NOTE (MISC, g_print (" (posted)"));
GDK_NOTE (EVENTS, g_print (" (posted)"));
PostMessage (msg->hwnd, msg->message,
msg->wParam, msg->lParam);
......@@ -2375,9 +2375,7 @@ gdk_event_translate (GdkDisplay *display,
case WM_SYSKEYDOWN:
GDK_NOTE (EVENTS,
g_print (" %s ch:%.02x %s",
(GetKeyNameText (msg->lParam, buf,
sizeof (buf)) > 0 ?
buf : ""),
_gdk_win32_key_to_string (msg->lParam),
msg->wParam,
decode_key_lparam (msg->lParam)));
......@@ -2403,9 +2401,7 @@ gdk_event_translate (GdkDisplay *display,
case WM_KEYDOWN:
GDK_NOTE (EVENTS,
g_print (" %s ch:%.02x %s",
(GetKeyNameText (msg->lParam, buf,
sizeof (buf)) > 0 ?
buf : ""),
_gdk_win32_key_to_string (msg->lParam),
msg->wParam,
decode_key_lparam (msg->lParam)));
......
......@@ -904,6 +904,26 @@ _gdk_win32_message_to_string (UINT msg)
return NULL;
}
gchar *
_gdk_win32_key_to_string (LONG lParam)
{
char buf[100];
gchar *keyname_utf8;
if (GetKeyNameText (lParam, buf, sizeof (buf)) &&
(keyname_utf8 = g_locale_to_utf8 (buf, -1, NULL, NULL, NULL)) != NULL)
{
gchar *retval = static_printf ("%s", keyname_utf8);
g_free (keyname_utf8);
return retval;
}
return static_printf ("unk-%#lx", lParam);
}
gchar *
_gdk_win32_rect_to_string (const RECT *rect)
{
......
......@@ -403,6 +403,7 @@ gchar *_gdk_win32_psstyle_to_string (DWORD pen_style);
gchar *_gdk_win32_psendcap_to_string (DWORD pen_style);
gchar *_gdk_win32_psjoin_to_string (DWORD pen_style);
gchar *_gdk_win32_message_to_string (UINT msg);
gchar *_gdk_win32_key_to_string (LONG lParam);
gchar *_gdk_win32_rect_to_string (const RECT *rect);
gchar *_gdk_win32_gdkrectangle_to_string (const GdkRectangle *rect);
......
......@@ -341,7 +341,7 @@ _gdk_windowing_window_init (void)
_gdk_window_init_position (GDK_WINDOW (private));
gdk_win32_handle_table_insert (&_gdk_root_window, _gdk_parent_root);
gdk_win32_handle_table_insert ((HANDLE *) &_gdk_root_window, _gdk_parent_root);
GDK_NOTE (MISC, g_print ("_gdk_parent_root=%p\n", GDK_WINDOW_HWND (_gdk_parent_root)));
}
......@@ -488,6 +488,7 @@ gdk_window_new_internal (GdkWindow *parent,
DWORD dwStyle = 0, dwExStyle;
RECT rect;
GdkWindow *window;
GdkWindow *orig_parent;
GdkWindowObject *private;
GdkWindowImplWin32 *impl;
GdkDrawableImplWin32 *draw_impl;
......@@ -510,6 +511,8 @@ gdk_window_new_internal (GdkWindow *parent,
g_return_val_if_fail (GDK_IS_WINDOW (parent), NULL);
orig_parent = parent;
GDK_NOTE (MISC,
g_print ("gdk_window_new: %s\n",
(attributes->window_type == GDK_WINDOW_TOPLEVEL ? "TOPLEVEL" :
......@@ -605,30 +608,38 @@ gdk_window_new_internal (GdkWindow *parent,
switch (private->window_type)
{
case GDK_WINDOW_TOPLEVEL:
dwStyle = WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN;
hparent = _gdk_root_window;
offset_x = _gdk_offset_x;
offset_y = _gdk_offset_y;
case GDK_WINDOW_DIALOG:
if (GDK_WINDOW_TYPE (parent) != GDK_WINDOW_ROOT)
{
g_warning (G_STRLOC ": Toplevel windows must be created as children\n"
"of a window of type GDK_WINDOW_ROOT or GDK_WINDOW_FOREIGN");
hparent = _gdk_root_window;
}
/* Children of foreign windows aren't toplevel windows */
if (GDK_WINDOW_TYPE (orig_parent) == GDK_WINDOW_FOREIGN)
{
dwStyle = WS_CHILDWINDOW | WS_CLIPCHILDREN;
}
else
{
if (private->window_type == GDK_WINDOW_TOPLEVEL)
dwStyle = WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN;
else
dwStyle = WS_OVERLAPPED | WS_MINIMIZEBOX | WS_SYSMENU | WS_CAPTION | WS_THICKFRAME | WS_CLIPCHILDREN;
offset_x = _gdk_offset_x;
offset_y = _gdk_offset_y;
}
break;
case GDK_WINDOW_CHILD:
dwStyle = WS_CHILDWINDOW | WS_CLIPCHILDREN | WS_CLIPSIBLINGS;
break;
case GDK_WINDOW_DIALOG:
dwStyle = WS_OVERLAPPED | WS_MINIMIZEBOX | WS_SYSMENU | WS_CAPTION | WS_THICKFRAME | WS_CLIPCHILDREN;
#if 0
dwExStyle |= WS_EX_TOPMOST; /* //HB: want this? */
#endif
hparent = _gdk_root_window;
offset_x = _gdk_offset_x;
offset_y = _gdk_offset_y;
break;
case GDK_WINDOW_TEMP:
dwStyle = WS_CLIPCHILDREN | WS_CLIPSIBLINGS;
/* a temp window is not necessarily a top level window */
dwStyle |= (_gdk_parent_root == parent ? WS_POPUP : WS_CHILDWINDOW);
/* A temp window is not necessarily a top level window */
dwStyle = (_gdk_parent_root == parent ? WS_POPUP : WS_CHILDWINDOW);
dwStyle |= WS_CLIPCHILDREN | WS_CLIPSIBLINGS;
dwExStyle |= WS_EX_TOOLWINDOW;
offset_x = _gdk_offset_x;
offset_y = _gdk_offset_y;
......@@ -666,7 +677,7 @@ gdk_window_new_internal (GdkWindow *parent,
else
title = get_default_title ();
if (!title || !*title)
title = "GDK client window";
title = "";
private->event_mask = GDK_STRUCTURE_MASK | attributes->event_mask;
......@@ -2833,8 +2844,6 @@ gboolean
gdk_window_set_static_gravities (GdkWindow *window,
gboolean use_static)
{
GdkWindowObject *private = (GdkWindowObject *)window;
g_return_val_if_fail (window != NULL, FALSE);
g_return_val_if_fail (GDK_IS_WINDOW (window), FALSE);
......
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