From 0604389a02a2cb5f33f5f84e460ad3d7a55f1fc4 Mon Sep 17 00:00:00 2001
From: Neil
Date: Tue, 29 Mar 2016 15:38:45 +1100
Subject: Feature [feature-requests:#1142]. Allow Super modifier on GTK+.
---
doc/ScintillaDoc.html | 4 +++-
doc/ScintillaHistory.html | 5 +++++
gtk/ScintillaGTK.cxx | 8 +++-----
src/Editor.cxx | 5 +++--
src/Editor.h | 2 +-
src/KeyMap.h | 1 +
6 files changed, 16 insertions(+), 9 deletions(-)
diff --git a/doc/ScintillaDoc.html b/doc/ScintillaDoc.html
index b1b550fb0..f1e6c3a75 100644
--- a/doc/ScintillaDoc.html
+++ b/doc/ScintillaDoc.html
@@ -5042,9 +5042,11 @@ struct Sci_TextToFind {
SCK_WIN.
The modifiers are a combination of zero or more of SCMOD_ALT,
- SCMOD_CTRL, SCMOD_SHIFT, and SCMOD_META.
+ SCMOD_CTRL, SCMOD_SHIFT,
+ SCMOD_META, and SCMOD_SUPER.
On OS X, the Command key is mapped to SCMOD_CTRL and the Control key to
SCMOD_META.
+ SCMOD_SUPER is only available on GTK+ which is commonly the Windows key.
If you are building a table, you might
want to use SCMOD_NORM, which has the value 0, to mean no modifiers.
diff --git a/doc/ScintillaHistory.html b/doc/ScintillaHistory.html
index 71886307e..a3e725230 100644
--- a/doc/ScintillaHistory.html
+++ b/doc/ScintillaHistory.html
@@ -484,6 +484,7 @@
| Mark C |
Johannes Sasongko |
+ fstirlitz |
@@ -515,6 +516,10 @@
Bug #1822.
+ For GTK+, the Super modifier key can be used in key bindings.
+ Feature #1142.
+
+
SciTE bug fixed with exported HTML where extra line shown.
Bug #1816.
diff --git a/gtk/ScintillaGTK.cxx b/gtk/ScintillaGTK.cxx
index 25e160510..ad9aa6568 100644
--- a/gtk/ScintillaGTK.cxx
+++ b/gtk/ScintillaGTK.cxx
@@ -2192,6 +2192,7 @@ gboolean ScintillaGTK::KeyThis(GdkEventKey *event) {
bool shift = (event->state & GDK_SHIFT_MASK) != 0;
bool ctrl = (event->state & GDK_CONTROL_MASK) != 0;
bool alt = (event->state & GDK_MOD1_MASK) != 0;
+ bool super = (event->state & GDK_MOD4_MASK) != 0;
guint key = event->keyval;
if ((ctrl || alt) && (key < 128))
key = toupper(key);
@@ -2208,15 +2209,12 @@ gboolean ScintillaGTK::KeyThis(GdkEventKey *event) {
bool consumed = false;
#if !(PLAT_GTK_MACOSX)
- bool added = KeyDown(key, shift, ctrl, alt, &consumed) != 0;
+ bool meta = false;
#else
bool meta = ctrl;
ctrl = (event->state & GDK_META_MASK) != 0;
- bool added = KeyDownWithModifiers(key, (shift ? SCI_SHIFT : 0) |
- (ctrl ? SCI_CTRL : 0) |
- (alt ? SCI_ALT : 0) |
- (meta ? SCI_META : 0), &consumed) != 0;
#endif
+ bool added = KeyDownWithModifiers(key, ModifierFlags(shift, ctrl, alt, meta, super), &consumed) != 0;
if (!consumed)
consumed = added;
//fprintf(stderr, "SK-key: %d %x %x\n",event->keyval, event->state, consumed);
diff --git a/src/Editor.cxx b/src/Editor.cxx
index b480287c3..eddc0e623 100644
--- a/src/Editor.cxx
+++ b/src/Editor.cxx
@@ -2265,12 +2265,13 @@ void Editor::DelCharBack(bool allowLineStartDeletion) {
ShowCaretAtCurrentPosition();
}
-int Editor::ModifierFlags(bool shift, bool ctrl, bool alt, bool meta) {
+int Editor::ModifierFlags(bool shift, bool ctrl, bool alt, bool meta, bool super) {
return
(shift ? SCI_SHIFT : 0) |
(ctrl ? SCI_CTRL : 0) |
(alt ? SCI_ALT : 0) |
- (meta ? SCI_META : 0);
+ (meta ? SCI_META : 0) |
+ (super ? SCI_SUPER : 0);
}
void Editor::NotifyFocus(bool focus) {
diff --git a/src/Editor.h b/src/Editor.h
index 67aad42d7..9cc648e84 100644
--- a/src/Editor.h
+++ b/src/Editor.h
@@ -414,7 +414,7 @@ protected: // ScintillaBase subclass needs access to much of Editor
void DelCharBack(bool allowLineStartDeletion);
virtual void ClaimSelection() = 0;
- static int ModifierFlags(bool shift, bool ctrl, bool alt, bool meta=false);
+ static int ModifierFlags(bool shift, bool ctrl, bool alt, bool meta=false, bool super=false);
virtual void NotifyChange() = 0;
virtual void NotifyFocus(bool focus);
virtual void SetCtrlID(int identifier);
diff --git a/src/KeyMap.h b/src/KeyMap.h
index b102b356f..7c4f80720 100644
--- a/src/KeyMap.h
+++ b/src/KeyMap.h
@@ -17,6 +17,7 @@ namespace Scintilla {
#define SCI_CTRL SCMOD_CTRL
#define SCI_ALT SCMOD_ALT
#define SCI_META SCMOD_META
+#define SCI_SUPER SCMOD_SUPER
#define SCI_CSHIFT (SCI_CTRL | SCI_SHIFT)
#define SCI_ASHIFT (SCI_ALT | SCI_SHIFT)
--
cgit v1.2.3