summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@digia.com>2013-07-23 13:54:37 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-07-31 07:33:23 +0200
commite54ef7f23bf976f264ecb5ca77e080b324f18a62 (patch)
treeb4346a29a2ba67373c8af63c08b0b70b30cc7ec5 /src/plugins/platforms
parent130f43c9c17669ce02747176a7b3c2bf5f667204 (diff)
xcb: mouse wheel does not focus a window
The window should react to the wheel event (e.g. scroll content) but without becoming focused; this is the X11 convention. Task-number: QTBUG-32517 Change-Id: I7e12425e5a6e1549b7f23dc318612a436c24d14b Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Diffstat (limited to 'src/plugins/platforms')
-rw-r--r--src/plugins/platforms/xcb/qxcbwindow.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp
index 0325338a13..5006aab35b 100644
--- a/src/plugins/platforms/xcb/qxcbwindow.cpp
+++ b/src/plugins/platforms/xcb/qxcbwindow.cpp
@@ -1641,7 +1641,8 @@ void QXcbWindow::handleUnmapNotifyEvent(const xcb_unmap_notify_event_t *event)
void QXcbWindow::handleButtonPressEvent(const xcb_button_press_event_t *event)
{
- if (window() != QGuiApplication::focusWindow()) {
+ const bool isWheel = event->detail >= 4 && event->detail <= 7;
+ if (!isWheel && window() != QGuiApplication::focusWindow()) {
QWindow *w = static_cast<QWindowPrivate *>(QObjectPrivate::get(window()))->eventReceiver();
if (!(w->flags() & Qt::WindowDoesNotAcceptFocus))
w->requestActivate();
@@ -1663,7 +1664,7 @@ void QXcbWindow::handleButtonPressEvent(const xcb_button_press_event_t *event)
Qt::KeyboardModifiers modifiers = connection()->keyboard()->translateModifiers(event->state);
- if (event->detail >= 4 && event->detail <= 7) {
+ if (isWheel) {
// Logic borrowed from qapplication_x11.cpp
int delta = 120 * ((event->detail == 4 || event->detail == 6) ? 1 : -1);
bool hor = (((event->detail == 4 || event->detail == 5)