summaryrefslogtreecommitdiff
path: root/src/fl_shortcut.cxx
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/fl_shortcut.cxx
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/fl_shortcut.cxx')
-rw-r--r--src/fl_shortcut.cxx113
1 files changed, 5 insertions, 108 deletions
diff --git a/src/fl_shortcut.cxx b/src/fl_shortcut.cxx
index 56e752c15..93c618257 100644
--- a/src/fl_shortcut.cxx
+++ b/src/fl_shortcut.cxx
@@ -32,7 +32,6 @@
// This allows punctuation shortcuts like "#" to work (rather than
// calling it "shift+3" on a US keyboard)
-#include "config_lib.h"
#include <FL/Fl.H>
#include <FL/Fl_Widget.H>
#include <FL/Fl_Button.H>
@@ -373,108 +372,6 @@ int Fl_Widget::test_shortcut() {
return test_shortcut(label());
}
-#if defined(FL_CFG_GFX_GDI) || defined(FL_PORTING) || defined(__ANDROID__)
-// This table must be in numeric order by fltk (X) keysym number:
-Fl_System_Driver::Keyname Fl_System_Driver::table[] = {
- {' ', "Space"},
- {FL_BackSpace, "Backspace"},
- {FL_Tab, "Tab"},
- {0xff0b/*XK_Clear*/, "Clear"},
- {FL_Enter, "Enter"}, // X says "Enter"
- {FL_Pause, "Pause"},
- {FL_Scroll_Lock, "Scroll_Lock"},
- {FL_Escape, "Escape"},
- {FL_Home, "Home"},
- {FL_Left, "Left"},
- {FL_Up, "Up"},
- {FL_Right, "Right"},
- {FL_Down, "Down"},
- {FL_Page_Up, "Page_Up"}, // X says "Prior"
- {FL_Page_Down, "Page_Down"}, // X says "Next"
- {FL_End, "End"},
- {FL_Print, "Print"},
- {FL_Insert, "Insert"},
- {FL_Menu, "Menu"},
- {FL_Num_Lock, "Num_Lock"},
- {FL_KP_Enter, "KP_Enter"},
- {FL_Shift_L, "Shift_L"},
- {FL_Shift_R, "Shift_R"},
- {FL_Control_L, "Control_L"},
- {FL_Control_R, "Control_R"},
- {FL_Caps_Lock, "Caps_Lock"},
- {FL_Meta_L, "Meta_L"},
- {FL_Meta_R, "Meta_R"},
- {FL_Alt_L, "Alt_L"},
- {FL_Alt_R, "Alt_R"},
- {FL_Delete, "Delete"}
-};
-#endif
-
-#if defined(FL_CFG_GFX_QUARTZ)
-// This table must be in numeric order by fltk (X) keysym number:
-Fl_System_Driver::Keyname Fl_System_Driver::table[] = {
- // v - this column may contain UTF-8 characters
- {' ', "Space"},
- {FL_BackSpace, "\xe2\x8c\xab"}, // erase to the left
- {FL_Tab, "\xe2\x87\xa5"}, // rightwards arrow to bar
- {0xff0b, "\xe2\x8c\xa6"}, // erase to the right
- {FL_Enter, "\xe2\x86\xa9"}, // leftwards arrow with hook
- {FL_Pause, "Pause"},
- {FL_Scroll_Lock, "Scroll_Lock"},
- {FL_Escape, "\xe2\x90\x9b"},
- {FL_Home, "\xe2\x86\x96"}, // north west arrow
- {FL_Left, "\xe2\x86\x90"}, // leftwards arrow
- {FL_Up, "\xe2\x86\x91"}, // upwards arrow
- {FL_Right, "\xe2\x86\x92"}, // rightwards arrow
- {FL_Down, "\xe2\x86\x93"}, // downwards arrow
- {FL_Page_Up, "\xe2\x87\x9e"}, // upwards arrow with double stroke
- {FL_Page_Down, "\xe2\x87\x9f"}, // downwards arrow with double stroke
- {FL_End, "\xe2\x86\x98"}, // south east arrow
- {FL_Print, "Print"},
- {FL_Insert, "Insert"},
- {FL_Menu, "Menu"},
- {FL_Num_Lock, "Num_Lock"},
- {FL_KP_Enter, "\xe2\x8c\xa4"}, // up arrow head between two horizontal bars
- {FL_Shift_L, "Shift_L"},
- {FL_Shift_R, "Shift_R"},
- {FL_Control_L, "Control_L"},
- {FL_Control_R, "Control_R"},
- {FL_Caps_Lock, "\xe2\x87\xaa"}, // upwards white arrow from bar
- {FL_Meta_L, "Meta_L"},
- {FL_Meta_R, "Meta_R"},
- {FL_Alt_L, "Alt_L"},
- {FL_Alt_R, "Alt_R"},
- {FL_Delete, "\xe2\x8c\xa7"} // x in a rectangle box
-};
-#endif
-
-#if defined(FL_CFG_GFX_XLIB) && !defined(FL_DOXYGEN)
-#include "drivers/X11/Fl_X11_System_Driver.H"
-#include <X11/Xlib.h>
-
-Fl_System_Driver::Keyname Fl_System_Driver::table[] = {};
-
-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
-
const char *Fl_System_Driver::shortcut_add_key_name(unsigned key, char *p, char *buf, const char **eom)
{
if (key >= FL_F && key <= FL_F_Last) {
@@ -484,20 +381,20 @@ const char *Fl_System_Driver::shortcut_add_key_name(unsigned key, char *p, char
} else {
// binary search the table for a match:
int a = 0;
- int b = sizeof(table)/sizeof(*table);
+ int b = key_table_size;
while (a < b) {
int c = (a+b)/2;
- if (table[c].key == key) {
+ if (key_table[c].key == key) {
if (p > buf) {
- strcpy(p,table[c].name);
+ strcpy(p,key_table[c].name);
return buf;
} else {
- const char *sp = table[c].name;
+ const char *sp = key_table[c].name;
if (eom) *eom = sp;
return sp;
}
}
- if (table[c].key < key) a = c+1;
+ if (key_table[c].key < key) a = c+1;
else b = c;
}
if (key >= FL_KP && key <= FL_KP_Last) {