diff options
author | Kristian Høgsberg <krh@bitplanet.net> | 2011-01-27 18:52:40 (GMT) |
---|---|---|
committer | Jørgen Lind <jorgen.lind@nokia.com> | 2011-02-01 13:38:25 (GMT) |
commit | b3a8877f54bbd60a4f54439f5d551e1dfec7a9a9 (patch) | |
tree | 254aa01c1c8949b873e0199286ce674178d5d5c4 | |
parent | 2ab07dd167e05fe60525fde9b7b180738e431b9d (diff) | |
download | Qt-b3a8877f54bbd60a4f54439f5d551e1dfec7a9a9.zip Qt-b3a8877f54bbd60a4f54439f5d551e1dfec7a9a9.tar.gz Qt-b3a8877f54bbd60a4f54439f5d551e1dfec7a9a9.tar.bz2 |
wayland: Handle keyboard focus correctly
Activate the window widget and update modifiers.
-rw-r--r-- | src/plugins/platforms/wayland/qwaylandinputdevice.cpp | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 03edc07..102a213 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -282,19 +282,28 @@ void QWaylandInputDevice::inputHandleKeyboardFocus(void *data, { Q_UNUSED(input_device); Q_UNUSED(time); - Q_UNUSED(keys); QWaylandInputDevice *inputDevice = (QWaylandInputDevice *) data; QWaylandWindow *window; - - if (inputDevice->mKeyboardFocus) { - window = inputDevice->mKeyboardFocus; - inputDevice->mKeyboardFocus = NULL; + uint32_t *k, *end; + uint32_t code; + + end = (uint32_t *) ((char *) keys->data + keys->size); + inputDevice->mModifiers = 0; + for (k = (uint32_t *) keys->data; k < end; k++) { + code = *k + inputDevice->mXkb->min_key_code; + inputDevice->mModifiers |= + translateModifiers(inputDevice->mXkb->map->modmap[code]); } if (surface) { window = (QWaylandWindow *) wl_surface_get_user_data(surface); inputDevice->mKeyboardFocus = window; + QWindowSystemInterface::handleWindowActivated(window->widget()); + } else { + inputDevice->mKeyboardFocus = NULL; + QWindowSystemInterface::handleWindowActivated(0); } + } const struct wl_input_device_listener QWaylandInputDevice::inputDeviceListener = { |