[gtk+] Some additional auto-mnemonic fixes
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] Some additional auto-mnemonic fixes
- Date: Fri, 6 May 2011 18:10:37 +0000 (UTC)
commit 73bf1740e9ce8a6148db403f12838c231d3f2bb6
Author: Matthias Clasen <mclasen redhat com>
Date: Fri May 6 14:04:50 2011 -0400
Some additional auto-mnemonic fixes
Previously, we would also show mnemonics if the user hits
Ctrl+Alt, even though Ctrl+Alt+<x> does not actually trigger.
gtk/gtkmain.c | 3 +++
gtk/gtkwindow.c | 3 +--
2 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkmain.c b/gtk/gtkmain.c
index 9eda5a9..950c499 100644
--- a/gtk/gtkmain.c
+++ b/gtk/gtkmain.c
@@ -1840,10 +1840,13 @@ gtk_main_do_event (GdkEvent *event)
if (gtk_invoke_key_snoopers (grab_widget, event))
break;
}
+
/* Catch alt press to enable auto-mnemonics;
* menus are handled elsewhere
+ * FIXME: this does not work with mnemonic modifiers other than Alt
*/
if ((event->key.keyval == GDK_KEY_Alt_L || event->key.keyval == GDK_KEY_Alt_R) &&
+ ((event->key.state & (gtk_accelerator_get_default_mod_mask ()) & ~(GDK_RELEASE_MASK|GDK_MOD1_MASK)) == 0) &&
!GTK_IS_MENU_SHELL (grab_widget))
{
gboolean auto_mnemonics;
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index 04cf5c9..2af5409 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -5947,8 +5947,7 @@ maybe_set_mnemonics_visible (GtkWindow *window)
gdk_device_get_state (dev, gtk_widget_get_window (GTK_WIDGET (window)),
NULL, &mask);
-
- if (window->priv->mnemonic_modifier & mask)
+ if (window->priv->mnemonic_modifier == (mask & gtk_accelerator_get_default_mod_mask ()))
{
gtk_window_set_mnemonics_visible (window, TRUE);
break;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]