[gimp/metadata-browser] app: use gtk_widget_get_modifier_mask() in GimpWindow
- From: Roman Joost <romanofski src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/metadata-browser] app: use gtk_widget_get_modifier_mask() in GimpWindow
- Date: Fri, 2 Dec 2011 02:12:47 +0000 (UTC)
commit 24c73ed66e719b809003693f9fe3e08df35f0713
Author: Michael Natterer <mitch gimp org>
Date: Fri Oct 7 00:48:55 2011 +0200
app: use gtk_widget_get_modifier_mask() in GimpWindow
to figure the primary accel modifier, so this code is now generic.
app/widgets/gimpwindow.c | 28 +++++++++-------------------
1 files changed, 9 insertions(+), 19 deletions(-)
---
diff --git a/app/widgets/gimpwindow.c b/app/widgets/gimpwindow.c
index eed13a8..06b71f5 100644
--- a/app/widgets/gimpwindow.c
+++ b/app/widgets/gimpwindow.c
@@ -21,6 +21,8 @@
#include <gtk/gtk.h>
+#include "libgimpwidgets/gimpwidgets.h"
+
#include "widgets-types.h"
#include "display/display-types.h"
@@ -54,10 +56,8 @@ static gboolean
gimp_window_key_press_event (GtkWidget *widget,
GdkEventKey *event)
{
- GtkWindow *window = GTK_WINDOW (widget);
- GtkWidget *focus = gtk_window_get_focus (window);
- GdkDisplay *display = gtk_widget_get_display (widget);
- GdkModifierType state = event->state;
+ GtkWindow *window = GTK_WINDOW (widget);
+ GtkWidget *focus = gtk_window_get_focus (window);
GdkModifierType accel_mods;
gboolean enable_mnemonics;
gboolean handled = FALSE;
@@ -79,19 +79,9 @@ gimp_window_key_press_event (GtkWidget *widget,
"handled by gtk_window_propagate_key_event(text_widget)");
}
- /* we process raw key events here, and they contain only real
- * modifiers; call the mapping function in order to get virtual
- * modifiers added (e.g. META) in case the accel modifier is virtual
- */
- gdk_keymap_add_virtual_modifiers (gdk_keymap_get_for_display (display),
- &state);
-
- /* FIXME: get this from GTK API */
-#ifndef GDK_WINDOWING_QUARTZ
- accel_mods = GDK_CONTROL_MASK;
-#else
- accel_mods = GDK_META_MASK;
-#endif
+ accel_mods =
+ gtk_widget_get_modifier_mask (widget,
+ GDK_MODIFIER_INTENT_PRIMARY_ACCELERATOR);
g_object_get (gtk_widget_get_settings (widget),
"gtk-enable-mnemonics", &enable_mnemonics,
@@ -101,7 +91,7 @@ gimp_window_key_press_event (GtkWidget *widget,
accel_mods |= gtk_window_get_mnemonic_modifier (window);
/* invoke modified accelerators */
- if (! handled && state & accel_mods)
+ if (! handled && event->state & accel_mods)
{
handled = gtk_window_activate_key (window, event);
@@ -121,7 +111,7 @@ gimp_window_key_press_event (GtkWidget *widget,
}
/* invoke non-modified accelerators */
- if (! handled && ! (state & accel_mods))
+ if (! handled && ! (event->state & accel_mods))
{
handled = gtk_window_activate_key (window, event);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]