Fixed Caps Lock handling in X11/XIM (STR #2366)

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@7862 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Matthias Melcher 2010-11-16 21:15:27 +00:00
parent 8224a775ac
commit e91fe6e6d5
2 changed files with 24 additions and 29 deletions

View File

@ -1,5 +1,6 @@
CHANGES IN FLTK 1.3.0
- Fixed Caps Lock handling in X11/XIM (STR #2366)
- Fixed handling of missing fonts in Xft (STR #2355)
- Added alternative Xft font names (STR #2215)
- Update lib png access (STR #2442)

View File

@ -809,7 +809,6 @@ int fl_handle(const XEvent& thisevent)
XEvent xevent = thisevent;
fl_xevent = &thisevent;
Window xid = xevent.xany.window;
int filtered = 0;
static Window xim_win = 0;
if (fl_xim_ic && xevent.type == DestroyNotify &&
@ -868,10 +867,8 @@ int fl_handle(const XEvent& thisevent)
#endif
}
filtered = XFilterEvent((XEvent *)&xevent, 0);
if (filtered) {
return 1;
}
if ( XFilterEvent((XEvent *)&xevent, 0) )
return(1);
switch (xevent.type) {
@ -1144,33 +1141,30 @@ int fl_handle(const XEvent& thisevent)
int len = 0;
if (fl_xim_ic) {
if (!filtered) {
Status status;
len = XUtf8LookupString(fl_xim_ic, (XKeyPressedEvent *)&xevent.xkey,
buffer, buffer_len, &keysym, &status);
Status status;
len = XUtf8LookupString(fl_xim_ic, (XKeyPressedEvent *)&xevent.xkey,
buffer, buffer_len, &keysym, &status);
while (status == XBufferOverflow && buffer_len < 50000) {
buffer_len = buffer_len * 5 + 1;
buffer = (char*)realloc(buffer, buffer_len);
len = XUtf8LookupString(fl_xim_ic, (XKeyPressedEvent *)&xevent.xkey,
buffer, buffer_len, &keysym, &status);
}
} else {
while (status == XBufferOverflow && buffer_len < 50000) {
buffer_len = buffer_len * 5 + 1;
buffer = (char*)realloc(buffer, buffer_len);
len = XUtf8LookupString(fl_xim_ic, (XKeyPressedEvent *)&xevent.xkey,
buffer, buffer_len, &keysym, &status);
}
keysym = XKeycodeToKeysym(fl_display, keycode, 0);
} else {
//static XComposeStatus compose;
len = XLookupString((XKeyEvent*)&(xevent.xkey),
buffer, buffer_len, &keysym, 0/*&compose*/);
if (keysym && keysym < 0x400) { // a character in latin-1,2,3,4 sets
// force it to type a character (not sure if this ever is needed):
// if (!len) {buffer[0] = char(keysym); len = 1;}
len = fl_utf8encode(XKeysymToUcs(keysym), buffer);
if (len < 1) len = 1;
// ignore all effects of shift on the keysyms, which makes it a lot
// easier to program shortcuts and is Windoze-compatable:
keysym = XKeycodeToKeysym(fl_display, keycode, 0);
}
} else {
//static XComposeStatus compose;
len = XLookupString((XKeyEvent*)&(xevent.xkey),
buffer, buffer_len, &keysym, 0/*&compose*/);
if (keysym && keysym < 0x400) { // a character in latin-1,2,3,4 sets
// force it to type a character (not sure if this ever is needed):
// if (!len) {buffer[0] = char(keysym); len = 1;}
len = fl_utf8encode(XKeysymToUcs(keysym), buffer);
if (len < 1) len = 1;
// ignore all effects of shift on the keysyms, which makes it a lot
// easier to program shortcuts and is Windoze-compatable:
keysym = XKeycodeToKeysym(fl_display, keycode, 0);
}
}
// MRS: Can't use Fl::event_state(FL_CTRL) since the state is not
// set until set_event_xy() is called later...