179 lines
5.9 KiB
Diff
179 lines
5.9 KiB
Diff
|
diff --git a/gdk/quartz/gdkevents-quartz.c b/gdk/quartz/gdkevents-quartz.c
|
||
|
index a8800f7..ec6a893 100644
|
||
|
--- a/gdk/quartz/gdkevents-quartz.c
|
||
|
+++ b/gdk/quartz/gdkevents-quartz.c
|
||
|
@@ -292,10 +292,19 @@ get_keyboard_modifiers_from_ns_flags (NSUInteger nsflags)
|
||
|
modifiers |= GDK_SHIFT_MASK;
|
||
|
if (nsflags & NSControlKeyMask)
|
||
|
modifiers |= GDK_CONTROL_MASK;
|
||
|
- if (nsflags & NSAlternateKeyMask)
|
||
|
- modifiers |= GDK_MOD1_MASK;
|
||
|
- if (nsflags & NSCommandKeyMask)
|
||
|
- modifiers |= GDK_MOD2_MASK;
|
||
|
+
|
||
|
+ if (gdk_quartz_get_fix_modifiers ())
|
||
|
+ {
|
||
|
+ if (nsflags & NSAlternateKeyMask)
|
||
|
+ modifiers |= GDK_MOD1_MASK;
|
||
|
+ if (nsflags & NSCommandKeyMask)
|
||
|
+ modifiers |= GDK_MOD2_MASK;
|
||
|
+ }
|
||
|
+ else
|
||
|
+ {
|
||
|
+ if (nsflags & NSCommandKeyMask)
|
||
|
+ modifiers |= GDK_MOD1_MASK;
|
||
|
+ }
|
||
|
|
||
|
return modifiers;
|
||
|
}
|
||
|
@@ -930,7 +939,7 @@ fill_key_event (GdkWindow *window,
|
||
|
{
|
||
|
case GDK_Meta_R:
|
||
|
case GDK_Meta_L:
|
||
|
- mask = GDK_MOD2_MASK;
|
||
|
+ mask = gdk_quartz_get_fix_modifiers () ? GDK_MOD2_MASK : GDK_MOD1_MASK;
|
||
|
break;
|
||
|
case GDK_Shift_R:
|
||
|
case GDK_Shift_L:
|
||
|
@@ -941,7 +950,7 @@ fill_key_event (GdkWindow *window,
|
||
|
break;
|
||
|
case GDK_Alt_R:
|
||
|
case GDK_Alt_L:
|
||
|
- mask = GDK_MOD1_MASK;
|
||
|
+ mask = gdk_quartz_get_fix_modifiers () ? GDK_MOD1_MASK : GDK_MOD2_MASK;
|
||
|
break;
|
||
|
case GDK_Control_R:
|
||
|
case GDK_Control_L:
|
||
|
@@ -1089,9 +1098,9 @@ _gdk_quartz_events_get_current_keyboard_modifiers (void)
|
||
|
if (carbon_modifiers & controlKey)
|
||
|
modifiers |= GDK_CONTROL_MASK;
|
||
|
if (carbon_modifiers & optionKey)
|
||
|
- modifiers |= GDK_MOD1_MASK;
|
||
|
+ modifiers |= (gdk_quartz_get_fix_modifiers () ? GDK_MOD1_MASK : GDK_MOD2_MASK);
|
||
|
if (carbon_modifiers & cmdKey)
|
||
|
- modifiers |= GDK_MOD2_MASK;
|
||
|
+ modifiers |= (gdk_quartz_get_fix_modifiers () ? GDK_MOD2_MASK : GDK_MOD1_MASK);
|
||
|
|
||
|
return modifiers;
|
||
|
}
|
||
|
diff --git a/gdk/quartz/gdkglobals-quartz.c b/gdk/quartz/gdkglobals-quartz.c
|
||
|
index 53c6d5e..31dbab1 100644
|
||
|
--- a/gdk/quartz/gdkglobals-quartz.c
|
||
|
+++ b/gdk/quartz/gdkglobals-quartz.c
|
||
|
@@ -41,3 +41,17 @@ gdk_quartz_osx_version (void)
|
||
|
else
|
||
|
return minor;
|
||
|
}
|
||
|
+
|
||
|
+static gboolean fix_modifiers = FALSE;
|
||
|
+
|
||
|
+void
|
||
|
+gdk_quartz_set_fix_modifiers (gboolean fix)
|
||
|
+{
|
||
|
+ fix_modifiers = fix;
|
||
|
+}
|
||
|
+
|
||
|
+gboolean
|
||
|
+gdk_quartz_get_fix_modifiers (void)
|
||
|
+{
|
||
|
+ return fix_modifiers;
|
||
|
+}
|
||
|
diff --git a/gdk/quartz/gdkkeys-quartz.c b/gdk/quartz/gdkkeys-quartz.c
|
||
|
index 19a20f5..c7ceec6 100644
|
||
|
--- a/gdk/quartz/gdkkeys-quartz.c
|
||
|
+++ b/gdk/quartz/gdkkeys-quartz.c
|
||
|
@@ -693,11 +693,11 @@ gdk_keymap_translate_keyboard_state (GdkKeymap *keymap,
|
||
|
for (bit = GDK_SHIFT_MASK; bit < GDK_BUTTON1_MASK; bit <<= 1)
|
||
|
{
|
||
|
if (translate_keysym (hardware_keycode,
|
||
|
- (bit == GDK_MOD1_MASK) ? 0 : group,
|
||
|
+ (bit == (gdk_quartz_get_fix_modifiers () ? GDK_MOD1_MASK : GDK_MOD2_MASK)) ? 0 : group,
|
||
|
state & ~bit,
|
||
|
NULL, NULL) !=
|
||
|
translate_keysym (hardware_keycode,
|
||
|
- (bit == GDK_MOD1_MASK) ? 1 : group,
|
||
|
+ (bit == (gdk_quartz_get_fix_modifiers () ? GDK_MOD1_MASK : GDK_MOD2_MASK)) ? 1 : group,
|
||
|
state | bit,
|
||
|
NULL, NULL))
|
||
|
tmp_modifiers |= bit;
|
||
|
@@ -718,16 +718,32 @@ void
|
||
|
gdk_keymap_add_virtual_modifiers (GdkKeymap *keymap,
|
||
|
GdkModifierType *state)
|
||
|
{
|
||
|
- if (*state & GDK_MOD2_MASK)
|
||
|
- *state |= GDK_META_MASK;
|
||
|
+ if (gdk_quartz_get_fix_modifiers ())
|
||
|
+ {
|
||
|
+ if (*state & GDK_MOD2_MASK)
|
||
|
+ *state |= GDK_META_MASK;
|
||
|
+ }
|
||
|
+ else
|
||
|
+ {
|
||
|
+ if (*state & GDK_MOD1_MASK)
|
||
|
+ *state |= GDK_META_MASK;
|
||
|
+ }
|
||
|
}
|
||
|
|
||
|
gboolean
|
||
|
gdk_keymap_map_virtual_modifiers (GdkKeymap *keymap,
|
||
|
GdkModifierType *state)
|
||
|
{
|
||
|
- if (*state & GDK_META_MASK)
|
||
|
- *state |= GDK_MOD2_MASK;
|
||
|
+ if (gdk_quartz_get_fix_modifiers ())
|
||
|
+ {
|
||
|
+ if (*state & GDK_META_MASK)
|
||
|
+ *state |= GDK_MOD2_MASK;
|
||
|
+ }
|
||
|
+ else
|
||
|
+ {
|
||
|
+ if (*state & GDK_META_MASK)
|
||
|
+ *state |= GDK_MOD1_MASK;
|
||
|
+ }
|
||
|
|
||
|
return TRUE;
|
||
|
}
|
||
|
diff --git a/gdk/quartz/gdkquartz.h b/gdk/quartz/gdkquartz.h
|
||
|
index 742d651..ed0ba35 100644
|
||
|
--- a/gdk/quartz/gdkquartz.h
|
||
|
+++ b/gdk/quartz/gdkquartz.h
|
||
|
@@ -58,6 +58,9 @@ id gdk_quartz_drag_context_get_dragging_info_libgtk_only (GdkDragContext
|
||
|
NSEvent *gdk_quartz_event_get_nsevent (GdkEvent *event);
|
||
|
GdkOSXVersion gdk_quartz_osx_version (void);
|
||
|
|
||
|
+void gdk_quartz_set_fix_modifiers (gboolean fix);
|
||
|
+gboolean gdk_quartz_get_fix_modifiers (void);
|
||
|
+
|
||
|
G_END_DECLS
|
||
|
|
||
|
#endif /* __GDK_QUARTZ_H__ */
|
||
|
diff --git a/gtk/gtkprivate.h b/gtk/gtkprivate.h
|
||
|
index 6386c32..aa1cc74 100644
|
||
|
--- a/gtk/gtkprivate.h
|
||
|
+++ b/gtk/gtkprivate.h
|
||
|
@@ -122,7 +122,7 @@ gboolean _gtk_fnmatch (const char *pattern,
|
||
|
#ifndef GDK_WINDOWING_QUARTZ
|
||
|
#define GTK_NO_TEXT_INPUT_MOD_MASK (GDK_MOD1_MASK | GDK_CONTROL_MASK)
|
||
|
#else
|
||
|
-#define GTK_NO_TEXT_INPUT_MOD_MASK (GDK_MOD2_MASK | GDK_CONTROL_MASK)
|
||
|
+#define GTK_NO_TEXT_INPUT_MOD_MASK (gdk_quartz_get_fix_modifiers () ? (GDK_MOD2_MASK | GDK_CONTROL_MASK) : (GDK_MOD1_MASK | GDK_CONTROL_MASK))
|
||
|
#endif
|
||
|
|
||
|
#ifndef GDK_WINDOWING_QUARTZ
|
||
|
@@ -130,13 +130,13 @@ gboolean _gtk_fnmatch (const char *pattern,
|
||
|
#define GTK_MODIFY_SELECTION_MOD_MASK GDK_CONTROL_MASK
|
||
|
#else
|
||
|
#define GTK_EXTEND_SELECTION_MOD_MASK GDK_SHIFT_MASK
|
||
|
-#define GTK_MODIFY_SELECTION_MOD_MASK GDK_MOD2_MASK
|
||
|
+#define GTK_MODIFY_SELECTION_MOD_MASK (gdk_quartz_get_fix_modifiers () ? GDK_MOD2_MASK : GDK_MOD1_MASK)
|
||
|
#endif
|
||
|
|
||
|
#ifndef GDK_WINDOWING_QUARTZ
|
||
|
#define GTK_TOGGLE_GROUP_MOD_MASK 0
|
||
|
#else
|
||
|
-#define GTK_TOGGLE_GROUP_MOD_MASK GDK_MOD1_MASK
|
||
|
+#define GTK_TOGGLE_GROUP_MOD_MASK (gdk_quartz_get_fix_modifiers () ? GDK_MOD1_MASK : 0)
|
||
|
#endif
|
||
|
|
||
|
gboolean _gtk_button_event_triggers_context_menu (GdkEventButton *event);
|