forked from AuroraMiddleware/gtk
window: refactor a function
Instead of having maybe_set_mnemonics_visible(), separate the checks from the actual scheduling of mnemonics display. https://bugzilla.gnome.org/show_bug.cgi?id=697144
This commit is contained in:
parent
58209e1138
commit
cfb1e56561
@ -7131,11 +7131,12 @@ do_focus_change (GtkWidget *widget,
|
||||
g_object_unref (widget);
|
||||
}
|
||||
|
||||
static void
|
||||
maybe_set_mnemonics_visible (GtkWindow *window)
|
||||
static gboolean
|
||||
gtk_window_has_mnemonic_modifier_pressed (GtkWindow *window)
|
||||
{
|
||||
GList *devices, *d;
|
||||
GdkDeviceManager *device_manager;
|
||||
gboolean retval = FALSE;
|
||||
|
||||
device_manager = gdk_display_get_device_manager (gtk_widget_get_display (GTK_WIDGET (window)));
|
||||
devices = gdk_device_manager_list_devices (device_manager, GDK_DEVICE_TYPE_MASTER);
|
||||
@ -7152,13 +7153,15 @@ maybe_set_mnemonics_visible (GtkWindow *window)
|
||||
NULL, &mask);
|
||||
if (window->priv->mnemonic_modifier == (mask & gtk_accelerator_get_default_mod_mask ()))
|
||||
{
|
||||
_gtk_window_schedule_mnemonics_visible (window);
|
||||
retval = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
g_list_free (devices);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
static gint
|
||||
@ -7180,8 +7183,8 @@ gtk_window_focus_in_event (GtkWidget *widget,
|
||||
|
||||
g_object_get (gtk_widget_get_settings (widget),
|
||||
"gtk-auto-mnemonics", &auto_mnemonics, NULL);
|
||||
if (auto_mnemonics)
|
||||
maybe_set_mnemonics_visible (window);
|
||||
if (auto_mnemonics && gtk_window_has_mnemonic_modifier_pressed (window))
|
||||
_gtk_window_schedule_mnemonics_visible (window);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
|
Loading…
Reference in New Issue
Block a user