DO NOT REPLY TO THIS MESSAGE. INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.
[STR New]
Link: http://www.fltk.org/str.php?L2599
Version: 1.3-feature
Attached file "fltk-1_v3.3.x-dead-chars-x11.patch"...
Link: http://www.fltk.org/str.php?L2599
Version: 1.3-feature
diff -up fltk-1.3.x-r8592/FL/Enumerations.H.dead-x11
fltk-1.3.x-r8592/FL/Enumerations.H
--- fltk-1.3.x-r8592/FL/Enumerations.H.dead-x11 2011-04-14 15:11:34.000000000
+0200
+++ fltk-1.3.x-r8592/FL/Enumerations.H 2011-04-15 10:52:19.457097928 +0200
@@ -425,6 +425,25 @@ enum Fl_When { // Fl_Widget::when():
/*@}*/ // group: Event States
+/** \name Compose States
+
+ These constants define the state of character composition for the
+ current keyboard event.
+
+ \sa Fl::event_compose_state(), Fl::event_compose_symbol()
+*/
+
+/*@{*/
+
+enum Fl_Compose {
+ FL_COMPOSE_UNKNOWN = 0, ///< current compose status cannot be determined
+ FL_COMPOSE_NONE, ///< no composition active for this event
+ FL_COMPOSE_INTERMEDIATE, ///< the current event is part of a composition
but does not end it
+ FL_COMPOSE_FINAL, ///< a composed character has successfully been
construced
+};
+
+/*@}*/ // group: Compose States
+
/** \name Box Types
\brief FLTK standard box types
diff -up fltk-1.3.x-r8592/FL/Fl.H.dead-x11 fltk-1.3.x-r8592/FL/Fl.H
--- fltk-1.3.x-r8592/FL/Fl.H.dead-x11 2011-03-30 14:07:52.000000000 +0200
+++ fltk-1.3.x-r8592/FL/Fl.H 2011-04-15 10:52:19.458097922 +0200
@@ -133,6 +133,8 @@ public: // should be private!
static int e_keysym;
static char* e_text;
static int e_length;
+ static int e_compose_state;
+ static const char* e_compose_symbol;
static Fl_Event_Dispatch e_dispatch;
static Fl_Widget* belowmouse_;
static Fl_Widget* pushed_;
@@ -685,6 +687,9 @@ public:
*/
static int event_length() {return e_length;}
+ static int event_compose_state();
+ static const char* event_compose_symbol();
+
static int compose(int &del);
static void compose_reset();
static int event_inside(int,int,int,int);
diff -up fltk-1.3.x-r8592/src/Fl_compose.cxx.dead-x11
fltk-1.3.x-r8592/src/Fl_compose.cxx
--- fltk-1.3.x-r8592/src/Fl_compose.cxx.dead-x11 2011-04-01
11:00:07.000000000 +0200
+++ fltk-1.3.x-r8592/src/Fl_compose.cxx 2011-04-15 10:54:12.503442977 +0200
@@ -31,6 +31,8 @@
#ifndef FL_DOXYGEN
// at present, this is effectively used by Mac OS X only
int Fl::compose_state = 0;
+int Fl::e_compose_state = FL_COMPOSE_UNKNOWN;
+const char* Fl::e_compose_symbol = "";
#endif
#if !defined(WIN32) && !defined(__APPLE__)
@@ -94,6 +96,31 @@ void Fl::compose_reset()
#endif
}
+/**
+ Returns what role the current key press plays in constructing a composed
+ character.
+ \see Fl_Compose
+ */
+int Fl::event_compose_state()
+{
+ return e_compose_state;
+}
+
+/**
+ Returns the raw symbol associated with the current event. This will be
+ the same as what Fl::event_text() returns except when the compose state
+ is FL_COMPOSE_INTERMEDIATE or FL_COMPOSE_FINAL.
+ \see Fl_Compose
+ */
+const char* Fl::event_compose_symbol()
+{
+ if ((e_compose_state == FL_COMPOSE_INTERMEDIATE) ||
+ (e_compose_state == FL_COMPOSE_FINAL))
+ return e_compose_symbol;
+
+ return Fl::event_text();
+}
+
//
// End of "$Id: Fl_compose.cxx 8552 2011-04-01 09:00:07Z manolo $"
//
diff -up fltk-1.3.x-r8592/src/Fl_x.cxx.dead-x11 fltk-1.3.x-r8592/src/Fl_x.cxx
--- fltk-1.3.x-r8592/src/Fl_x.cxx.dead-x11 2011-02-26 15:14:50.000000000
+0100
+++ fltk-1.3.x-r8592/src/Fl_x.cxx 2011-04-15 10:52:19.460097911 +0200
@@ -35,6 +35,8 @@
/**** Define this if your keyboard lacks a backspace key... ****/
/* #define BACKSPACE_HACK 1 */
+# define XK_XKB_KEYS
+
# include <config.h>
# include <FL/Fl.H>
# include <FL/x.H>
@@ -50,6 +52,7 @@
# include <X11/Xmd.h>
# include <X11/Xlocale.h>
# include <X11/Xlib.h>
+# include <X11/keysymdef.h>
static Fl_Xlib_Graphics_Driver fl_xlib_driver;
static Fl_Display_Device fl_xlib_display(&fl_xlib_driver);
@@ -920,9 +923,6 @@ int fl_handle(const XEvent& thisevent)
#endif
}
- if ( XFilterEvent((XEvent *)&xevent, 0) )
- return(1);
-
switch (xevent.type) {
case KeymapNotify:
@@ -1217,9 +1217,11 @@ int fl_handle(const XEvent& thisevent)
case KeyRelease: {
KEYPRESS:
int keycode = xevent.xkey.keycode;
+ static int real_keycode;
fl_key_vector[keycode/8] |= (1 << (keycode%8));
static char *buffer = NULL;
static int buffer_len = 0;
+ static char *compose_buffer = NULL;
int len;
KeySym keysym;
if (buffer_len == 0) {
@@ -1230,6 +1232,12 @@ int fl_handle(const XEvent& thisevent)
event = FL_KEYDOWN;
int len = 0;
+ // keycode 0 is a fake key, so looking that up is pointless,
+ // instead we rely on the fact that the preceding event was the
+ // real key
+ if (keycode != 0)
+ real_keycode = keycode;
+
if (fl_xim_ic) {
Status status;
len = XUtf8LookupString(fl_xim_ic, (XKeyPressedEvent *)&xevent.xkey,
@@ -1241,7 +1249,111 @@ int fl_handle(const XEvent& thisevent)
len = XUtf8LookupString(fl_xim_ic, (XKeyPressedEvent *)&xevent.xkey,
buffer, buffer_len, &keysym, &status);
}
- keysym = XKeycodeToKeysym(fl_display, keycode, 0);
+
+ // if this returns true, then Xlib has done some compose processing
+ if (XFilterEvent((XEvent *)&xevent, 0)) {
+ XEvent peekevent;
+
+ // store a copy of the current symbol as it'll get
+ // overwritten with the composed character in the next
+ // iteration
+ if (len) {
+ if (compose_buffer)
+ free(compose_buffer);
+ compose_buffer = strdup(buffer);
+
+ Fl::e_compose_symbol = compose_buffer;
+ } else {
+ // Xutf8LookupString() doesn't give us anything for dead
+ // symbols though, so we need to figure out the symbol
+ // ourselves using the keysym
+ switch (keysym) {
+ case XK_dead_grave:
+ Fl::e_compose_symbol = "\314\200"; // U+0300 COMBINING GRAVE
ACCENT
+ break;
+ case XK_dead_acute:
+ Fl::e_compose_symbol = "\314\201"; // U+0301 COMBINING ACUTE
ACCENT
+ break;
+ case XK_dead_circumflex:
+ Fl::e_compose_symbol = "\314\202"; // U+0302 COMBINING
CIRCUMFLEX ACCENT
+ break;
+ case XK_dead_tilde:
+ Fl::e_compose_symbol = "\314\203"; // U+0303 COMBINING TILDE
+ break;
+ case XK_dead_macron:
+ Fl::e_compose_symbol = "\314\204"; // U+0304 COMBINING MACRON
+ break;
+ case XK_dead_breve:
+ Fl::e_compose_symbol = "\314\206"; // U+0306 COMBINING BREVE
+ break;
+ case XK_dead_abovedot:
+ Fl::e_compose_symbol = "\314\207"; // U+0307 COMBINING DOT ABOVE
+ break;
+ case XK_dead_diaeresis:
+ Fl::e_compose_symbol = "\314\210"; // U+0308 COMBINING DIAERESIS
+ break;
+ case XK_dead_abovering:
+ Fl::e_compose_symbol = "\314\212"; // U+030A COMBINING RING
ABOVE
+ break;
+ case XK_dead_doubleacute:
+ Fl::e_compose_symbol = "\314\213"; // U+030B COMBINING DOUBLE
ACUTE ACCENT
+ break;
+ case XK_dead_caron:
+ Fl::e_compose_symbol = "\314\214"; // U+030C COMBINING CARON
+ break;
+ case XK_dead_cedilla:
+ Fl::e_compose_symbol = "\314\247"; // U+0327 COMBINING CEDILLA
+ break;
+ case XK_dead_ogonek:
+ Fl::e_compose_symbol = "\314\250"; // U+0328 COMBINING OGONEK
+ break;
+ case XK_dead_iota:
+ Fl::e_compose_symbol = "\341\266\245"; // U+1DA5 MODIFIER
LETTER SMALL IOTA
+ break;
+ case XK_dead_voiced_sound:
+ Fl::e_compose_symbol = "\343\202\231"; // U+3099 COMBINING
KATAKANA-HIRAGANA VOICED SOUND MARK
+ break;
+ case XK_dead_semivoiced_sound:
+ Fl::e_compose_symbol = "\343\202\232"; // U+309A COMBINING
KATAKANA-HIRAGANA SEMI-VOICED SOUND MARK
+ break;
+ case XK_dead_belowdot:
+ Fl::e_compose_symbol = "\314\243"; // U+0323 COMBINING DOT BELOW
+ break;
+ default:
+ // this is some unknown compose character
+ Fl::e_compose_symbol = "";
+ }
+ }
+
+ // if a new character was produced then Xlib has put back an event
+ // on the queue with keycode 0
+ if (XPending(fl_display)) {
+ XPeekEvent(fl_display, &peekevent);
+ if ( (peekevent.type == KeyPress) // must be a KeyPress event
+ && (peekevent.xkey.keycode == 0) // must be keycode 0
+ && (peekevent.xkey.time == xevent.xkey.time) // must be sent
at the exact same time
+ ) {
+ XNextEvent(fl_display, &xevent);
+
+ // Something went wrong fetching the current symbol...
+ if (Fl::e_compose_symbol[0] == '\0')
+ Fl::e_compose_state = FL_COMPOSE_UNKNOWN;
+ else
+ Fl::e_compose_state = FL_COMPOSE_FINAL;
+
+ // Process things again to get the composed symbol
+ goto KEYPRESS;
+ }
+ }
+
+ Fl::e_compose_state = FL_COMPOSE_INTERMEDIATE;
+ } else {
+ // if the keycode is 0 then state was set earlier
+ if (keycode != 0)
+ Fl::e_compose_state = FL_COMPOSE_NONE;
+ }
+
+ keysym = XKeycodeToKeysym(fl_display, real_keycode, 0);
} else {
//static XComposeStatus compose;
len = XLookupString((XKeyEvent*)&(xevent.xkey),
_______________________________________________
fltk-bugs mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-bugs