mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-11 11:20:12 +00:00
Some improvements to the auto-mnemonics code
This commit is contained in:
parent
4116baef32
commit
6f421d1450
@ -1615,8 +1615,11 @@ gtk_main_do_event (GdkEvent *event)
|
|||||||
if (gtk_invoke_key_snoopers (grab_widget, event))
|
if (gtk_invoke_key_snoopers (grab_widget, event))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
/* catch alt press to enable auto-mnemonics */
|
/* Catch alt press to enable auto-mnemonics;
|
||||||
if (event->key.keyval == GDK_Alt_L || event->key.keyval == GDK_Alt_R)
|
* menus are handled elsewhere
|
||||||
|
*/
|
||||||
|
if ((event->key.keyval == GDK_Alt_L || event->key.keyval == GDK_Alt_R) &&
|
||||||
|
!GTK_IS_MENU_SHELL (grab_widget))
|
||||||
{
|
{
|
||||||
gboolean auto_mnemonics;
|
gboolean auto_mnemonics;
|
||||||
|
|
||||||
|
@ -831,8 +831,12 @@ _gtk_menu_shell_update_mnemonics (GtkMenuShell *menu_shell)
|
|||||||
* not in the entire window.
|
* not in the entire window.
|
||||||
*/
|
*/
|
||||||
if (GTK_IS_MENU_BAR (target))
|
if (GTK_IS_MENU_BAR (target))
|
||||||
_gtk_label_mnemonics_visible_apply_recursively (GTK_WIDGET (target),
|
{
|
||||||
mnemonics_visible);
|
gtk_window_set_mnemonics_visible (GTK_WINDOW (gtk_widget_get_toplevel (target)),
|
||||||
|
FALSE);
|
||||||
|
_gtk_label_mnemonics_visible_apply_recursively (GTK_WIDGET (target),
|
||||||
|
mnemonics_visible);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
gtk_window_set_mnemonics_visible (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (target))),
|
gtk_window_set_mnemonics_visible (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (target))),
|
||||||
mnemonics_visible);
|
mnemonics_visible);
|
||||||
|
@ -42,6 +42,7 @@
|
|||||||
#include "gtkkeyhash.h"
|
#include "gtkkeyhash.h"
|
||||||
#include "gtkmain.h"
|
#include "gtkmain.h"
|
||||||
#include "gtkmnemonichash.h"
|
#include "gtkmnemonichash.h"
|
||||||
|
#include "gtkmenubar.h"
|
||||||
#include "gtkiconfactory.h"
|
#include "gtkiconfactory.h"
|
||||||
#include "gtkicontheme.h"
|
#include "gtkicontheme.h"
|
||||||
#include "gtkmarshalers.h"
|
#include "gtkmarshalers.h"
|
||||||
@ -235,8 +236,6 @@ static gint gtk_window_client_event (GtkWidget *widget,
|
|||||||
static void gtk_window_check_resize (GtkContainer *container);
|
static void gtk_window_check_resize (GtkContainer *container);
|
||||||
static gint gtk_window_focus (GtkWidget *widget,
|
static gint gtk_window_focus (GtkWidget *widget,
|
||||||
GtkDirectionType direction);
|
GtkDirectionType direction);
|
||||||
static void gtk_window_grab_notify (GtkWidget *widget,
|
|
||||||
gboolean was_grabbed);
|
|
||||||
static void gtk_window_real_set_focus (GtkWindow *window,
|
static void gtk_window_real_set_focus (GtkWindow *window,
|
||||||
GtkWidget *focus);
|
GtkWidget *focus);
|
||||||
|
|
||||||
@ -464,7 +463,6 @@ gtk_window_class_init (GtkWindowClass *klass)
|
|||||||
widget_class->client_event = gtk_window_client_event;
|
widget_class->client_event = gtk_window_client_event;
|
||||||
widget_class->focus = gtk_window_focus;
|
widget_class->focus = gtk_window_focus;
|
||||||
widget_class->expose_event = gtk_window_expose;
|
widget_class->expose_event = gtk_window_expose;
|
||||||
widget_class->grab_notify = gtk_window_grab_notify;
|
|
||||||
|
|
||||||
container_class->check_resize = gtk_window_check_resize;
|
container_class->check_resize = gtk_window_check_resize;
|
||||||
|
|
||||||
@ -5332,7 +5330,6 @@ gtk_window_focus_out_event (GtkWidget *widget,
|
|||||||
if (auto_mnemonics)
|
if (auto_mnemonics)
|
||||||
gtk_window_set_mnemonics_visible (window, FALSE);
|
gtk_window_set_mnemonics_visible (window, FALSE);
|
||||||
|
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -8506,22 +8503,6 @@ gtk_window_set_mnemonics_visible (GtkWindow *window,
|
|||||||
priv->mnemonics_visible_set = TRUE;
|
priv->mnemonics_visible_set = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
gtk_window_grab_notify (GtkWidget *widget,
|
|
||||||
gboolean was_grabbed)
|
|
||||||
{
|
|
||||||
gboolean auto_mnemonics;
|
|
||||||
|
|
||||||
if (was_grabbed)
|
|
||||||
return;
|
|
||||||
|
|
||||||
g_object_get (gtk_widget_get_settings (widget), "gtk-auto-mnemonics",
|
|
||||||
&auto_mnemonics, NULL);
|
|
||||||
|
|
||||||
if (auto_mnemonics)
|
|
||||||
gtk_window_set_mnemonics_visible (GTK_WINDOW (widget), FALSE);
|
|
||||||
}
|
|
||||||
|
|
||||||
#if defined (G_OS_WIN32) && !defined (_WIN64)
|
#if defined (G_OS_WIN32) && !defined (_WIN64)
|
||||||
|
|
||||||
#undef gtk_window_set_icon_from_file
|
#undef gtk_window_set_icon_from_file
|
||||||
|
Loading…
Reference in New Issue
Block a user