> BTW: I wonder whether your show_key() function would work for UTF-8
> characters?

Well, it wouldn't, but this is 'int Fl::event_key()', which doesn't
return UTF-8 anyway.  The doc says it returns a 'keycode', but doesn't
really define what that is.  When I type on a zhuyin keymap, I get the
qwerty keys, and when I use the OS X character pallette apparently
event_key() doesn't understand it at all... I get a FL_KEYDOWN and
FL_KEYUP, but the event_key retains the previous value.

I've gotten sort of random stuff out of event_key(), it can give some
confusing results on OS X when the keyboard has been remapped.

Interestingly, when I switch from zhuyin back to latin, I get this msg
from the OS:

2011-03-25 20:57:08.464 flbug[72227:903] Warning - conversion from 64
bit to 32 bit integral value requested within NSPortCoder, but the 64
bit value 9223372036854775807 cannot be represented by a 32 bit value


I modified it to include Fl::event_text(), and utf8 for that part
seems to work fine:

const char *
show_event_info(int ev)
{
    static char buf[1024];
    switch (ev) {
    case FL_PUSH: case FL_DRAG: case FL_RELEASE: case FL_MOVE:
    case FL_MOUSEWHEEL:
        snprintf(buf, sizeof buf, "(%d, %d)", Fl::event_x(), Fl::event_y());
        break;
    case FL_KEYDOWN: case FL_KEYUP:
        // Don't bother with Fl::event_length() because 'buf' isn't returned
        // with an explicit length.
        snprintf(buf, sizeof buf, "%s (\"%s\")",
            show_key(Fl::event_key()), Fl::event_text());
        break;
    default:
        return "unknown";
        break;
    }
    return buf;
}

_______________________________________________
fltk-dev mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-dev

Reply via email to