summaryrefslogtreecommitdiffstats
path: root/src/client/qwaylandinputdevice.cpp
diff options
context:
space:
mode:
authorJohan Klokkhammer Helsing <johan.helsing@qt.io>2016-06-01 16:23:23 +0200
committerJohan Helsing <johan.helsing@qt.io>2016-07-04 14:05:30 +0000
commitf497a5bb87270174b8e0106b7eca1992d44ff15d (patch)
tree78c0a273b27de1dee2beed135cae18524a71f9e5 /src/client/qwaylandinputdevice.cpp
parent00a65be5ae8e1253ed6fd1f2e1df745f4c319de5 (diff)
Use xdg_shell configure events to determine active window
According to the xdg_shell protocol, the compositor is allowed to set multiple active windows. Qt's model, however, allows only a single active window. In order to map between the models, a list of the compositor's active windows is kept in QWaylandDisplay in the order they were activated. Hence, the front of this list will always be the most recently activated window, and it will be mapped as Qt's active window. Previously keyboard focus was used to determine the active window, this method has been disabled for xdg_shell. Functionality for delaying the call to QWindowSystemInterface::handleWindowActivated has been moved from QWaylandInputDevice::Keyboard to QWaylandDisplay so the implementations can share the workaround. Task-number: QTBUG-53702 Change-Id: I878151f9c52ed09a8d6571c6208920436c3ca8fc Reviewed-by: Giulio Camuffo <giulio.camuffo@kdab.com>
Diffstat (limited to 'src/client/qwaylandinputdevice.cpp')
-rw-r--r--src/client/qwaylandinputdevice.cpp34
1 files changed, 3 insertions, 31 deletions
diff --git a/src/client/qwaylandinputdevice.cpp b/src/client/qwaylandinputdevice.cpp
index e2412eaa4..5eaed9ea1 100644
--- a/src/client/qwaylandinputdevice.cpp
+++ b/src/client/qwaylandinputdevice.cpp
@@ -69,7 +69,6 @@ QWaylandInputDevice::Keyboard::Keyboard(QWaylandInputDevice *p)
, mXkbMap(0)
, mXkbState(0)
#endif
- , mFocusCallback(0)
, mNativeModifiers(0)
{
connect(&mRepeatTimer, SIGNAL(timeout()), this, SLOT(repeatKey()));
@@ -122,8 +121,6 @@ QWaylandInputDevice::Keyboard::~Keyboard()
#endif
if (mFocus)
QWindowSystemInterface::handleWindowActivated(0);
- if (mFocusCallback)
- wl_callback_destroy(mFocusCallback);
if (mParent->mVersion >= 3)
wl_keyboard_release(object());
else
@@ -591,10 +588,7 @@ void QWaylandInputDevice::Keyboard::keyboard_enter(uint32_t time, struct wl_surf
QWaylandWindow *window = QWaylandWindow::fromWlSurface(surface);
mFocus = window;
- if (!mFocusCallback) {
- mFocusCallback = wl_display_sync(mParent->mDisplay);
- wl_callback_add_listener(mFocusCallback, &QWaylandInputDevice::Keyboard::callback, this);
- }
+ mParent->mQDisplay->handleKeyboardFocusChanged(mParent);
}
void QWaylandInputDevice::Keyboard::keyboard_leave(uint32_t time, struct wl_surface *surface)
@@ -609,31 +603,9 @@ void QWaylandInputDevice::Keyboard::keyboard_leave(uint32_t time, struct wl_surf
mFocus = NULL;
- // Use a callback to set the focus because we may get a leave/enter pair, and
- // the latter one would be lost in the QWindowSystemInterface queue, if
- // we issue the handleWindowActivated() calls immediately.
- if (!mFocusCallback) {
- mFocusCallback = wl_display_sync(mParent->mDisplay);
- wl_callback_add_listener(mFocusCallback, &QWaylandInputDevice::Keyboard::callback, this);
- }
- mRepeatTimer.stop();
-}
-
-const wl_callback_listener QWaylandInputDevice::Keyboard::callback = {
- QWaylandInputDevice::Keyboard::focusCallback
-};
+ mParent->mQDisplay->handleKeyboardFocusChanged(mParent);
-void QWaylandInputDevice::Keyboard::focusCallback(void *data, struct wl_callback *callback, uint32_t time)
-{
- Q_UNUSED(time);
- Q_UNUSED(callback);
- QWaylandInputDevice::Keyboard *self = static_cast<QWaylandInputDevice::Keyboard *>(data);
- if (self->mFocusCallback) {
- wl_callback_destroy(self->mFocusCallback);
- self->mFocusCallback = 0;
- }
-
- QWindowSystemInterface::handleWindowActivated(self->mFocus ? self->mFocus->window() : 0);
+ mRepeatTimer.stop();
}
void QWaylandInputDevice::Keyboard::keyboard_key(uint32_t serial, uint32_t time, uint32_t key, uint32_t state)