Skip to content

Commit

Permalink
Removed FLTK compose system for MSWindows. This should leave keyboard…
Browse files Browse the repository at this point in the history
… control to the OS instead of having something FLTK specific on top. I can't fully test this because I have merely a U.S. keyboard, but dad keys still seem to work... .

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@7876 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
  • Loading branch information
Matthias Melcher committed Nov 18, 2010
1 parent faed6e5 commit cbc29a7
Showing 1 changed file with 3 additions and 49 deletions.
52 changes: 3 additions & 49 deletions src/Fl_compose.cxx
Expand Up @@ -28,16 +28,8 @@
#include <FL/Fl.H>
#include <FL/x.H>

//
// MRS: Uncomment the following define to get the original (pre-1.1.2)
// dead key support code. The original code apparently did not
// work on Belgian keyboards.
//

//#define OLD_DEAD_KEY_CODE


#ifndef __APPLE__
#if !defined(__APPLE__) && !defined(WIN32)

static const char* const compose_pairs =
"=E _'f _\"..+ ++^ %%^S< OE ^Z ^''^^\"\"^-*- --~ TM^s> oe ^z:Y"
Expand All @@ -47,38 +39,11 @@ static const char* const compose_pairs =

#endif

#if !defined(WIN32) && defined(OLD_DEAD_KEY_CODE) // X only
// X dead-key lookup table. This turns a dead-key keysym into the
// first of two characters for one of the compose sequences. These
// keysyms start at 0xFE50.
// Win32 handles the dead keys before FLTK can see them. This is
// unfortunate, because you don't get the preview effect.
static char dead_keys[] = {
'`', // XK_dead_grave
'\'', // XK_dead_acute
'^', // XK_dead_circumflex
'~', // XK_dead_tilde
'_', // XK_dead_macron
0, // XK_dead_breve
'.', // XK_dead_abovedot
':', // XK_dead_diaeresis
'*', // XK_dead_abovering
0, // XK_dead_doubleacute
'v', // XK_dead_caron
',' // XK_dead_cedilla
// 0, // XK_dead_ogonek
// 0, // XK_dead_iota
// 0, // XK_dead_voiced_sound
// 0, // XK_dead_semivoiced_sound
// 0 // XK_dead_belowdot
};
#endif // !WIN32 && OLD_DEAD_KEY_CODE

#ifndef FL_DOXYGEN
int Fl::compose_state = 0;
#endif

#ifdef __APPLE__
#if defined(__APPLE__) || defined(WIN32)
// 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 ||
Expand Down Expand Up @@ -196,38 +161,27 @@ int Fl::compose(int& del) {
return 1;
}

#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) {
# ifdef OLD_DEAD_KEY_CODE
ascii = dead_keys[i-0xfe50];
for (const char *p = compose_pairs; *p; p += 2)
if (p[0] == ascii) {
compose_state = ascii;
return 1;
}
# else
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;
}
# endif // OLD_DEAD_KEY_CODE
compose_state = 0;
return 1;
}
#endif

// Only insert non-control characters:
if (e_length && (ascii & ~31 && ascii!=127)) {compose_state = 0; return 1;}

return 0;
}

#endif // __APPLE__
#endif // __APPLE__ || WIN32

//
// End of "$Id$"
Expand Down

0 comments on commit cbc29a7

Please sign in to comment.