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

Handle also WM_SYSCHAR, and other changes to get handling of Alt+nnn or

2000-07-04  Tor Lillqvist  <tml@iki.fi>

* gdk/win32/gdkevents-win32.c (gdk_event_translate): Handle also
WM_SYSCHAR, and other changes to get handling of Alt+nnn or
Alt+0nnn on the numpad (used to enter characters by numeric code
from current DOS or ANSI codepage) working correctly, as in other
Windows apps.

* gdk/win32/gdkcursor-win32.c (gdk_cursor_new_from_pixmap): Use
same argument validity tests as in X11 version.
(_gdk_cursor_destroy): Use DestroyCursor, not DestroyIcon.

* gdk/win32/gdkwin32.h: Add also WM_MOUSEWHEEL and CopyCursor
definitions in case missing from headers.

* gdk/win32/gdkwindow-win32.c (gdk_win32_window_destroy): ALso
destroy the window-specific cursor.
(RegisterGdkClass): Use the global gdk_ProgInstance instead of
calling GetModuleHandle(NULL).
(gdk_window_set_cursor): Reworked to always copy the passed cursor
with CopyCursor before setting it. It is OK for the caller to
destroy the GdkCursor (and thus also the Windows cursor) after
calling this function. Also, destroy any previous cursor for this
window.

2000-05-29  Tor Lillqvist  <tml@iki.fi>

* gdk/win32/gdkevents-win32.c (gdk_WindowProc): The local "event"
variable should be of type GdkEventPrivate.
parent ceac1c16
2000-07-04 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkevents-win32.c (gdk_event_translate): Handle also
WM_SYSCHAR, and other changes to get handling of Alt+nnn or
Alt+0nnn on the numpad (used to enter characters by numeric code
from current DOS or ANSI codepage) working correctly, as in other
Windows apps.
* gdk/win32/gdkcursor-win32.c (gdk_cursor_new_from_pixmap): Use
same argument validity tests as in X11 version.
(_gdk_cursor_destroy): Use DestroyCursor, not DestroyIcon.
* gdk/win32/gdkwin32.h: Add also WM_MOUSEWHEEL and CopyCursor
definitions in case missing from headers.
* gdk/win32/gdkwindow-win32.c (gdk_win32_window_destroy): ALso
destroy the window-specific cursor.
(RegisterGdkClass): Use the global gdk_ProgInstance instead of
calling GetModuleHandle(NULL).
(gdk_window_set_cursor): Reworked to always copy the passed cursor
with CopyCursor before setting it. It is OK for the caller to
destroy the GdkCursor (and thus also the Windows cursor) after
calling this function. Also, destroy any previous cursor for this
window.
Mon Jul 3 17:54:49 2000 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkfont-x11.c (gdk_font_charset_for_locale):
......@@ -898,6 +923,11 @@ Mon May 29 14:31:27 2000 Owen Taylor <otaylor@redhat.com>
* gdk/gdkfont.h gdk/x11/gdkfont-x11.c (gdk_font_from_description):
Add function to load a GdkFont from a PangoFontDescription.
2000-05-29 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkevents-win32.c (gdk_WindowProc): The local "event"
variable should be of type GdkEventPrivate.
Fri May 26 17:16:40 2000 Owen Taylor <otaylor@redhat.com>
* gtk/frame.[ch] gtkaspectframe.c: Make frame widgets able
......
2000-07-04 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkevents-win32.c (gdk_event_translate): Handle also
WM_SYSCHAR, and other changes to get handling of Alt+nnn or
Alt+0nnn on the numpad (used to enter characters by numeric code
from current DOS or ANSI codepage) working correctly, as in other
Windows apps.
* gdk/win32/gdkcursor-win32.c (gdk_cursor_new_from_pixmap): Use
same argument validity tests as in X11 version.
(_gdk_cursor_destroy): Use DestroyCursor, not DestroyIcon.
* gdk/win32/gdkwin32.h: Add also WM_MOUSEWHEEL and CopyCursor
definitions in case missing from headers.
* gdk/win32/gdkwindow-win32.c (gdk_win32_window_destroy): ALso
destroy the window-specific cursor.
(RegisterGdkClass): Use the global gdk_ProgInstance instead of
calling GetModuleHandle(NULL).
(gdk_window_set_cursor): Reworked to always copy the passed cursor
with CopyCursor before setting it. It is OK for the caller to
destroy the GdkCursor (and thus also the Windows cursor) after
calling this function. Also, destroy any previous cursor for this
window.
Mon Jul 3 17:54:49 2000 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkfont-x11.c (gdk_font_charset_for_locale):
......@@ -898,6 +923,11 @@ Mon May 29 14:31:27 2000 Owen Taylor <otaylor@redhat.com>
* gdk/gdkfont.h gdk/x11/gdkfont-x11.c (gdk_font_from_description):
Add function to load a GdkFont from a PangoFontDescription.
2000-05-29 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkevents-win32.c (gdk_WindowProc): The local "event"
variable should be of type GdkEventPrivate.
Fri May 26 17:16:40 2000 Owen Taylor <otaylor@redhat.com>
* gtk/frame.[ch] gtkaspectframe.c: Make frame widgets able
......
2000-07-04 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkevents-win32.c (gdk_event_translate): Handle also
WM_SYSCHAR, and other changes to get handling of Alt+nnn or
Alt+0nnn on the numpad (used to enter characters by numeric code
from current DOS or ANSI codepage) working correctly, as in other
Windows apps.
* gdk/win32/gdkcursor-win32.c (gdk_cursor_new_from_pixmap): Use
same argument validity tests as in X11 version.
(_gdk_cursor_destroy): Use DestroyCursor, not DestroyIcon.
* gdk/win32/gdkwin32.h: Add also WM_MOUSEWHEEL and CopyCursor
definitions in case missing from headers.
* gdk/win32/gdkwindow-win32.c (gdk_win32_window_destroy): ALso
destroy the window-specific cursor.
(RegisterGdkClass): Use the global gdk_ProgInstance instead of
calling GetModuleHandle(NULL).
(gdk_window_set_cursor): Reworked to always copy the passed cursor
with CopyCursor before setting it. It is OK for the caller to
destroy the GdkCursor (and thus also the Windows cursor) after
calling this function. Also, destroy any previous cursor for this
window.
Mon Jul 3 17:54:49 2000 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkfont-x11.c (gdk_font_charset_for_locale):
......@@ -898,6 +923,11 @@ Mon May 29 14:31:27 2000 Owen Taylor <otaylor@redhat.com>
* gdk/gdkfont.h gdk/x11/gdkfont-x11.c (gdk_font_from_description):
Add function to load a GdkFont from a PangoFontDescription.
2000-05-29 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkevents-win32.c (gdk_WindowProc): The local "event"
variable should be of type GdkEventPrivate.
Fri May 26 17:16:40 2000 Owen Taylor <otaylor@redhat.com>
* gtk/frame.[ch] gtkaspectframe.c: Make frame widgets able
......
2000-07-04 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkevents-win32.c (gdk_event_translate): Handle also
WM_SYSCHAR, and other changes to get handling of Alt+nnn or
Alt+0nnn on the numpad (used to enter characters by numeric code
from current DOS or ANSI codepage) working correctly, as in other
Windows apps.
* gdk/win32/gdkcursor-win32.c (gdk_cursor_new_from_pixmap): Use
same argument validity tests as in X11 version.
(_gdk_cursor_destroy): Use DestroyCursor, not DestroyIcon.
* gdk/win32/gdkwin32.h: Add also WM_MOUSEWHEEL and CopyCursor
definitions in case missing from headers.
* gdk/win32/gdkwindow-win32.c (gdk_win32_window_destroy): ALso
destroy the window-specific cursor.
(RegisterGdkClass): Use the global gdk_ProgInstance instead of
calling GetModuleHandle(NULL).
(gdk_window_set_cursor): Reworked to always copy the passed cursor
with CopyCursor before setting it. It is OK for the caller to
destroy the GdkCursor (and thus also the Windows cursor) after
calling this function. Also, destroy any previous cursor for this
window.
Mon Jul 3 17:54:49 2000 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkfont-x11.c (gdk_font_charset_for_locale):
......@@ -898,6 +923,11 @@ Mon May 29 14:31:27 2000 Owen Taylor <otaylor@redhat.com>
* gdk/gdkfont.h gdk/x11/gdkfont-x11.c (gdk_font_from_description):
Add function to load a GdkFont from a PangoFontDescription.
2000-05-29 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkevents-win32.c (gdk_WindowProc): The local "event"
variable should be of type GdkEventPrivate.
Fri May 26 17:16:40 2000 Owen Taylor <otaylor@redhat.com>
* gtk/frame.[ch] gtkaspectframe.c: Make frame widgets able
......
2000-07-04 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkevents-win32.c (gdk_event_translate): Handle also
WM_SYSCHAR, and other changes to get handling of Alt+nnn or
Alt+0nnn on the numpad (used to enter characters by numeric code
from current DOS or ANSI codepage) working correctly, as in other
Windows apps.
* gdk/win32/gdkcursor-win32.c (gdk_cursor_new_from_pixmap): Use
same argument validity tests as in X11 version.
(_gdk_cursor_destroy): Use DestroyCursor, not DestroyIcon.
* gdk/win32/gdkwin32.h: Add also WM_MOUSEWHEEL and CopyCursor
definitions in case missing from headers.
* gdk/win32/gdkwindow-win32.c (gdk_win32_window_destroy): ALso
destroy the window-specific cursor.
(RegisterGdkClass): Use the global gdk_ProgInstance instead of
calling GetModuleHandle(NULL).
(gdk_window_set_cursor): Reworked to always copy the passed cursor
with CopyCursor before setting it. It is OK for the caller to
destroy the GdkCursor (and thus also the Windows cursor) after
calling this function. Also, destroy any previous cursor for this
window.
Mon Jul 3 17:54:49 2000 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkfont-x11.c (gdk_font_charset_for_locale):
......@@ -898,6 +923,11 @@ Mon May 29 14:31:27 2000 Owen Taylor <otaylor@redhat.com>
* gdk/gdkfont.h gdk/x11/gdkfont-x11.c (gdk_font_from_description):
Add function to load a GdkFont from a PangoFontDescription.
2000-05-29 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkevents-win32.c (gdk_WindowProc): The local "event"
variable should be of type GdkEventPrivate.
Fri May 26 17:16:40 2000 Owen Taylor <otaylor@redhat.com>
* gtk/frame.[ch] gtkaspectframe.c: Make frame widgets able
......
2000-07-04 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkevents-win32.c (gdk_event_translate): Handle also
WM_SYSCHAR, and other changes to get handling of Alt+nnn or
Alt+0nnn on the numpad (used to enter characters by numeric code
from current DOS or ANSI codepage) working correctly, as in other
Windows apps.
* gdk/win32/gdkcursor-win32.c (gdk_cursor_new_from_pixmap): Use
same argument validity tests as in X11 version.
(_gdk_cursor_destroy): Use DestroyCursor, not DestroyIcon.
* gdk/win32/gdkwin32.h: Add also WM_MOUSEWHEEL and CopyCursor
definitions in case missing from headers.
* gdk/win32/gdkwindow-win32.c (gdk_win32_window_destroy): ALso
destroy the window-specific cursor.
(RegisterGdkClass): Use the global gdk_ProgInstance instead of
calling GetModuleHandle(NULL).
(gdk_window_set_cursor): Reworked to always copy the passed cursor
with CopyCursor before setting it. It is OK for the caller to
destroy the GdkCursor (and thus also the Windows cursor) after
calling this function. Also, destroy any previous cursor for this
window.
Mon Jul 3 17:54:49 2000 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkfont-x11.c (gdk_font_charset_for_locale):
......@@ -898,6 +923,11 @@ Mon May 29 14:31:27 2000 Owen Taylor <otaylor@redhat.com>
* gdk/gdkfont.h gdk/x11/gdkfont-x11.c (gdk_font_from_description):
Add function to load a GdkFont from a PangoFontDescription.
2000-05-29 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkevents-win32.c (gdk_WindowProc): The local "event"
variable should be of type GdkEventPrivate.
Fri May 26 17:16:40 2000 Owen Taylor <otaylor@redhat.com>
* gtk/frame.[ch] gtkaspectframe.c: Make frame widgets able
......
2000-07-04 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkevents-win32.c (gdk_event_translate): Handle also
WM_SYSCHAR, and other changes to get handling of Alt+nnn or
Alt+0nnn on the numpad (used to enter characters by numeric code
from current DOS or ANSI codepage) working correctly, as in other
Windows apps.
* gdk/win32/gdkcursor-win32.c (gdk_cursor_new_from_pixmap): Use
same argument validity tests as in X11 version.
(_gdk_cursor_destroy): Use DestroyCursor, not DestroyIcon.
* gdk/win32/gdkwin32.h: Add also WM_MOUSEWHEEL and CopyCursor
definitions in case missing from headers.
* gdk/win32/gdkwindow-win32.c (gdk_win32_window_destroy): ALso
destroy the window-specific cursor.
(RegisterGdkClass): Use the global gdk_ProgInstance instead of
calling GetModuleHandle(NULL).
(gdk_window_set_cursor): Reworked to always copy the passed cursor
with CopyCursor before setting it. It is OK for the caller to
destroy the GdkCursor (and thus also the Windows cursor) after
calling this function. Also, destroy any previous cursor for this
window.
Mon Jul 3 17:54:49 2000 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkfont-x11.c (gdk_font_charset_for_locale):
......@@ -898,6 +923,11 @@ Mon May 29 14:31:27 2000 Owen Taylor <otaylor@redhat.com>
* gdk/gdkfont.h gdk/x11/gdkfont-x11.c (gdk_font_from_description):
Add function to load a GdkFont from a PangoFontDescription.
2000-05-29 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkevents-win32.c (gdk_WindowProc): The local "event"
variable should be of type GdkEventPrivate.
Fri May 26 17:16:40 2000 Owen Taylor <otaylor@redhat.com>
* gtk/frame.[ch] gtkaspectframe.c: Make frame widgets able
......
This current (CVS) version of the Win32 backend does *not* even
compile properly. A zipfile with an older snapshot (from before the
merge of the no-flicker branch, and the other recent additions), is
available from http://www.gimp.org/win32/. That should be use by
"production" code until this CVS version is useable. (But note, the
Win32 backend has never been claimed to be "production quality",
although it works OK for the GIMP.)
The Win32 port of GTk+ is a work in progress, and not as stable or
correct as the Unix/X11 version. For more information about the Win32
port, see http://www.gimp.org/tml/gimp/win32/ or
http://www.iki.fi/tml/gimp/win32/ .
The current (CVS) version of the Win32 backend is *not* as stable as it
was before the no-flicker branch was merged. A zipfile with that
version is available from http://www.gimp.org/win32/. That should be
use by "production" code until this CVS version is usable. (But note,
the Win32 backend has never been claimed to be "production quality".)
To build GTk+ on Win32, you need either the Microsoft compiler and
tools, or gcc-2.95 or later. The mingw setup of gcc is preferred, but
you can run gcc also under cygwin-b20.1 or later. Compile in
......
......@@ -156,8 +156,10 @@ gdk_cursor_new_from_pixmap (GdkPixmap *source,
guchar residue;
gint ix, iy;
g_return_val_if_fail (source != NULL, NULL);
g_return_val_if_fail (mask != NULL, NULL);
g_return_val_if_fail (GDK_IS_PIXMAP (source), NULL);
g_return_val_if_fail (GDK_IS_PIXMAP (mask), NULL);
g_return_val_if_fail (fg != NULL, NULL);
g_return_val_if_fail (bg != NULL, NULL);
source_private = (GdkDrawablePrivate *) source;
mask_private = (GdkDrawablePrivate *) mask;
......@@ -269,8 +271,8 @@ _gdk_cursor_destroy (GdkCursor *cursor)
(cursor->type == GDK_CURSOR_IS_PIXMAP) ? private->xcursor : 0));
if (cursor->type == GDK_CURSOR_IS_PIXMAP)
if (!DestroyIcon (private->xcursor))
WIN32_API_FAILED ("DestroyIcon");
if (!DestroyCursor (private->xcursor))
WIN32_API_FAILED ("DestroyCursor");
g_free (private);
}
......@@ -165,7 +165,7 @@ gdk_WindowProc (HWND hWnd,
WPARAM wParam,
LPARAM lParam)
{
GdkEvent event;
GdkEventPrivate event;
GdkEvent *eventp;
MSG msg;
DWORD pos;
......@@ -173,7 +173,8 @@ gdk_WindowProc (HWND hWnd,
gint ret_val;
gboolean ret_val_flag;
GDK_NOTE (EVENTS, g_print ("gdk_WindowProc: %#x %#.03x\n", hWnd, message));
GDK_NOTE (EVENTS, g_print ("gdk_WindowProc: %#x %s\n",
hWnd, gdk_win32_message_name (message)));
msg.hwnd = hWnd;
msg.message = message;
......@@ -184,50 +185,50 @@ gdk_WindowProc (HWND hWnd,
msg.pt.x = LOWORD (pos);
msg.pt.y = HIWORD (pos);
((GdkEventPrivate *)&event)->flags |= GDK_EVENT_PENDING;
if (gdk_event_translate (&event, &msg, &ret_val_flag, &ret_val))
event.flags = GDK_EVENT_PENDING;
if (gdk_event_translate (&event.event, &msg, &ret_val_flag, &ret_val))
{
((GdkEventPrivate *)&event)->flags &= ~GDK_EVENT_PENDING;
event.flags &= ~GDK_EVENT_PENDING;
#if 1
if (event.any.type == GDK_CONFIGURE)
if (event.event.any.type == GDK_CONFIGURE)
{
/* Compress configure events */
GList *list = gdk_queued_events;
while (list != NULL
&& (((GdkEvent *)list->data)->any.type != GDK_CONFIGURE
|| ((GdkEvent *)list->data)->any.window != event.any.window))
|| ((GdkEvent *)list->data)->any.window != event.event.any.window))
list = list->next;
if (list != NULL)
{
GDK_NOTE (EVENTS, g_print ("... compressing an CONFIGURE event\n"));
*((GdkEvent *)list->data) = event;
gdk_drawable_unref (event.any.window);
*((GdkEvent *)list->data) = event.event;
gdk_drawable_unref (event.event.any.window);
/* Wake up WaitMessage */
PostMessage (NULL, gdk_ping_msg, 0, 0);
return FALSE;
}
}
else if (event.any.type == GDK_EXPOSE)
else if (event.event.any.type == GDK_EXPOSE)
{
/* Compress expose events */
GList *list = gdk_queued_events;
while (list != NULL
&& (((GdkEvent *)list->data)->any.type != GDK_EXPOSE
|| ((GdkEvent *)list->data)->any.window != event.any.window))
|| ((GdkEvent *)list->data)->any.window != event.event.any.window))
list = list->next;
if (list != NULL)
{
GdkRectangle u;
GDK_NOTE (EVENTS, g_print ("... compressing an EXPOSE event\n"));
gdk_rectangle_union (&event.expose.area,
gdk_rectangle_union (&event.event.expose.area,
&((GdkEvent *)list->data)->expose.area,
&u);
((GdkEvent *)list->data)->expose.area = u;
gdk_drawable_unref (event.any.window);
gdk_drawable_unref (event.event.any.window);
#if 0
/* Wake up WaitMessage */
PostMessage (NULL, gdk_ping_msg, 0, 0);
......@@ -237,7 +238,7 @@ gdk_WindowProc (HWND hWnd,
}
#endif
eventp = gdk_event_new ();
*eventp = event;
*((GdkEventPrivate *) eventp) = event;
/* Philippe Colantoni <colanton@aris.ss.uci.edu> suggests this
* in order to handle events while opaque resizing neatly. I
......@@ -525,7 +526,7 @@ gdk_pointer_grab (GdkWindow * window,
p_grab_owner_events = (owner_events != 0);
p_grab_automatic = FALSE;
#if 0 /* Menus don't work if we use mouse capture. Pity, because many other
#if 1 /* Menus don't work if we use mouse capture. Pity, because many other
* things work better with mouse capture.
*/
SetCapture (xwindow);
......@@ -565,7 +566,7 @@ gdk_pointer_ungrab (guint32 time)
{
if (gdk_input_vtable.ungrab_pointer)
gdk_input_vtable.ungrab_pointer (time);
#if 0
#if 1
if (GetCapture () != NULL)
ReleaseCapture ();
#endif
......@@ -743,7 +744,6 @@ gdk_add_client_message_filter (GdkAtom message_type,
static void
build_key_event_state (GdkEvent *event)
{
event->key.state = 0;
if (GetKeyState (VK_SHIFT) < 0)
event->key.state |= GDK_SHIFT_MASK;
if (GetKeyState (VK_CAPITAL) & 0x1)
......@@ -753,14 +753,18 @@ build_key_event_state (GdkEvent *event)
if (GetKeyState (VK_CONTROL) < 0)
{
event->key.state |= GDK_CONTROL_MASK;
#if 0
if (event->key.keyval < ' ')
event->key.keyval += '@';
#endif
}
#if 0
else if (event->key.keyval < ' ')
{
event->key.state |= GDK_CONTROL_MASK;
event->key.keyval += '@';
}
#endif
if (GetKeyState (VK_MENU) < 0)
event->key.state |= GDK_MOD1_MASK;
}
......@@ -790,19 +794,19 @@ build_pointer_event_state (MSG *xevent)
return state;
}
static void
build_keypress_event (GdkWindowWin32Data *windata,
GdkEvent *event,
MSG *xevent)
{
HIMC hIMC;
gint i, bytesleft, bytecount, ucount, ucleft, len;
gint i, bytecount, ucount, ucleft, len;
guchar buf[100], *bp;
wchar_t wbuf[100], *wcp;
event->key.type = GDK_KEY_PRESS;
event->key.time = xevent->time;
event->key.state = 0;
if (xevent->message == WM_IME_COMPOSITION)
{
......@@ -814,7 +818,7 @@ build_keypress_event (GdkWindowWin32Data *windata,
}
else
{
if (xevent->message == WM_CHAR)
if (xevent->message == WM_CHAR || xevent->message == WM_SYSCHAR)
{
bytecount = MIN ((xevent->lParam & 0xFFFF), sizeof (buf));
for (i = 0; i < bytecount; i++)
......@@ -850,16 +854,21 @@ build_keypress_event (GdkWindowWin32Data *windata,
}
if (ucount == 0)
event->key.keyval = GDK_VoidSymbol;
else if (xevent->message == WM_CHAR)
else if (xevent->message == WM_CHAR || xevent->message == WM_SYSCHAR)
if (xevent->wParam < ' ')
event->key.keyval = xevent->wParam + '@';
{
event->key.keyval = xevent->wParam + '@';
/* This is needed in case of Alt+nnn or Alt+0nnn (on the numpad)
* where nnn<32
*/
event->key.state |= GDK_CONTROL_MASK;
}
else
event->key.keyval = gdk_unicode_to_keyval (wbuf[0]);
else
event->key.keyval = GDK_VoidSymbol;
build_key_event_state (event);
/* Build UTF-8 string */
ucleft = ucount;
len = 0;
wcp = wbuf;
......@@ -935,8 +944,9 @@ build_keyrelease_event (GdkWindowWin32Data *windata,
event->key.type = GDK_KEY_RELEASE;
event->key.time = xevent->time;
event->key.state = 0;
if (xevent->message == WM_CHAR)
if (xevent->message == WM_CHAR || xevent->message == WM_SYSCHAR)
if (xevent->wParam < ' ')
event->key.keyval = xevent->wParam + '@';
else
......@@ -1269,12 +1279,10 @@ static gboolean
doesnt_want_key (gint mask,
MSG *xevent)
{
return (((xevent->message == WM_KEYUP
|| xevent->message == WM_SYSKEYUP)
return (((xevent->message == WM_KEYUP || xevent->message == WM_SYSKEYUP)
&& !(mask & GDK_KEY_RELEASE_MASK))
||
((xevent->message == WM_KEYDOWN
|| xevent->message == WM_SYSKEYDOWN)
((xevent->message == WM_KEYDOWN || xevent->message == WM_SYSKEYDOWN)
&& !(mask & GDK_KEY_PRESS_MASK)));
}
......@@ -1325,6 +1333,25 @@ doesnt_want_scroll (gint mask,
#endif
}
static char *
decode_key_lparam (LPARAM lParam)
{
static char buf[100];
char *p = buf;
if (HIWORD (lParam) & KF_UP)
p += sprintf (p, "KF_UP ");
if (HIWORD (lParam) & KF_REPEAT)
p += sprintf (p, "KF_REPEAT ");
if (HIWORD (lParam) & KF_ALTDOWN)
p += sprintf (p, "KF_ALTDOWN ");
if (HIWORD (lParam) & KF_EXTENDED)
p += sprintf (p, "KF_EXTENDED ");
p += sprintf (p, "sc%d rep%d", LOBYTE (HIWORD (lParam)), LOWORD (lParam));
return buf;
}
static gboolean
gdk_event_translate (GdkEvent *event,
MSG *xevent,
......@@ -1344,6 +1371,7 @@ gdk_event_translate (GdkEvent *event,
POINT pt;
MINMAXINFO *lpmmi;
HWND hwnd;
HCURSOR xcursor;
GdkWindow *window, *orig_window, *newwindow;
GdkColormapPrivateWin32 *colormap_private;
GdkEventMask mask;
......@@ -1503,7 +1531,7 @@ gdk_event_translate (GdkEvent *event,
{
case WM_INPUTLANGCHANGE:
GDK_NOTE (EVENTS,
g_print ("WM_INPUTLANGCHANGE: %#x charset %d locale %x\n",
g_print ("WM_INPUTLANGCHANGE: %#x charset %d locale %x\n",
xevent->hwnd, xevent->wParam, xevent->lParam));
GDK_WINDOW_WIN32DATA (window)->input_locale = (HKL) xevent->lParam;
TranslateCharsetInfo ((DWORD FAR *) xevent->wParam,
......@@ -1514,14 +1542,14 @@ gdk_event_translate (GdkEvent *event,
case WM_SYSKEYUP:
case WM_SYSKEYDOWN:
GDK_NOTE (EVENTS,
g_print ("WM_SYSKEY%s: %#x key: %s %#x %#.08x\n",
g_print ("WM_SYSKEY%s: %#x %s %#x %s\n",
(xevent->message == WM_SYSKEYUP ? "UP" : "DOWN"),
xevent->hwnd,
(GetKeyNameText (xevent->lParam, buf,
sizeof (buf)) > 0 ?
buf : ""),
xevent->wParam,
xevent->lParam));
decode_key_lparam (xevent->lParam)));
/* Let the system handle Alt-Tab and Alt-Enter */
if (xevent->wParam == VK_TAB
......@@ -1542,22 +1570,19 @@ gdk_event_translate (GdkEvent *event,
case WM_KEYUP:
case WM_KEYDOWN:
GDK_NOTE (EVENTS,
g_print ("WM_KEY%s: %#x key: %s %#x %#.08x\n",
g_print ("WM_KEY%s: %#x %s %#x %s\n",
(xevent->message == WM_KEYUP ? "UP" : "DOWN"),
xevent->hwnd,
(GetKeyNameText (xevent->lParam, buf,
sizeof (buf)) > 0 ?
buf : ""),
xevent->wParam,
xevent->lParam));
decode_key_lparam (xevent->lParam)));
ignore_WM_CHAR = TRUE;
keyup_or_down:
if (!propagate (&window, xevent,
k_grab_window, k_grab_owner_events, GDK_ALL_EVENTS_MASK,
doesnt_want_key))
break;
event->key.window = window;
switch (xevent->wParam)
{
......@@ -1582,7 +1607,7 @@ gdk_event_translate (GdkEvent *event,
case VK_SHIFT:
/* Don't let Shift auto-repeat */
if (xevent->message == WM_KEYDOWN
&& (xevent->lParam & 0x40000000))
&& (HIWORD (xevent->lParam) & KF_REPEAT))
ignore_WM_CHAR = FALSE;
else
event->key.keyval = GDK_Shift_L;
......@@ -1590,9 +1615,9 @@ gdk_event_translate (GdkEvent *event,
case VK_CONTROL:
/* And not Control either */
if (xevent->message == WM_KEYDOWN
&& (xevent->lParam & 0x40000000))
&& (HIWORD (xevent->lParam) & KF_REPEAT))
ignore_WM_CHAR = FALSE;
else if (xevent->lParam & 0x01000000)
else if (HIWORD (xevent->lParam) & KF_EXTENDED)
event->key.keyval = GDK_Control_R;
else
event->key.keyval = GDK_Control_L;
......@@ -1600,9 +1625,9 @@ gdk_event_translate (GdkEvent *event,
case VK_MENU:
/* And not Alt */
if (xevent->message == WM_KEYDOWN
&& (xevent->lParam & 0x40000000))
&& (HIWORD (xevent->lParam) & KF_REPEAT))
ignore_WM_CHAR = FALSE;
else if (xevent->lParam & 0x01000000)
else if (HIWORD (xevent->lParam) & KF_EXTENDED)
{
/* AltGr key comes in as Control+Right Alt */
if (GetKeyState (VK_CONTROL) < 0)
......@@ -1613,7 +1638,11 @@ gdk_event_translate (GdkEvent *event,
event->key.keyval = GDK_Alt_R;
}
else
event->key.keyval = GDK_Alt_L;
{
event->key.keyval = GDK_Alt_L;
/* This needed in case she types Alt+nnn (on the numpad) */
ignore_WM_CHAR = FALSE;
}
break;
case VK_PAUSE:
event->key.keyval = GDK_Pause; break;
......@@ -1761,6 +1790,11 @@ gdk_event_translate (GdkEvent *event,
if (!ignore_WM_CHAR)
break;
if (!propagate (&window, xevent,
k_grab_window, k_grab_owner_events, GDK_ALL_EVENTS_MASK,
doesnt_want_key))
break;
is_AltGr_key = FALSE;
event->key.type = ((xevent->message == WM_KEYDOWN
|| xevent->message == WM_SYSKEYDOWN) ?
......@@ -1796,9 +1830,12 @@ gdk_event_translate (GdkEvent *event,
goto wm_char;
case WM_CHAR:
case WM_SYSCHAR:
GDK_NOTE (EVENTS,
g_print ("WM_CHAR: %#x char: %#x %#.08x %s\n",
xevent->hwnd, xevent->wParam, xevent->lParam,
g_print ("WM_%sCHAR: %#x %#x %#s %s\n",
(xevent->message == WM_CHAR ? "" : "SYS"),
xevent->hwnd, xevent->wParam,
decode_key_lparam (xevent->lParam),
(ignore_WM_CHAR ? "ignored" : "")));
if (ignore_WM_CHAR)
......@@ -2067,10 +2104,6 @@ gdk_event_translate (GdkEvent *event,
break;