gtk: remove the private GTK_NO_TEXT_INPUT_MOD_MASK

and use the new public modifier abstraction API.
This commit is contained in:
Michael Natterer 2011-09-27 11:34:19 +02:00 committed by Michael Natterer
parent 4a7a67339a
commit 0abe8ce27b
4 changed files with 41 additions and 24 deletions

View File

@ -3724,15 +3724,19 @@ browse_files_key_press_event_cb (GtkWidget *widget,
gpointer data)
{
GtkFileChooserDefault *impl;
GdkModifierType no_text_input_mask;
impl = (GtkFileChooserDefault *) data;
no_text_input_mask =
gtk_widget_get_modifier_mask (widget, GDK_MODIFIER_INTENT_NO_TEXT_INPUT);
if ((event->keyval == GDK_KEY_slash
|| event->keyval == GDK_KEY_KP_Divide
#ifdef G_OS_UNIX
|| event->keyval == GDK_KEY_asciitilde
#endif
) && !(event->state & GTK_NO_TEXT_INPUT_MOD_MASK))
) && !(event->state & no_text_input_mask))
{
location_popup_handler (impl, event->string);
return TRUE;

View File

@ -895,7 +895,16 @@ gtk_im_context_simple_filter_keypress (GtkIMContext *context,
(priv->in_hex_sequence && !hex_keyval &&
!is_hex_start && !is_hex_end && !is_escape && !is_backspace))
{
if (event->state & GTK_NO_TEXT_INPUT_MOD_MASK ||
GdkDisplay *display;
GdkModifierType no_text_input_mask;
display = gdk_window_get_display (event->window);
no_text_input_mask =
gdk_keymap_get_modifier_mask (gdk_keymap_get_for_display (display),
GDK_MODIFIER_INTENT_NO_TEXT_INPUT);
if (event->state & no_text_input_mask ||
(priv->in_hex_sequence && priv->modifiers_dropped &&
(event->keyval == GDK_KEY_Return ||
event->keyval == GDK_KEY_ISO_Enter ||

View File

@ -348,24 +348,38 @@ gtk_im_multicontext_filter_keypress (GtkIMContext *context,
GtkIMContext *slave = gtk_im_multicontext_get_slave (multicontext);
if (slave)
return gtk_im_context_filter_keypress (slave, event);
else if (event->type == GDK_KEY_PRESS &&
(event->state & GTK_NO_TEXT_INPUT_MOD_MASK) == 0)
{
gunichar ch;
return gtk_im_context_filter_keypress (slave, event);
}
else
{
GdkDisplay *display;
GdkModifierType no_text_input_mask;
ch = gdk_keyval_to_unicode (event->keyval);
if (ch != 0 && !g_unichar_iscntrl (ch))
display = gdk_window_get_display (event->window);
no_text_input_mask =
gdk_keymap_get_modifier_mask (gdk_keymap_get_for_display (display),
GDK_MODIFIER_INTENT_NO_TEXT_INPUT);
if (event->type == GDK_KEY_PRESS &&
(event->state & no_text_input_mask) == 0)
{
gint len;
gchar buf[10];
gunichar ch;
len = g_unichar_to_utf8 (ch, buf);
buf[len] = '\0';
ch = gdk_keyval_to_unicode (event->keyval);
if (ch != 0 && !g_unichar_iscntrl (ch))
{
gint len;
gchar buf[10];
g_signal_emit_by_name (multicontext, "commit", buf);
len = g_unichar_to_utf8 (ch, buf);
buf[len] = '\0';
return TRUE;
g_signal_emit_by_name (multicontext, "commit", buf);
return TRUE;
}
}
}

View File

@ -67,16 +67,6 @@ const gchar *_gtk_get_data_prefix ();
#define GTK_DEFAULT_ACCEL_MOD_MASK GDK_META_MASK
#endif
/* When any of these modifiers are active, a key
* event cannot produce a symbol, so should be
* skipped when handling text input
*/
#ifndef GDK_WINDOWING_QUARTZ
#define GTK_NO_TEXT_INPUT_MOD_MASK (GDK_MOD1_MASK | GDK_CONTROL_MASK)
#else
#define GTK_NO_TEXT_INPUT_MOD_MASK (GDK_MOD2_MASK | GDK_CONTROL_MASK)
#endif
#ifndef GDK_WINDOWING_QUARTZ
#define GTK_EXTEND_SELECTION_MOD_MASK GDK_SHIFT_MASK
#define GTK_MODIFY_SELECTION_MOD_MASK GDK_CONTROL_MASK