New Input::Event::FOCUS, rename keycode to code
This patch introduces keyboard-focus events to the 'Input::Event' class and changes the name 'Input::Event::keycode' to 'code'. The 'code' represents the key code for PRESS/RELEASE events, and the focus state for FOCUS events (0 - unfocused, 1 - focused). Furthermore, nitpicker has been adapted to deliver FOCUS events to its clients. Fixes #609
This commit is contained in:
@@ -77,20 +77,17 @@ void QNitpickerInputHandler::readInputData()
|
||||
|
||||
Input::Event *ev = &ev_buf[i];
|
||||
|
||||
// qDebug() << "QNitpickerInputHandler: received input event: keycode == "
|
||||
// << ev->keycode();
|
||||
|
||||
if (ev->type() == Input::Event::MOTION ||
|
||||
ev->type() == Input::Event::WHEEL ||
|
||||
ev->keycode() == Input::BTN_LEFT ||
|
||||
ev->keycode() == Input::BTN_RIGHT ||
|
||||
ev->keycode() == Input::BTN_MIDDLE) {
|
||||
if (ev->type() == Input::Event::MOTION
|
||||
|| ev->type() == Input::Event::WHEEL
|
||||
|| ev->code() == Input::BTN_LEFT
|
||||
|| ev->code() == Input::BTN_RIGHT
|
||||
|| ev->code() == Input::BTN_MIDDLE) {
|
||||
|
||||
#ifndef QT_NO_QWS_MOUSE_NITPICKER
|
||||
mouse->processMouseEvent(ev);
|
||||
#endif
|
||||
|
||||
} else if (ev->keycode() < 128) {
|
||||
} else if (ev->code() < 128) {
|
||||
|
||||
#ifndef QT_NO_QWS_KEYBOARD_NITPICKER
|
||||
keyboard->processKeyEvent(ev);
|
||||
|
||||
@@ -58,14 +58,12 @@ QNitpickerKeyboardHandler::~QNitpickerKeyboardHandler()
|
||||
|
||||
void QNitpickerKeyboardHandler::processKeyEvent(Input::Event *ev)
|
||||
{
|
||||
// qDebug() << "processKeyEvent(): keycode ==" << ev->keycode();
|
||||
|
||||
int keycode = ev->keycode();
|
||||
|
||||
int keycode = ev->code();
|
||||
|
||||
if (ev->type() == Input::Event::RELEASE) {
|
||||
keycode |= 0x80;
|
||||
}
|
||||
|
||||
|
||||
doKey(keycode);
|
||||
}
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ void QNitpickerMouseHandler::processMouseEvent(Input::Event *ev)
|
||||
|
||||
switch (ev->type()) {
|
||||
case Input::Event::PRESS:
|
||||
switch (ev->keycode()) {
|
||||
switch (ev->code()) {
|
||||
case Input::BTN_LEFT:
|
||||
state |= Qt::LeftButton;
|
||||
break;
|
||||
@@ -95,7 +95,7 @@ void QNitpickerMouseHandler::processMouseEvent(Input::Event *ev)
|
||||
}
|
||||
break;
|
||||
case Input::Event::RELEASE:
|
||||
switch (ev->keycode()) {
|
||||
switch (ev->code()) {
|
||||
case Input::BTN_LEFT:
|
||||
state &= ~Qt::LeftButton;
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user