Include modifier state in key release events. Fixes bug #453413.

2007-07-03  Richard Hult  <richard@imendio.com>

	* gdk/quartz/gdkevents-quartz.c (create_key_event): Include
	modifier state in key release events. Fixes bug #453413.

svn path=/trunk/; revision=18367
This commit is contained in:
Richard Hult 2007-07-03 18:49:09 +00:00 committed by Richard Hult
parent cf12fd0de5
commit eb3dcdf094
2 changed files with 44 additions and 0 deletions

View File

@ -1,3 +1,8 @@
2007-07-03 Richard Hult <richard@imendio.com>
* gdk/quartz/gdkevents-quartz.c (create_key_event): Include
modifier state in key release events. Fixes bug #453413.
2007-07-03 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkcelllayout.c (attributes_text_element): Report

View File

@ -1461,6 +1461,45 @@ create_key_event (GdkWindow *window,
event->key.is_modifier = _gdk_quartz_keys_is_modifier (event->key.hardware_keycode);
/* If the key press is a modifier, the state should include the mask
* for that modifier but only for releases, not presses. This
* matches the X11 backend behavior.
*/
if (event->key.is_modifier)
{
int mask = 0;
switch (event->key.keyval)
{
case GDK_Meta_R:
case GDK_Meta_L:
mask = GDK_MOD1_MASK;
break;
case GDK_Shift_R:
case GDK_Shift_L:
mask = GDK_SHIFT_MASK;
break;
case GDK_Caps_Lock:
mask = GDK_LOCK_MASK;
break;
case GDK_Alt_R:
case GDK_Alt_L:
mask = GDK_MOD5_MASK;
break;
case GDK_Control_R:
case GDK_Control_L:
mask = GDK_CONTROL_MASK;
break;
default:
mask = 0;
}
if (type == GDK_KEY_PRESS)
event->key.state &= ~mask;
else if (type == GDK_KEY_RELEASE)
event->key.state |= mask;
}
event->key.string = NULL;
/* Fill in ->string since apps depend on it, taken from the x11 backend. */