[gtk+] window: refactor a function
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] window: refactor a function
- Date: Tue, 2 Apr 2013 21:40:30 +0000 (UTC)
commit cfb1e56561a3fdf034f7059300c94fcac8d0de19
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Tue Apr 2 16:33:33 2013 -0400
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
gtk/gtkwindow.c | 13 ++++++++-----
1 files changed, 8 insertions(+), 5 deletions(-)
---
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index 3a6b29e..cddf227 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]