diff options
author | Jørgen Lind <jorgen.lind@digia.com> | 2014-11-13 11:32:21 +0100 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@digia.com> | 2014-11-26 08:43:28 +0100 |
commit | ddc732399949fad397288eb1e0d83cbb5df5f44f (patch) | |
tree | 3da359a655472fbf99e905a5412478d44126dd85 /src/plugins/platforms/xcb | |
parent | b9ae25fa712c88e6861c733d60f44fab84b9c475 (diff) |
XCB: send leave event on grab
When a popup is opened it grabs the input, but the leave event to the other
windows needs to be sent.
Remove the popupEnterLeave test as it did not test any code. The Popup
never gets any enter or leave events so it will succeed always succeed
Task-number: QTBUG-36862
Change-Id: I625c616eeb74b5168af7b751485e2a9a53b76cd3
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
Diffstat (limited to 'src/plugins/platforms/xcb')
-rw-r--r-- | src/plugins/platforms/xcb/qxcbwindow.cpp | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index 85af8ee1d2..e1ccc3f086 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -2022,6 +2022,19 @@ void QXcbWindow::handleMouseEvent(xcb_timestamp_t time, const QPoint &local, con QWindowSystemInterface::handleMouseEvent(window(), time, local, global, connection()->buttons(), modifiers); } +static bool ignoreLeaveEvent(const xcb_leave_notify_event_t *event) +{ + return event->detail == XCB_NOTIFY_DETAIL_VIRTUAL + || event->detail == XCB_NOTIFY_DETAIL_NONLINEAR_VIRTUAL; +} + +static bool ignoreEnterEvent(const xcb_enter_notify_event_t *event) +{ + return ((event->mode != XCB_NOTIFY_MODE_NORMAL && event->mode != XCB_NOTIFY_MODE_UNGRAB) + || event->detail == XCB_NOTIFY_DETAIL_VIRTUAL + || event->detail == XCB_NOTIFY_DETAIL_NONLINEAR_VIRTUAL); +} + class EnterEventChecker { public: @@ -2033,13 +2046,8 @@ public: return false; xcb_enter_notify_event_t *enter = (xcb_enter_notify_event_t *)event; - - if ((enter->mode != XCB_NOTIFY_MODE_NORMAL && enter->mode != XCB_NOTIFY_MODE_UNGRAB) - || enter->detail == XCB_NOTIFY_DETAIL_VIRTUAL - || enter->detail == XCB_NOTIFY_DETAIL_NONLINEAR_VIRTUAL) - { + if (ignoreEnterEvent(enter)) return false; - } return true; } @@ -2052,12 +2060,9 @@ void QXcbWindow::handleEnterNotifyEvent(const xcb_enter_notify_event_t *event) connection()->handleEnterEvent(event); #endif - if ((event->mode != XCB_NOTIFY_MODE_NORMAL && event->mode != XCB_NOTIFY_MODE_UNGRAB) - || event->detail == XCB_NOTIFY_DETAIL_VIRTUAL - || event->detail == XCB_NOTIFY_DETAIL_NONLINEAR_VIRTUAL) - { + if (ignoreEnterEvent(event)) return; - } + const int dpr = int(devicePixelRatio()); const QPoint local(event->event_x/dpr, event->event_y/dpr); const QPoint global(event->root_x/dpr, event->root_y/dpr); @@ -2068,12 +2073,8 @@ void QXcbWindow::handleLeaveNotifyEvent(const xcb_leave_notify_event_t *event) { connection()->setTime(event->time); - if ((event->mode != XCB_NOTIFY_MODE_NORMAL && event->mode != XCB_NOTIFY_MODE_UNGRAB) - || event->detail == XCB_NOTIFY_DETAIL_VIRTUAL - || event->detail == XCB_NOTIFY_DETAIL_NONLINEAR_VIRTUAL) - { + if (ignoreLeaveEvent(event)) return; - } EnterEventChecker checker; xcb_enter_notify_event_t *enter = (xcb_enter_notify_event_t *)connection()->checkEvent(checker); |