summaryrefslogtreecommitdiff
path: root/src/Fl_System_Driver.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_System_Driver.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_System_Driver.cxx')
-rw-r--r--src/Fl_System_Driver.cxx46
1 files changed, 45 insertions, 1 deletions
diff --git a/src/Fl_System_Driver.cxx b/src/Fl_System_Driver.cxx
index c396c9e2f..d5763cb01 100644
--- a/src/Fl_System_Driver.cxx
+++ b/src/Fl_System_Driver.cxx
@@ -36,12 +36,56 @@ const int Fl_System_Driver::fl_YValue = 0x0002;
const int Fl_System_Driver::fl_XNegative = 0x0010;
const int Fl_System_Driver::fl_YNegative = 0x0020;
+// This default key table is used for all system drivers that don't define
+// and/or use their own table. It is defined here "static" and assigned
+// in the constructor to avoid static initialization race conditions.
+//
+// As of June 2018 these platforms are Windows and Android. X11 does not
+// use a key table at all.
+// Platforms that use their own key tables must assign them in their
+// constructors (which overwrites the pointer and size).
+
+static Fl_System_Driver::Keyname default_key_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"}
+};
Fl_System_Driver::Fl_System_Driver()
{
+ // initialize default key table (used in fl_shortcut.cxx)
+ key_table = default_key_table;
+ key_table_size = sizeof(default_key_table)/sizeof(*default_key_table);
}
-
Fl_System_Driver::~Fl_System_Driver()
{
}