From 101fa5b640850b310eff5889f66df5bbe43b5fff Mon Sep 17 00:00:00 2001 From: Michael R Sweet Date: Thu, 5 Jun 2003 21:14:19 +0000 Subject: Fix mapping of Apple keys to CTRL keys on OSX. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@3022 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- src/Fl_Input.cxx | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'src/Fl_Input.cxx') diff --git a/src/Fl_Input.cxx b/src/Fl_Input.cxx index 285adf970..2200ed2b8 100644 --- a/src/Fl_Input.cxx +++ b/src/Fl_Input.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_Input.cxx,v 1.10.2.15.2.17 2003/01/30 21:41:57 easysw Exp $" +// "$Id: Fl_Input.cxx,v 1.10.2.15.2.18 2003/06/05 21:14:18 easysw Exp $" // // Input widget for the Fast Light Tool Kit (FLTK). // @@ -29,6 +29,7 @@ // In theory you can replace this code with another subclass to change // the keybindings. +#include #include #include #include @@ -57,7 +58,7 @@ int Fl_Input::shift_up_down_position(int p) { // define it as 1 to prevent cursor movement from going to next field: #define NORMAL_INPUT_MOVE 0 -#define ctrl(x) (x^0x40) +#define ctrl(x) ((x)^0x40) int Fl_Input::handle_key() { @@ -150,7 +151,13 @@ int Fl_Input::handle_key() { case 'v' : case 'x' : case 'z' : - if (Fl::event_state(FL_META)) ascii = ctrl(Fl::event_key()); +// printf("'%c' (0x%02x) pressed with%s%s%s%s\n", ascii, ascii, +// Fl::event_state(FL_SHIFT) ? " FL_SHIFT" : "", +// Fl::event_state(FL_CTRL) ? " FL_CTRL" : "", +// Fl::event_state(FL_ALT) ? " FL_ALT" : "", +// Fl::event_state(FL_META) ? " FL_META" : ""); + if (Fl::event_state(FL_META)) ascii -= 0x60; +// printf("using '%c' (0x%02x)...\n", ascii, ascii); break; #endif // __APPLE__ } @@ -407,5 +414,5 @@ Fl_Input::Fl_Input(int X, int Y, int W, int H, const char *l) } // -// End of "$Id: Fl_Input.cxx,v 1.10.2.15.2.17 2003/01/30 21:41:57 easysw Exp $". +// End of "$Id: Fl_Input.cxx,v 1.10.2.15.2.18 2003/06/05 21:14:18 easysw Exp $". // -- cgit v1.2.3