aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRobin Haberkorn <robin.haberkorn@googlemail.com>2015-07-14 01:09:34 +0200
committerRobin Haberkorn <robin.haberkorn@googlemail.com>2015-07-14 01:09:34 +0200
commitc39b54543c81fefdf30a67caac9a86f9f8ecd215 (patch)
tree66b3e54cd5b47ea5cee61add8aaba9cbf56f434e
parentc77101ce15d3d09ed7f257eea9c8bfa456a725c4 (diff)
downloadsciteco-c39b54543c81fefdf30a67caac9a86f9f8ecd215.tar.gz
support the CLOSE function key in PDCurses/win32a
in other words, PDCurses/win32a now has programmable window-close behaviour.
-rw-r--r--src/interface-curses.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/interface-curses.cpp b/src/interface-curses.cpp
index 47f26b8..c388f93 100644
--- a/src/interface-curses.cpp
+++ b/src/interface-curses.cpp
@@ -108,6 +108,13 @@ extern "C" {
*/
#ifdef PDCURSES_WIN32A
int PDC_set_function_key(const unsigned function, const int new_key);
+
+#define N_FUNCTION_KEYS 5
+#define FUNCTION_KEY_SHUT_DOWN 0
+#define FUNCTION_KEY_PASTE 1
+#define FUNCTION_KEY_ENLARGE_FONT 2
+#define FUNCTION_KEY_SHRINK_FONT 3
+#define FUNCTION_KEY_CHOOSE_FONT 4
#endif
static void scintilla_notify(Scintilla *sci, int idFrom,
@@ -394,8 +401,15 @@ InterfaceCurses::init_interactive(void)
* NOTE: This could also be used to assign
* a "shutdown" key when program termination is requested.
*/
- for (int i = 0; i < 5; i++)
+ for (int i = 0; i < N_FUNCTION_KEYS; i++)
PDC_set_function_key(i, 0);
+
+ /*
+ * Register the special shutdown function with the
+ * CLOSE key, so closing the window behaves similar as on
+ * GTK+.
+ */
+ PDC_set_function_key(FUNCTION_KEY_SHUT_DOWN, KEY_CLOSE);
#endif
/* for displaying UTF-8 characters properly */