Skip to content

Commit

Permalink
[GtkNSView] Flip command mask between MOD1 and MOD2
Browse files Browse the repository at this point in the history
Flip them depending on gdk_quartz_get_fix_modifiers().
This is to fix Cmd keys in native embedded NSViews.

Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=13100
  • Loading branch information
bratsche committed Jan 3, 2016
1 parent 840b6c2 commit 10b93de
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion gtk/gtknsview.c
Expand Up @@ -726,9 +726,11 @@ gtk_ns_view_key_press (GtkWidget *widget,
NSWindow *ns_window = [ns_view->priv->view window];
NSResponder *responder = [ns_window firstResponder];

gint command_mask = gdk_quartz_get_fix_modifiers () ? GDK_MOD2_MASK : GDK_MOD1_MASK;

if ([responder isKindOfClass: [NSTextView class]] &&
(event->state & (GDK_SHIFT_MASK | GDK_CONTROL_MASK |
GDK_MOD1_MASK | GDK_MOD2_MASK)) == GDK_MOD2_MASK)
GDK_MOD1_MASK | GDK_MOD2_MASK)) == command_mask)
{
NSTextView *text_view = (NSTextView *) responder;
NSRange range = [text_view selectedRange];
Expand Down

0 comments on commit 10b93de

Please sign in to comment.