Make it possible to determine if a key event is for a modifier key:
2005-09-09 Matthias Clasen <mclasen@redhat.com> Make it possible to determine if a key event is for a modifier key: * gdk/x11/gdkprivate-x11.h: * gdk/x11/gdkkeys-x11.c (_gdk_keymap_key_is_modifier): New function to determine if a keycode is mapped to a modifier. (get_xkb): Get the modmap. * gdk/x11/gdkevents-x11.c (translate_key_event): Set the is_modifier bit by calling _gdk_keymap_key_is_modifier(). * gdk/gdkevents.h (struct _GdkEventKey): Add an is_modifier bit.
This commit is contained in:
committed by
Matthias Clasen
parent
e42a880493
commit
03aea1a3da
21
ChangeLog
21
ChangeLog
@ -1,3 +1,24 @@
|
|||||||
|
2005-09-09 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
|
Make it possible to determine if a key event is for a
|
||||||
|
modifier key:
|
||||||
|
|
||||||
|
* gdk/x11/gdkprivate-x11.h:
|
||||||
|
* gdk/x11/gdkkeys-x11.c (_gdk_keymap_key_is_modifier):
|
||||||
|
New function to determine if a keycode is mapped to a modifier.
|
||||||
|
(get_xkb): Get the modmap.
|
||||||
|
|
||||||
|
* gdk/x11/gdkevents-x11.c (translate_key_event): Set the
|
||||||
|
is_modifier bit by calling _gdk_keymap_key_is_modifier().
|
||||||
|
|
||||||
|
* gdk/gdkevents.h (struct _GdkEventKey): Add an is_modifier
|
||||||
|
bit.
|
||||||
|
|
||||||
|
2005-09-09 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
|
* gdk/gdkpixbuf-drawable.c (convert_real_slow): Remove an
|
||||||
|
unused variable, noticed by Kjartan Maraas.
|
||||||
|
|
||||||
2005-09-09 Matthias Clasen <mclasen@redhat.com>
|
2005-09-09 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_button_event):
|
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_button_event):
|
||||||
|
|||||||
@ -1,3 +1,24 @@
|
|||||||
|
2005-09-09 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
|
Make it possible to determine if a key event is for a
|
||||||
|
modifier key:
|
||||||
|
|
||||||
|
* gdk/x11/gdkprivate-x11.h:
|
||||||
|
* gdk/x11/gdkkeys-x11.c (_gdk_keymap_key_is_modifier):
|
||||||
|
New function to determine if a keycode is mapped to a modifier.
|
||||||
|
(get_xkb): Get the modmap.
|
||||||
|
|
||||||
|
* gdk/x11/gdkevents-x11.c (translate_key_event): Set the
|
||||||
|
is_modifier bit by calling _gdk_keymap_key_is_modifier().
|
||||||
|
|
||||||
|
* gdk/gdkevents.h (struct _GdkEventKey): Add an is_modifier
|
||||||
|
bit.
|
||||||
|
|
||||||
|
2005-09-09 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
|
* gdk/gdkpixbuf-drawable.c (convert_real_slow): Remove an
|
||||||
|
unused variable, noticed by Kjartan Maraas.
|
||||||
|
|
||||||
2005-09-09 Matthias Clasen <mclasen@redhat.com>
|
2005-09-09 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_button_event):
|
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_button_event):
|
||||||
|
|||||||
@ -1,3 +1,7 @@
|
|||||||
|
2005-09-09 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
|
* gdk/tmpl/event_structs.sgml: Document GdkEventKey.is_modifier.
|
||||||
|
|
||||||
2005-09-06 Matthias Clasen <mclasen@redhat.com>
|
2005-09-06 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
* gdk/tmpl/windows.sgml: Document new modifier bits.
|
* gdk/tmpl/windows.sgml: Document new modifier bits.
|
||||||
|
|||||||
@ -108,6 +108,8 @@ NUL byte, in which case looking at @length is necessary to distinguish
|
|||||||
it from the an empty translation.
|
it from the an empty translation.
|
||||||
@hardware_keycode: the raw code of the key that was pressed or released.
|
@hardware_keycode: the raw code of the key that was pressed or released.
|
||||||
@group: the keyboard group.
|
@group: the keyboard group.
|
||||||
|
@is_modifier: a flag that indicates if @hardware_keycode is mapped to a
|
||||||
|
modifier. Since 2.10
|
||||||
|
|
||||||
<!-- ##### STRUCT GdkEventButton ##### -->
|
<!-- ##### STRUCT GdkEventButton ##### -->
|
||||||
<para>
|
<para>
|
||||||
|
|||||||
@ -342,6 +342,7 @@ struct _GdkEventKey
|
|||||||
gchar *string;
|
gchar *string;
|
||||||
guint16 hardware_keycode;
|
guint16 hardware_keycode;
|
||||||
guint8 group;
|
guint8 group;
|
||||||
|
guint is_modifier : 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GdkEventCrossing
|
struct _GdkEventCrossing
|
||||||
|
|||||||
@ -611,6 +611,7 @@ translate_key_event (GdkDisplay *display,
|
|||||||
NULL, NULL, NULL);
|
NULL, NULL, NULL);
|
||||||
|
|
||||||
_gdk_keymap_add_virtual_modifiers (keymap, &event->key.state);
|
_gdk_keymap_add_virtual_modifiers (keymap, &event->key.state);
|
||||||
|
event->key.is_modifier = _gdk_keymap_key_is_modifier (keymap, event->key.hardware_keycode);
|
||||||
|
|
||||||
/* Fill in event->string crudely, since various programs
|
/* Fill in event->string crudely, since various programs
|
||||||
* depend on it.
|
* depend on it.
|
||||||
|
|||||||
@ -219,7 +219,7 @@ get_xkb (GdkKeymapX11 *keymap_x11)
|
|||||||
|
|
||||||
if (keymap_x11->xkb_desc == NULL)
|
if (keymap_x11->xkb_desc == NULL)
|
||||||
{
|
{
|
||||||
keymap_x11->xkb_desc = XkbGetMap (xdisplay, XkbKeySymsMask | XkbKeyTypesMask | XkbVirtualModsMask, XkbUseCoreKbd);
|
keymap_x11->xkb_desc = XkbGetMap (xdisplay, XkbKeySymsMask | XkbKeyTypesMask | XkbModifierMapMask | XkbVirtualModsMask, XkbUseCoreKbd);
|
||||||
if (keymap_x11->xkb_desc == NULL)
|
if (keymap_x11->xkb_desc == NULL)
|
||||||
g_error ("Failed to get keymap");
|
g_error ("Failed to get keymap");
|
||||||
|
|
||||||
@ -229,7 +229,7 @@ get_xkb (GdkKeymapX11 *keymap_x11)
|
|||||||
}
|
}
|
||||||
else if (keymap_x11->current_serial != display_x11->keymap_serial)
|
else if (keymap_x11->current_serial != display_x11->keymap_serial)
|
||||||
{
|
{
|
||||||
XkbGetUpdatedMap (xdisplay, XkbKeySymsMask | XkbKeyTypesMask | XkbVirtualModsMask,
|
XkbGetUpdatedMap (xdisplay, XkbKeySymsMask | XkbKeyTypesMask | XkbModifierMapMask | XkbVirtualModsMask,
|
||||||
keymap_x11->xkb_desc);
|
keymap_x11->xkb_desc);
|
||||||
XkbGetNames (xdisplay, XkbGroupNamesMask | XkbVirtualModNamesMask, keymap_x11->xkb_desc);
|
XkbGetNames (xdisplay, XkbGroupNamesMask | XkbVirtualModNamesMask, keymap_x11->xkb_desc);
|
||||||
|
|
||||||
@ -1537,6 +1537,41 @@ _gdk_keymap_add_virtual_modifiers (GdkKeymap *keymap,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
_gdk_keymap_key_is_modifier (GdkKeymap *keymap,
|
||||||
|
guint keycode)
|
||||||
|
{
|
||||||
|
GdkKeymapX11 *keymap_x11;
|
||||||
|
gint i;
|
||||||
|
|
||||||
|
keymap = GET_EFFECTIVE_KEYMAP (keymap);
|
||||||
|
keymap_x11 = GDK_KEYMAP_X11 (keymap);
|
||||||
|
|
||||||
|
if (keycode < keymap_x11->min_keycode ||
|
||||||
|
keycode > keymap_x11->max_keycode)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
#ifdef HAVE_XKB
|
||||||
|
if (KEYMAP_USE_XKB (keymap))
|
||||||
|
{
|
||||||
|
XkbDescRec *xkb = get_xkb (keymap_x11);
|
||||||
|
|
||||||
|
if (xkb->map->modmap[keycode] != 0)
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
for (i = 0; i < 8 * keymap_x11->mod_keymap->max_keypermod; i++)
|
||||||
|
{
|
||||||
|
if (keycode == keymap_x11->mod_keymap->modifiermap[i])
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#define __GDK_KEYS_X11_C__
|
#define __GDK_KEYS_X11_C__
|
||||||
#include "gdkaliasdef.c"
|
#include "gdkaliasdef.c"
|
||||||
|
|||||||
@ -145,6 +145,8 @@ gint _gdk_x11_get_group_for_state (GdkDisplay *display,
|
|||||||
GdkModifierType state);
|
GdkModifierType state);
|
||||||
void _gdk_keymap_add_virtual_modifiers (GdkKeymap *keymap,
|
void _gdk_keymap_add_virtual_modifiers (GdkKeymap *keymap,
|
||||||
GdkModifierType *modifiers);
|
GdkModifierType *modifiers);
|
||||||
|
gboolean _gdk_keymap_key_is_modifier (GdkKeymap *keymap,
|
||||||
|
guint keycode);
|
||||||
|
|
||||||
GC _gdk_x11_gc_flush (GdkGC *gc);
|
GC _gdk_x11_gc_flush (GdkGC *gc);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user