[gimp/metadata-browser] libgimpwidgets: add some modifier abstraction API to gimp3migration.[ch]
- From: Roman Joost <romanofski src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/metadata-browser] libgimpwidgets: add some modifier abstraction API to gimp3migration.[ch]
- Date: Fri, 2 Dec 2011 02:07:00 +0000 (UTC)
commit b484b17fdfa8ee60f15617596d18ff92a26ab14b
Author: Michael Natterer <mitch gimp org>
Date: Tue Oct 4 23:09:09 2011 +0200
libgimpwidgets: add some modifier abstraction API to gimp3migration.[ch]
Work in progress and unused, will help to make things proper on OSX.
libgimpwidgets/gimp3migration.c | 65 +++++++++++++++++++++++++++++++++++++++
libgimpwidgets/gimp3migration.h | 15 ++++++++-
2 files changed, 79 insertions(+), 1 deletions(-)
---
diff --git a/libgimpwidgets/gimp3migration.c b/libgimpwidgets/gimp3migration.c
index 529b125..a32a2ed 100644
--- a/libgimpwidgets/gimp3migration.c
+++ b/libgimpwidgets/gimp3migration.c
@@ -111,4 +111,69 @@ gdk_event_triggers_context_menu (const GdkEvent *event)
return FALSE;
}
+GdkModifierType
+gdk_keymap_get_modifier_mask (GdkKeymap *keymap,
+ GdkModifierIntent intent)
+{
+ g_return_val_if_fail (GDK_IS_KEYMAP (keymap), 0);
+
+#ifdef GDK_WINDOWING_QUARTZ
+ switch (intent)
+ {
+ case GDK_MODIFIER_INTENT_PRIMARY_ACCELERATOR:
+ return GDK_MOD2_MASK;
+
+ case GDK_MODIFIER_INTENT_CONTEXT_MENU:
+ return GDK_CONTROL_MASK;
+
+ case GDK_MODIFIER_INTENT_EXTEND_SELECTION:
+ return GDK_SHIFT_MASK;
+
+ case GDK_MODIFIER_INTENT_MODIFY_SELECTION:
+ return GDK_MOD2_MASK;
+
+ case GDK_MODIFIER_INTENT_NO_TEXT_INPUT:
+ return GDK_MOD2_MASK | GDK_CONTROL_MASK;
+
+ default:
+ g_return_val_if_reached (0);
+ }
+#else
+ switch (intent)
+ {
+ case GDK_MODIFIER_INTENT_PRIMARY_ACCELERATOR:
+ return GDK_CONTROL_MASK;
+
+ case GDK_MODIFIER_INTENT_CONTEXT_MENU:
+ return 0;
+
+ case GDK_MODIFIER_INTENT_EXTEND_SELECTION:
+ return GDK_SHIFT_MASK;
+
+ case GDK_MODIFIER_INTENT_MODIFY_SELECTION:
+ return GDK_CONTROL_MASK;
+
+ case GDK_MODIFIER_INTENT_NO_TEXT_INPUT:
+ return GDK_MOD1_MASK | GDK_CONTROL_MASK;
+
+ default:
+ g_return_val_if_reached (0);
+ }
+#endif
+}
+
+GdkModifierType
+gtk_widget_get_modifier_mask (GtkWidget *widget,
+ GdkModifierIntent intent)
+{
+ GdkDisplay *display;
+
+ g_return_val_if_fail (GTK_IS_WIDGET (widget), 0);
+
+ display = gtk_widget_get_display (widget);
+
+ return gdk_keymap_get_modifier_mask (gdk_keymap_get_for_display (display),
+ intent);
+}
+
#endif /* GTK+ 3.3 */
diff --git a/libgimpwidgets/gimp3migration.h b/libgimpwidgets/gimp3migration.h
index 82270f9..3371c7a 100644
--- a/libgimpwidgets/gimp3migration.h
+++ b/libgimpwidgets/gimp3migration.h
@@ -51,7 +51,20 @@ GtkWidget * gtk_separator_new (GtkOrientation orientation);
*/
#if ! GTK_CHECK_VERSION (3, 3, 0)
-gboolean gdk_event_triggers_context_menu (const GdkEvent *event);
+typedef enum
+{
+ GDK_MODIFIER_INTENT_PRIMARY_ACCELERATOR,
+ GDK_MODIFIER_INTENT_CONTEXT_MENU,
+ GDK_MODIFIER_INTENT_EXTEND_SELECTION,
+ GDK_MODIFIER_INTENT_MODIFY_SELECTION,
+ GDK_MODIFIER_INTENT_NO_TEXT_INPUT
+} GdkModifierIntent;
+
+gboolean gdk_event_triggers_context_menu (const GdkEvent *event);
+GdkModifierType gdk_keymap_get_modifier_mask (GdkKeymap *keymap,
+ GdkModifierIntent intent);
+GdkModifierType gtk_widget_get_modifier_mask (GtkWidget *widget,
+ GdkModifierIntent intent);
#endif
#endif /* __GIMP_3_MIGRATION_H__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]