Here's a small program that demonstrates Fl::event_text() vs. Fl::event_key():
#include <FL/Fl_Window.H>
#include <FL/Fl_Box.H>
#include <FL/Fl.H>
class Box : public Fl_Box {
public:
Box(int x, int y, int w, int h) : Fl_Box(x, y, w, h) {}
int handle(int evt) {
if (evt == FL_KEYDOWN) {
printf("keydown, text: %s, %x, key: %c\n",
Fl::event_text(), Fl::event_text()[0], Fl::event_key());
} else if (evt == FL_KEYUP) {
printf("keyup, text: %s, %x, key: %c\n", Fl::event_text(),
Fl::event_text()[0], Fl::event_key());
}
}
};
int
main(int argc, char **argv)
{
Fl_Window win(0, 0, 200, 200);
Box b(0, 0, 200, 200);
win.show();
Fl::run();
return 0;
}
On my system, if I chord 'a' and 'o' (that is, press 'a', press 'o',
release 'a', then release 'o', the 'a' release returns 'o' in its
event_text():
% ./handle
keydown, text: a, 61, key: a
keydown, text: o, 6f, key: o
keyup, text: o, 6f, key: a
keyup, text: o, 6f, key: o
Can anyone on linux reproduce? If so, I'll file a STR and maybe look
into fixing it. I have an easy workaround (just use event_key(),
which I avoided on OS X due to a different bug), but it's clearly a
bug. I think my app is unusual in caring a lot about keyups :)
_______________________________________________
fltk-dev mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-dev