Adapt qt4 to Input::Event changes

We need to make the event checks more explicit because 'code' is not
exclusively used for key event anymore.
This commit is contained in:
Norman Feske 2013-01-22 10:34:35 +01:00
parent 486b27a1b8
commit 61dd83a329

View File

@ -77,17 +77,23 @@ void QNitpickerInputHandler::readInputData()
Input::Event *ev = &ev_buf[i]; Input::Event *ev = &ev_buf[i];
bool const is_key_event = ev->type() == Input::Event::PRESS
|| ev->type() == Input::Event::RELEASE;
bool const is_mouse_button_event =
is_key_event && (ev->code() == Input::BTN_LEFT
|| ev->code() == Input::BTN_MIDDLE
|| ev->code() == Input::BTN_RIGHT);
if (ev->type() == Input::Event::MOTION if (ev->type() == Input::Event::MOTION
|| ev->type() == Input::Event::WHEEL || ev->type() == Input::Event::WHEEL
|| ev->code() == Input::BTN_LEFT || is_mouse_button_event) {
|| ev->code() == Input::BTN_RIGHT
|| ev->code() == Input::BTN_MIDDLE) {
#ifndef QT_NO_QWS_MOUSE_NITPICKER #ifndef QT_NO_QWS_MOUSE_NITPICKER
mouse->processMouseEvent(ev); mouse->processMouseEvent(ev);
#endif #endif
} else if (ev->code() < 128) { } else if (is_key_event && (ev->code() < 128)) {
#ifndef QT_NO_QWS_KEYBOARD_NITPICKER #ifndef QT_NO_QWS_KEYBOARD_NITPICKER
keyboard->processKeyEvent(ev); keyboard->processKeyEvent(ev);