diff options
| author | nyamatongwe <nyamatongwe@gmail.com> | 2013-11-03 14:34:21 +1100 |
|---|---|---|
| committer | nyamatongwe <nyamatongwe@gmail.com> | 2013-11-03 14:34:21 +1100 |
| commit | edabc90ae2ee00c465d9326027e82c293900a864 (patch) | |
| tree | 649db40f260d2d7a7977d4b7507c321cdf70b941 /gtk/ScintillaGTK.cxx | |
| parent | ad86456bdec4429bee3d198baf4ec35cf3b50ae4 (diff) | |
| download | scintilla-mirror-edabc90ae2ee00c465d9326027e82c293900a864.tar.gz | |
Report control key as SCI_META for mouse down events for GTK+ on OS X.
Also enables more flexibility with modifier keys.
Diffstat (limited to 'gtk/ScintillaGTK.cxx')
| -rw-r--r-- | gtk/ScintillaGTK.cxx | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/gtk/ScintillaGTK.cxx b/gtk/ScintillaGTK.cxx index 91c1250fc..94c207c47 100644 --- a/gtk/ScintillaGTK.cxx +++ b/gtk/ScintillaGTK.cxx @@ -1769,17 +1769,23 @@ gint ScintillaGTK::PressThis(GdkEventButton *event) { return FALSE; } + bool shift = (event->state & GDK_SHIFT_MASK) != 0; bool ctrl = (event->state & GDK_CONTROL_MASK) != 0; + // On X, instead of sending literal modifiers use the user specified + // modifier, defaulting to control instead of alt. + // This is because most X window managers grab alt + click for moving + bool alt = (event->state & modifierTranslated(rectangularSelectionModifier)) != 0; + bool meta = false; gtk_widget_grab_focus(PWidget(wMain)); if (event->button == 1) { - // On X, instead of sending literal modifiers use the user specified - // modifier, defaulting to control instead of alt. - // This is because most X window managers grab alt + click for moving - ButtonDown(pt, event->time, - (event->state & GDK_SHIFT_MASK) != 0, - (event->state & GDK_CONTROL_MASK) != 0, - (event->state & modifierTranslated(rectangularSelectionModifier)) != 0); +#if PLAT_GTK_MACOSX + meta = ctrl; + // GDK reports the Command modifer key as GDK_MOD2_MASK for button events, + // not GDK_META_MASK like in key events. + ctrl = (event->state & GDK_MOD2_MASK) != 0; +#endif + ButtonDownWithModifiers(pt, event->time, ModifierFlags(shift, ctrl, alt, meta)); } else if (event->button == 2) { // Grab the primary selection if it exists SelectionPosition pos = SPositionFromLocation(pt, false, false, UserVirtualSpace()); |
