[gimp/metadata-browser] app: don't hardcode MOD2 in GimpContainerTreeView either
- From: Roman Joost <romanofski src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/metadata-browser] app: don't hardcode MOD2 in GimpContainerTreeView either
- Date: Fri, 2 Dec 2011 02:16:13 +0000 (UTC)
commit c0a8dede30e2969593bcd07222dffe52c349b6f5
Author: Michael Natterer <mitch gimp org>
Date: Mon Oct 10 00:17:20 2011 +0200
app: don't hardcode MOD2 in GimpContainerTreeView either
Add new utility function gimp_get_all_modifiers_mask() which returns
all modifiers used for "useful" things on the current platform, like
in the commit below.
app/widgets/gimpcontainertreeview.c | 5 +----
app/widgets/gimpwidgets-utils.c | 14 ++++++++++++++
app/widgets/gimpwidgets-utils.h | 1 +
3 files changed, 16 insertions(+), 4 deletions(-)
---
diff --git a/app/widgets/gimpcontainertreeview.c b/app/widgets/gimpcontainertreeview.c
index b1f23c6..e67129c 100644
--- a/app/widgets/gimpcontainertreeview.c
+++ b/app/widgets/gimpcontainertreeview.c
@@ -1124,10 +1124,7 @@ gimp_container_tree_view_button_press (GtkWidget *widget,
column, edit_cell, TRUE);
}
else if (! toggled_cell &&
- ((bevent->state & (GDK_SHIFT_MASK |
- GDK_CONTROL_MASK |
- GDK_MOD1_MASK |
- GDK_MOD2_MASK)) == 0))
+ ! (bevent->state & gimp_get_all_modifiers_mask ()))
{
/* Only activate if we're not in a toggled cell
* and no modifier keys are pressed
diff --git a/app/widgets/gimpwidgets-utils.c b/app/widgets/gimpwidgets-utils.c
index d97d069..af3c1f4 100644
--- a/app/widgets/gimpwidgets-utils.c
+++ b/app/widgets/gimpwidgets-utils.c
@@ -699,6 +699,20 @@ gimp_get_constrain_behavior_mask (void)
GDK_MODIFIER_INTENT_MODIFY_SELECTION);
}
+GdkModifierType
+gimp_get_all_modifiers_mask (void)
+{
+ GdkDisplay *display = gdk_display_get_default ();
+
+ return (GDK_SHIFT_MASK | GDK_CONTROL_MASK | GDK_MOD1_MASK |
+ gdk_keymap_get_modifier_mask (gdk_keymap_get_for_display (display),
+ GDK_MODIFIER_INTENT_PRIMARY_ACCELERATOR) |
+ gdk_keymap_get_modifier_mask (gdk_keymap_get_for_display (display),
+ GDK_MODIFIER_INTENT_EXTEND_SELECTION) |
+ gdk_keymap_get_modifier_mask (gdk_keymap_get_for_display (display),
+ GDK_MODIFIER_INTENT_MODIFY_SELECTION));
+}
+
/**
* gimp_get_screen_resolution:
* @screen: a #GdkScreen or %NULL
diff --git a/app/widgets/gimpwidgets-utils.h b/app/widgets/gimpwidgets-utils.h
index e1af206..1929dd5 100644
--- a/app/widgets/gimpwidgets-utils.h
+++ b/app/widgets/gimpwidgets-utils.h
@@ -63,6 +63,7 @@ GdkModifierType gimp_get_extend_selection_mask (void);
GdkModifierType gimp_get_modify_selection_mask (void);
GdkModifierType gimp_get_toggle_behavior_mask (void);
GdkModifierType gimp_get_constrain_behavior_mask (void);
+GdkModifierType gimp_get_all_modifiers_mask (void);
void gimp_get_screen_resolution (GdkScreen *screen,
gdouble *xres,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]