From: Kristian Høgsberg Date: Thu, 27 Jan 2011 18:52:40 +0000 (-0500) Subject: wayland: Handle keyboard focus correctly X-Git-Tag: qt-v5.0.0-alpha1~222^2^2~107 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1e439bac3e977e26d71811093a6cf4f6f9de0402;p=profile%2Fivi%2Fqtwayland.git wayland: Handle keyboard focus correctly Activate the window widget and update modifiers. --- 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 = {