diff options
Diffstat (limited to 'src/Fl_Input.cxx')
| -rw-r--r-- | src/Fl_Input.cxx | 151 |
1 files changed, 5 insertions, 146 deletions
diff --git a/src/Fl_Input.cxx b/src/Fl_Input.cxx index 87f9df764..d6b8b3886 100644 --- a/src/Fl_Input.cxx +++ b/src/Fl_Input.cxx @@ -22,13 +22,6 @@ // In theory you can replace this code with another subclass to change // the keybindings. -#if defined(WIN32) || defined(__APPLE__) // PORTME: platform text editor look and feel -#elif defined(FL_PORTING) -# pragma message "FL_PORTING: implement text input specifics here" - // current custom code is for OS X keybaord specifics only -#else -#endif - #include <stdio.h> #include <stdlib.h> #include <FL/Fl.H> @@ -389,6 +382,11 @@ int Fl_Input::handle_key() { // // Example: (NP,WP,!WO) means supported in notepad + wordpad, but NOT word. // + + // handle keypresses that can have a platform-dependent processing + int retval = Fl::screen_driver()->input_widget_handle_key(Fl::event_key(), mods, shift, this); + if (retval >= 0) return retval; + switch (Fl::event_key()) { case FL_Insert: @@ -400,143 +398,6 @@ int Fl_Input::handle_key() { if (mods==FL_CTRL) return kf_copy(); // Ctrl-Insert (WP,NP,WOW,GE,KE,OF) return 0; // ignore other combos, pass to parent - case FL_Delete: { -#ifdef __APPLE__ // platform text editor look and feel - if (mods==0) return kf_delete_char_right(); // Delete (OSX-HIG,TE,SA,WOX) - if (mods==FL_CTRL) return kf_delete_char_right(); // Ctrl-Delete (??? TE,!SA,!WOX) - if (mods==FL_ALT) return kf_delete_word_right(); // Alt-Delete (OSX-HIG,TE,SA) - return 0; // ignore other combos, pass to parent -#else - int selected = (position() != mark()) ? 1 : 0; - if (mods==0 && shift && selected) - return kf_copy_cut(); // Shift-Delete with selection (WP,NP,WOW,GE,KE,OF) - if (mods==0 && shift && !selected) - return kf_delete_char_right(); // Shift-Delete no selection (WP,NP,WOW,GE,KE,!OF) - if (mods==0) return kf_delete_char_right(); // Delete (Standard) - if (mods==FL_CTRL) return kf_delete_word_right(); // Ctrl-Delete (WP,!NP,WOW,GE,KE,!OF) - return 0; // ignore other combos, pass to parent -#endif - } - - case FL_Left: -#ifdef __APPLE__ // platform text editor look and feel - if (mods==0) return kf_move_char_left(); // Left (OSX-HIG) - if (mods==FL_ALT) return kf_move_word_left(); // Alt-Left (OSX-HIG) - if (mods==FL_META) return kf_move_sol(); // Meta-Left (OSX-HIG) - if (mods==FL_CTRL) return kf_move_sol(); // Ctrl-Left (TE/SA) - return 0; // ignore other combos, pass to parent -#else - if (mods==0) return kf_move_char_left(); // Left (WP,NP,WOW,GE,KE,OF) - if (mods==FL_CTRL) return kf_move_word_left(); // Ctrl-Left (WP,NP,WOW,GE,KE,!OF) - if (mods==FL_META) return kf_move_char_left(); // Meta-Left (WP,NP,?WOW,GE,KE) - return 0; // ignore other combos, pass to parent -#endif - - case FL_Right: -#ifdef __APPLE__ // platform text editor look and feel - if (mods==0) return kf_move_char_right(); // Right (OSX-HIG) - if (mods==FL_ALT) return kf_move_word_right(); // Alt-Right (OSX-HIG) - if (mods==FL_META) return kf_move_eol(); // Meta-Right (OSX-HIG) - if (mods==FL_CTRL) return kf_move_eol(); // Ctrl-Right (TE/SA) - return 0; // ignore other combos, pass to parent -#else - if (mods==0) return kf_move_char_right(); // Right (WP,NP,WOW,GE,KE,OF) - if (mods==FL_CTRL) return kf_move_word_right(); // Ctrl-Right (WP,NP,WOW,GE,KE,!OF) - if (mods==FL_META) return kf_move_char_right(); // Meta-Right (WP,NP,?WOW,GE,KE,!OF) - return 0; // ignore other combos, pass to parent -#endif - - case FL_Up: -#ifdef __APPLE__ // platform text editor look and feel - if (mods==0) return kf_lines_up(1); // Up (OSX-HIG) - if (mods==FL_CTRL) return kf_page_up(); // Ctrl-Up (TE !HIG) - if (mods==FL_ALT) return kf_move_up_and_sol(); // Alt-Up (OSX-HIG) - if (mods==FL_META) return kf_top(); // Meta-Up (OSX-HIG) - return 0; // ignore other combos, pass to parent -#else - if (mods==0) return kf_lines_up(1); // Up (WP,NP,WOW,GE,KE,OF) - if (mods==FL_CTRL) return kf_move_up_and_sol(); // Ctrl-Up (WP,!NP,WOW,GE,!KE,OF) - return 0; // ignore other combos, pass to parent -#endif - - case FL_Down: -#ifdef __APPLE__ // platform text editor look and feel - if (mods==0) return kf_lines_down(1); // Dn (OSX-HIG) - if (mods==FL_CTRL) return kf_page_down(); // Ctrl-Dn (TE !HIG) - if (mods==FL_ALT) return kf_move_down_and_eol(); // Alt-Dn (OSX-HIG) - if (mods==FL_META) return kf_bottom(); // Meta-Dn (OSX-HIG) - return 0; // ignore other combos, pass to parent -#else - if (mods==0) return kf_lines_down(1); // Dn (WP,NP,WOW,GE,KE,OF) - if (mods==FL_CTRL) return kf_move_down_and_eol(); // Ctrl-Down (WP,!NP,WOW,GE,!KE,OF) - return 0; // ignore other combos, pass to parent -#endif - - case FL_Page_Up: - // Fl_Input has no scroll control, so instead we move the cursor by one page - // OSX-HIG recommends Alt increase one semantic unit, Meta next higher.. -#ifdef __APPLE__ // platform text editor look and feel - if (mods==0) return kf_page_up(); // PgUp (OSX-HIG) - if (mods==FL_ALT) return kf_page_up(); // Alt-PageUp (OSX-HIG) - if (mods==FL_META) return kf_top(); // Meta-PageUp (OSX-HIG,!TE) - return 0; // ignore other combos, pass to parent -#else - if (mods==0) return kf_page_up(); // PageUp (WP,NP,WOW,GE,KE) - if (mods==FL_CTRL) return kf_page_up(); // Ctrl-PageUp (!WP,!NP,!WOW,!GE,KE,OF) - if (mods==FL_ALT) return kf_page_up(); // Alt-PageUp (!WP,!NP,!WOW,!GE,KE,OF) - return 0; // ignore other combos, pass to parent -#endif - - case FL_Page_Down: -#ifdef __APPLE__ // platform text editor look and feel - // Fl_Input has no scroll control, so instead we move the cursor by one page - // OSX-HIG recommends Alt increase one semantic unit, Meta next higher.. - if (mods==0) return kf_page_down(); // PgDn (OSX-HIG) - if (mods==FL_ALT) return kf_page_down(); // Alt-PageDn (OSX-HIG) - if (mods==FL_META) return kf_bottom(); // Meta-PageDn (OSX-HIG,!TE) - return 0; // ignore other combos, pass to parent -#else - if (mods==0) return kf_page_down(); // PageDn (WP,NP,WOW,GE,KE) - if (mods==FL_CTRL) return kf_page_down(); // Ctrl-PageDn (!WP,!NP,!WOW,!GE,KE,OF) - if (mods==FL_ALT) return kf_page_down(); // Alt-PageDn (!WP,!NP,!WOW,!GE,KE,OF) - return 0; // ignore other combos, pass to parent -#endif - - case FL_Home: -#ifdef __APPLE__ // platform text editor look and feel - if (mods==0) return kf_top(); // Home (OSX-HIG) - if (mods==FL_ALT) return kf_top(); // Alt-Home (???) - return 0; // ignore other combos, pass to parent -#else - if (mods==0) return kf_move_sol(); // Home (WP,NP,WOW,GE,KE,OF) - if (mods==FL_CTRL) return kf_top(); // Ctrl-Home (WP,NP,WOW,GE,KE,OF) - return 0; // ignore other combos, pass to parent -#endif - - case FL_End: -#ifdef __APPLE__ // platform text editor look and feel - if (mods==0) return kf_bottom(); // End (OSX-HIG) - if (mods==FL_ALT) return kf_bottom(); // Alt-End (???) - return 0; // ignore other combos, pass to parent -#else - if (mods==0) return kf_move_eol(); // End (WP,NP,WOW,GE,KE,OF) - if (mods==FL_CTRL) return kf_bottom(); // Ctrl-End (WP,NP,WOW,GE,KE,OF) - return 0; // ignore other combos, pass to parent -#endif - - case FL_BackSpace: -#ifdef __APPLE__ // platform text editor look and feel - if (mods==0) return kf_delete_char_left(); // Backspace (OSX-HIG) - if (mods==FL_CTRL) return kf_delete_char_left(); // Ctrl-Backspace (TE/SA) - if (mods==FL_ALT) return kf_delete_word_left(); // Alt-Backspace (OSX-HIG) - if (mods==FL_META) return kf_delete_sol(); // Meta-Backspace (OSX-HIG,!TE) - return 0; // ignore other combos, pass to parent -#else - if (mods==0) return kf_delete_char_left(); // Backspace (WP,NP,WOW,GE,KE,OF) - if (mods==FL_CTRL) return kf_delete_word_left(); // Ctrl-Backspace (WP,!NP,WOW,GE,KE,!OF) - return 0; // ignore other combos, pass to parent -#endif - case FL_Enter: case FL_KP_Enter: if (when() & FL_WHEN_ENTER_KEY) { @@ -748,9 +609,7 @@ int Fl_Input::handle(int event) { Fl::focus(dnd_save_focus); handle(FL_UNFOCUS); } -#if !(defined(__APPLE__) || defined(WIN32)) // PORTME: cursor Fl::first_window()->cursor(FL_CURSOR_MOVE); -#endif dnd_save_focus = NULL; return 1; |
