Commit 87cc0dc7 authored by Michael Natterer's avatar Michael Natterer Committed by Michael Natterer

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.
parent 78d8d6b9
......@@ -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 ||
......
......@@ -15157,7 +15157,8 @@ gtk_tree_view_search_key_press_event (GtkWidget *widget,
GdkEventKey *event,
GtkTreeView *tree_view)
{
gboolean retval = FALSE;
GdkModifierType default_accel;
gboolean retval = FALSE;
g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
g_return_val_if_fail (GTK_IS_TREE_VIEW (tree_view), FALSE);
......@@ -15174,6 +15175,9 @@ gtk_tree_view_search_key_press_event (GtkWidget *widget,
return TRUE;
}
default_accel = gtk_widget_get_modifier_mask (widget,
GDK_MODIFIER_INTENT_PRIMARY_ACCELERATOR);
/* select previous matching iter */
if (event->keyval == GDK_KEY_Up || event->keyval == GDK_KEY_KP_Up)
{
......@@ -15183,7 +15187,7 @@ gtk_tree_view_search_key_press_event (GtkWidget *widget,
retval = TRUE;
}
if (((event->state & (GTK_DEFAULT_ACCEL_MOD_MASK | GDK_SHIFT_MASK)) == (GTK_DEFAULT_ACCEL_MOD_MASK | GDK_SHIFT_MASK))
if (((event->state & (default_accel | GDK_SHIFT_MASK)) == (default_accel | GDK_SHIFT_MASK))
&& (event->keyval == GDK_KEY_g || event->keyval == GDK_KEY_G))
{
if (!gtk_tree_view_search_move (widget, tree_view, TRUE))
......@@ -15201,7 +15205,7 @@ gtk_tree_view_search_key_press_event (GtkWidget *widget,
retval = TRUE;
}
if (((event->state & (GTK_DEFAULT_ACCEL_MOD_MASK | GDK_SHIFT_MASK)) == GTK_DEFAULT_ACCEL_MOD_MASK)
if (((event->state & (default_accel | GDK_SHIFT_MASK)) == default_accel)
&& (event->keyval == GDK_KEY_g || event->keyval == GDK_KEY_G))
{
if (!gtk_tree_view_search_move (widget, tree_view, 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