summaryrefslogtreecommitdiff
path: root/src/Fl_compose.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'src/Fl_compose.cxx')
-rw-r--r--src/Fl_compose.cxx67
1 files changed, 26 insertions, 41 deletions
diff --git a/src/Fl_compose.cxx b/src/Fl_compose.cxx
index 3f2ff0bae..1601c74dd 100644
--- a/src/Fl_compose.cxx
+++ b/src/Fl_compose.cxx
@@ -37,14 +37,7 @@
//#define OLD_DEAD_KEY_CODE
-#ifdef __APPLE__
-
-static const char* const compose_pairs =
-" ! % # $ y=| & : c a <<~ - r _ * +-2 3 ' u p . , 1 o >>141234? "//00A0 ...
-"`A'A^A~A:A*AAE,C`E'E^E:E`I'I^I:I-D~N`O'O^O~O:Ox O/`U'U^U:U'YTHss" //00C0 ...
-"`a'a^a~a:a*aae,c`e'e^e:e`i'i^i:i-d~n`o'o^o~o:o-:o/`u'u^u:u'yth:y";//00E0 ...
-
-#else
+#ifndef __APPLE__
static const char* const compose_pairs =
"=E _'f _\"..+ ++^ %%^S< OE ^Z ^''^^\"\"^-*- --~ TM^s> oe ^z:Y"
@@ -85,6 +78,26 @@ static char dead_keys[] = {
int Fl::compose_state = 0;
#endif
+#ifdef __APPLE__
+// under Mac OS X character composition is handled by the OS
+int Fl::compose(int& del) {
+ 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) {
+ del = 0;
+ return 0;
+ }
+ if(Fl::compose_state) {
+ del = 1;
+ Fl::compose_state = 0;
+ }
+ else {
+ del = 0;
+ }
+ return 1;
+}
+
+#else
+
/** Any text editing widget should call this for each FL_KEYBOARD event.
Use of this function is very simple.
@@ -114,11 +127,7 @@ int Fl::compose(int& del) {
//
// OSX users sometimes need to hold down ALT for keys, so we only check
// for META on OSX...
-#ifdef __APPLE__
- if ((e_state & FL_META) && !(ascii & 128)) return 0;
-#else
if ((e_state & (FL_ALT|FL_META)) && !(ascii & 128)) return 0;
-#endif // __APPLE__
if (compose_state == 1) { // after the compose key
if ( // do not get distracted by any modifier keys
@@ -134,15 +143,9 @@ int Fl::compose(int& del) {
) return 0;
if (ascii == ' ') { // space turns into nbsp
-#ifdef __APPLE__
- int len = fl_utf8encode(0xCA, e_text);
- e_text[len] = '\0';
- e_length = len;
- #else
int len = fl_utf8encode(0xA0, e_text);
e_text[len] = '\0';
e_length = len;
-#endif
compose_state = 0;
return 1;
} else if (ascii < ' ' || ascii == 127) {
@@ -171,19 +174,6 @@ int Fl::compose(int& del) {
} else if (compose_state) { // second character of compose
char c1 = char(compose_state); // retrieve first character
-#ifdef __APPLE__
- if ( (c1==0x60 && ascii==0xab) || (c1==0x27 && ascii==0x60)) {
- del = 1;
- compose_state = '^';
- e_text[0] = 0xf6;
- return 1;
- }
- if (ascii==' ') {
- del = 0;
- compose_state = 0;
- return 0;
- }
-#endif
// 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) {
@@ -206,16 +196,7 @@ int Fl::compose(int& del) {
return 1;
}
-#ifdef WIN32
-#elif (defined __APPLE__)
- if (e_state & 0x40000000) {
- if (ascii<0x80)
- compose_state = ascii;
- else
- compose_state = compose_pairs[(ascii-0x80)*2];
- return 1;
- }
-#else
+#ifndef WIN32
// See if they typed a dead key. This gets it into the same state as
// typing prefix+accent:
if (i >= 0xfe50 && i <= 0xfe5b) {
@@ -246,5 +227,9 @@ int Fl::compose(int& del) {
return 0;
}
+#endif // __APPLE__
+//
+// End of "$Id$"
+//