summaryrefslogtreecommitdiff
path: root/gtk/gtkimcontextsimple.c
diff options
context:
space:
mode:
authorMichael Natterer <mitch@lanedo.com>2011-10-07 09:29:43 +0200
committerMichael Natterer <mitch@gimp.org>2011-10-07 09:33:07 +0200
commit87cc0dc79fe77c46508e89d677bc52ff12915d9a (patch)
treee73109a197e9af3c27a10f980e10f240c57600c9 /gtk/gtkimcontextsimple.c
parent78d8d6b900262fa03fabd6ef477b4209213d0d97 (diff)
downloadgtk+-87cc0dc79fe77c46508e89d677bc52ff12915d9a.tar.gz
gtk: use the new modifier API instead of GTK_DEFAULT_ACCEL_MOD_MASK
in gtkimcontextsimple and gtktreeview, which are the easy places, but also true bugfixes, because on OSX we can't use the virtual META here, we needs MOD2 as delivered in key events.
Diffstat (limited to 'gtk/gtkimcontextsimple.c')
-rw-r--r--gtk/gtkimcontextsimple.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/gtk/gtkimcontextsimple.c b/gtk/gtkimcontextsimple.c
index 721082459b..ab721fe6f9 100644
--- a/gtk/gtkimcontextsimple.c
+++ b/gtk/gtkimcontextsimple.c
@@ -628,7 +628,6 @@ check_algorithmically (GtkIMContextSimple *context_simple,
* with Ctrl-Shift-U, then release the modifiers before typing any
* digits, and enter the digits without modifiers.
*/
-#define HEX_MOD_MASK (GTK_DEFAULT_ACCEL_MOD_MASK | GDK_SHIFT_MASK)
static gboolean
check_hex (GtkIMContextSimple *context_simple,
@@ -814,8 +813,10 @@ gtk_im_context_simple_filter_keypress (GtkIMContext *context,
{
GtkIMContextSimple *context_simple = GTK_IM_CONTEXT_SIMPLE (context);
GtkIMContextSimplePrivate *priv = context_simple->priv;
+ GdkDisplay *display = gdk_window_get_display (event->window);
GSList *tmp_list;
int n_compose = 0;
+ GdkModifierType hex_mod_mask;
gboolean have_hex_mods;
gboolean is_hex_start;
gboolean is_hex_end;
@@ -868,10 +869,14 @@ gtk_im_context_simple_filter_keypress (GtkIMContext *context,
if (event->keyval == gtk_compose_ignore[i])
return FALSE;
+ hex_mod_mask = gdk_keymap_get_modifier_mask (gdk_keymap_get_for_display (display),
+ GDK_MODIFIER_INTENT_PRIMARY_ACCELERATOR);
+ hex_mod_mask |= GDK_SHIFT_MASK;
+
if (priv->in_hex_sequence && priv->modifiers_dropped)
have_hex_mods = TRUE;
else
- have_hex_mods = (event->state & (HEX_MOD_MASK)) == HEX_MOD_MASK;
+ have_hex_mods = (event->state & (hex_mod_mask)) == hex_mod_mask;
is_hex_start = event->keyval == GDK_KEY_U;
is_hex_end = (event->keyval == GDK_KEY_space ||
event->keyval == GDK_KEY_KP_Space ||