From dcfdf8be20bff349c1a7a54d6b4d079d91bf540e Mon Sep 17 00:00:00 2001
From: Manolo Gouy
| Shift+move | Move the cursor but also extend the selection. |
| RightCtrl or
- Compose |
- \anchor Fl_Input_Compose_Character
- Start a compose-character
- sequence. The next one or two keys typed define the character to
- insert (see table that follows.)
-
- For instance, to type "á" type [compose][a]['] or [compose]['][a]. - - The character "nbsp" (non-breaking space) is typed by using - [compose][space]. - - The single-character sequences may be followed by a space if - necessary to remove ambiguity. For instance, if you really want to - type "ª~" rather than "ã" you must type [compose][a][space][~]. - - The same key may be used to "quote" control characters into the - text. If you need a ^Q character you can get one by typing - [compose][Control+Q]. - - X may have a key on the keyboard - defined as XK_Multi_key. If so this key may be used as well - as the right-hand control key. You can set this up with the program - xmodmap. - - If your keyboard is set to support a foreign language you should - also be able to type "dead key" prefix characters. On X you will - actually be able to see what dead key you typed, and if you then move - the cursor without completing the sequence the accent will remain - inserted. - - Under MSWindows or Mac OS X, character composition is done using - system-defined keystroke series. |
| Keys | Char | -Keys | Char | -Keys | Char | -Keys | Char | -Keys | Char | -Keys | Char | - -
|---|---|---|---|---|---|---|---|---|---|---|---|
| sp | nbsp | -* | ° | -` A | À | -D - | Ð | -` a | à | -d - | ð | -
| ! | ¡ | -+ - | ± | -' A | Á | -~ N | Ñ | -' a | á | -~ n | ñ | -
| % | ¢ | -2 | ² | -A ^ | Â | -` O | Ò | -^ a | â | -` o | ò | -
| # | £ | -3 | ³ | -~ A | Ã | -' O | Ó | -~ a | ã | -' o | ó | -
| $ | ¤ | -' | ´ | -: A | Ä | -^ O | Ô | -: a | ä | -^ o | ô | -
| y = | ¥ | -u | µ | -* A | Å | -~ O | Õ | -* a | å | -~ o | õ | -
| | | ¦ | -p | ¶ | -A E | Æ | -: O | Ö | -a e | æ | -: o | ö | -
| & | § | -. | · | -, C | Ç | -x | × | -, c | ç | -- : | ÷ | -
| : | ¨ | -, | ¸ | -E ` | È | -O / | Ø | -` e | è | -o / | ø | -
| c | © | -1 | ¹ | -' E | É | -` U | Ù | -' e | é | -` u | ù | -
| a | ª | -o | º | -^ E | Ê | -' U | Ú | -^ e | ê | -' u | ú | -
| < < | « | -> > | » | -: E | Ë | -^ U | Û | -: e | ë | -^ u | û | -
| ~ | ¬ | -1 4 | ¼ | -` I | Ì | -: U | Ü | -` i | ì | -: u | ü | -
| - | | -1 2 | ½ | -' I | Í | -' Y | Ý | -' i | í | -' y | ý | -
| r | ® | -3 4 | ¾ | -^ I | Î | -T H | Þ | -^ i | î | -t h | þ | -
| _ | ¯ | -? | ¿ | -: I | Ï | -s s | ß | -: i | ï | -: y | ÿ | -
If true is returned, then it has modified the + Fl::event_text() and Fl::event_length() to a set of bytes to + insert (it may be of zero length!). In will also set the "del" + parameter to the number of bytes to the left of the cursor to + delete, this is used to delete the results of the previous call to + Fl::compose(). + +
If false is returned, the keys should be treated as function + keys, and del is set to zero. You could insert the text anyways, if + you don't know what else to do. + +
Though the current implementation returns immediately, future + versions may take quite awhile, as they may pop up a window or do + other user-interface things to allow characters to be selected. + */ int Fl::compose(int& del) { + // character composition is now handled by the OS del = 0; -#ifdef WIN32 - unsigned char ascii = (unsigned)e_text[0]; - if ((e_state & (FL_ALT|FL_META)) && !(ascii & 128)) return 0; -#elif defined(__APPLE__) +#if defined(__APPLE__) // this stuff is to be treated as a function key if(Fl::e_length == 0 || Fl::e_keysym == FL_Enter || Fl::e_keysym == FL_KP_Enter || - Fl::e_keysym == FL_Tab || Fl::e_keysym == FL_Escape || Fl::e_state&FL_META || Fl::e_state&FL_CTRL ) { + Fl::e_keysym == FL_Tab || Fl::e_keysym == FL_Escape || Fl::e_state&(FL_META | FL_CTRL) ) { return 0; } +#else + unsigned char ascii = (unsigned)e_text[0]; + if ((e_state & (FL_ALT | FL_META)) && !(ascii & 128)) return 0; #endif if(Fl::compose_state) { del = 1; Fl::compose_state = 0; } else { -#ifdef WIN32 +#ifndef __APPLE__ // Only insert non-control characters: if (! (ascii & ~31 && ascii!=127)) { return 0; } #endif @@ -69,128 +76,6 @@ int Fl::compose(int& del) { return 1; } -#else - -/** Any text editing widget should call this for each FL_KEYBOARD event. - Use of this function is very simple. - -
If true is returned, then it has modified the - Fl::event_text() and Fl::event_length() to a set of bytes to - insert (it may be of zero length!). In will also set the "del" - parameter to the number of bytes to the left of the cursor to - delete, this is used to delete the results of the previous call to - Fl::compose(). - -
If false is returned, the keys should be treated as function - keys, and del is set to zero. You could insert the text anyways, if - you don't know what else to do. - -
Though the current implementation returns immediately, future - versions may take quite awhile, as they may pop up a window or do - other user-interface things to allow characters to be selected. -*/ -int Fl::compose(int& del) { - - del = 0; - unsigned char ascii = (unsigned)e_text[0]; - - // Alt+letters are reserved for shortcuts. But alt+foreign letters - // has to be allowed, because some key layouts require alt to be held - // down in order to type them... - // - // OSX users sometimes need to hold down ALT for keys, so we only check - // for META on OSX... - if ((e_state & (FL_ALT|FL_META)) && !(ascii & 128)) return 0; - - if (compose_state == 1) { // after the compose key - if ( // do not get distracted by any modifier keys - e_keysym==FL_Shift_L|| - e_keysym==FL_Shift_R || - e_keysym==FL_Alt_L || - e_keysym==FL_Alt_R || - e_keysym==FL_Meta_L || - e_keysym==FL_Meta_R || - e_keysym==FL_Control_R || - e_keysym==FL_Control_L || - e_keysym==FL_Menu - ) return 0; - - if (ascii == ' ') { // space turns into nbsp - int len = fl_utf8encode(0xA0, e_text); - e_text[len] = '\0'; - e_length = len; - compose_state = 0; - return 1; - } else if (ascii < ' ' || ascii == 127) { - compose_state = 0; - return 0; - } - - // see if it is either character of any pair: - for (const char *p = compose_pairs; *p; p += 2) - if (p[0] == ascii || p[1] == ascii) { - if (p[1] == ' ') { - int len = fl_utf8encode((p-compose_pairs)/2+0xA0, e_text); - e_text[len] = '\0'; - e_length = len; - } - - compose_state = ascii; - return 1; - } - - if (e_length) { // compose key also "quotes" control characters - compose_state = 0; - return 1; - } - - } else if (compose_state) { // second character of compose - - char c1 = char(compose_state); // retrieve first character - // now search for the pair in either order: - for (const char *p = compose_pairs; *p; p += 2) { - if ( (p[0] == ascii && p[1] == c1) || (p[1] == ascii && p[0] == c1)) { - int len = fl_utf8encode((p-compose_pairs)/2+0xA0, e_text); - e_text[len] = '\0'; - e_length = len; - del = 1; // delete the old character and insert new one - compose_state = 0; - return 1; - } - } - - } - - int i = e_keysym; - - // See if they type the compose prefix key: - if (i == FL_Control_R || i == 0xff20/* Multi-Key */) { - compose_state = 1; - return 1; - } - - // See if they typed a dead key. This gets it into the same state as - // typing prefix+accent: - if (i >= 0xfe50 && i <= 0xfe5b) { - ascii = e_text[0]; - for (const char *p = compose_pairs; *p; p += 2) - if (p[0] == ascii || - (p[1] == ' ' && (p - compose_pairs) / 2 + 0xA0 == ascii)) { - compose_state = p[0]; - return 1; - } - compose_state = 0; - return 1; - } - - // Only insert non-control characters: - if (e_length && (ascii & ~31 && ascii!=127)) {compose_state = 0; return 1;} - - return 0; -} - -#endif // __APPLE__ || WIN32 - // // End of "$Id$" // -- cgit v1.2.3