summaryrefslogtreecommitdiff
path: root/src/drivers/X11
diff options
context:
space:
mode:
authorAlbrecht Schlosser <albrechts.fltk@online.de>2018-06-20 15:52:58 +0000
committerAlbrecht Schlosser <albrechts.fltk@online.de>2018-06-20 15:52:58 +0000
commitec0ac46aa869143be91b194e400bf700be9fc558 (patch)
treedec6c63f1902382ed7f66e74073eda9da5b5296f /src/drivers/X11
parent0a6ebfea9dd7c0feecbc590679588f5088fd6f58 (diff)
Move platform specific shortcut code to platform drivers.
Tested on Windows and Linux (not tested on MacOS/Android). git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12951 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/drivers/X11')
-rw-r--r--src/drivers/X11/Fl_X11_System_Driver.H8
-rw-r--r--src/drivers/X11/Fl_X11_System_Driver.cxx24
2 files changed, 30 insertions, 2 deletions
diff --git a/src/drivers/X11/Fl_X11_System_Driver.H b/src/drivers/X11/Fl_X11_System_Driver.H
index 1f24ff511..b7d6e9ff7 100644
--- a/src/drivers/X11/Fl_X11_System_Driver.H
+++ b/src/drivers/X11/Fl_X11_System_Driver.H
@@ -4,7 +4,7 @@
// Definition of Posix system driver
// for the Fast Light Tool Kit (FLTK).
//
-// Copyright 2010-2016 by Bill Spitzak and others.
+// Copyright 2010-2018 by Bill Spitzak and others.
//
// This library is free software. Distribution and use rights are outlined in
// the file "COPYING" which should have been included with this file. If this
@@ -24,7 +24,11 @@
class Fl_X11_System_Driver : public Fl_Posix_System_Driver {
public:
- Fl_X11_System_Driver() : Fl_Posix_System_Driver() {}
+ Fl_X11_System_Driver() : Fl_Posix_System_Driver() {
+ // X11 system driver does not use a key table
+ key_table = NULL;
+ key_table_size = 0;
+ }
virtual void display_arg(const char *arg);
virtual int XParseGeometry(const char*, int*, int*, unsigned int*, unsigned int*);
virtual int clocale_printf(FILE *output, const char *format, va_list args);
diff --git a/src/drivers/X11/Fl_X11_System_Driver.cxx b/src/drivers/X11/Fl_X11_System_Driver.cxx
index 491e08226..42d403299 100644
--- a/src/drivers/X11/Fl_X11_System_Driver.cxx
+++ b/src/drivers/X11/Fl_X11_System_Driver.cxx
@@ -517,6 +517,30 @@ int Fl_X11_System_Driver::utf8locale() {
return ret;
}
+#if !defined(FL_DOXYGEN)
+
+const char *Fl_X11_System_Driver::shortcut_add_key_name(unsigned key, char *p, char *buf, const char **eom)
+{
+ const char* q;
+ if (key == FL_Enter || key == '\r') q = "Enter"; // don't use Xlib's "Return":
+ else if (key > 32 && key < 0x100) q = 0;
+ else q = XKeysymToString(key);
+ if (!q) {
+ p += fl_utf8encode(fl_toupper(key), p);
+ *p = 0;
+ return buf;
+ }
+ if (p > buf) {
+ strcpy(p,q);
+ return buf;
+ } else {
+ if (eom) *eom = q;
+ return q;
+ }
+}
+
+#endif // !defined(FL_DOXYGEN)
+
//
// End of "$Id$".
//