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>
This commit is contained in:
Shawn Rutledge 2013-07-23 13:54:37 +02:00 committed by The Qt Project
parent 130f43c9c1
commit e54ef7f23b

View File

@ -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)