summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/xcb/qxcbwindow.cpp
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@theqtcompany.com>2016-01-08 12:30:57 +0100
committerFrederik Gladhorn <frederik.gladhorn@theqtcompany.com>2016-01-08 12:35:24 +0100
commitad16478a76815f8f61d454bf7760aaf9ffbb4b51 (patch)
treeeefdd9219cc9d59b62e042f49fc7555b980cb7a4 /src/plugins/platforms/xcb/qxcbwindow.cpp
parent80a741f3616290897ba0d9f1cbd3c9c5ee62da37 (diff)
parent09c92863001790a0304a5ef389901ee2b5b6cdc2 (diff)
Merge remote-tracking branch 'origin/5.6' into dev
Based on merge done by Liang Qi Change-Id: Id566e5b9f284d29bff2199f13f9417c660f5b26f
Diffstat (limited to 'src/plugins/platforms/xcb/qxcbwindow.cpp')
-rw-r--r--src/plugins/platforms/xcb/qxcbwindow.cpp21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp
index ae81674eca..f030252865 100644
--- a/src/plugins/platforms/xcb/qxcbwindow.cpp
+++ b/src/plugins/platforms/xcb/qxcbwindow.cpp
@@ -594,12 +594,16 @@ QXcbWindow::~QXcbWindow()
{
if (window()->type() != Qt::ForeignWindow)
destroy();
+ else if (connection()->mouseGrabber() == this)
+ connection()->setMouseGrabber(Q_NULLPTR);
}
void QXcbWindow::destroy()
{
if (connection()->focusWindow() == this)
doFocusOut();
+ if (connection()->mouseGrabber() == this)
+ connection()->setMouseGrabber(Q_NULLPTR);
if (m_syncCounter && m_usingSyncProtocol)
Q_XCB_CALL(xcb_sync_destroy_counter(xcb_connection(), m_syncCounter));
@@ -847,6 +851,9 @@ void QXcbWindow::hide()
xcb_flush(xcb_connection());
+ if (connection()->mouseGrabber() == this)
+ connection()->setMouseGrabber(Q_NULLPTR);
+
m_mapped = false;
}
@@ -2367,6 +2374,8 @@ void QXcbWindow::handlePropertyNotifyEvent(const xcb_property_notify_event_t *ev
QWindowSystemInterface::handleWindowStateChanged(window(), newState);
m_lastWindowStateEvent = newState;
m_windowState = newState;
+ if (m_windowState == Qt::WindowMinimized && connection()->mouseGrabber() == this)
+ connection()->setMouseGrabber(Q_NULLPTR);
}
return;
} else if (event->atom == atom(QXcbAtom::_NET_FRAME_EXTENTS)) {
@@ -2421,9 +2430,15 @@ bool QXcbWindow::setKeyboardGrabEnabled(bool grab)
bool QXcbWindow::setMouseGrabEnabled(bool grab)
{
+ if (!grab && connection()->mouseGrabber() == this)
+ connection()->setMouseGrabber(Q_NULLPTR);
#ifdef XCB_USE_XINPUT22
- if (connection()->xi2MouseEvents())
- return connection()->xi2SetMouseGrabEnabled(m_window, grab);
+ if (connection()->xi2MouseEvents()) {
+ bool result = connection()->xi2SetMouseGrabEnabled(m_window, grab);
+ if (grab && result)
+ connection()->setMouseGrabber(this);
+ return result;
+ }
#endif
if (grab && !connection()->canGrab())
return false;
@@ -2442,6 +2457,8 @@ bool QXcbWindow::setMouseGrabEnabled(bool grab)
xcb_grab_pointer_reply_t *reply = xcb_grab_pointer_reply(xcb_connection(), cookie, NULL);
bool result = !(!reply || reply->status != XCB_GRAB_STATUS_SUCCESS);
free(reply);
+ if (result)
+ connection()->setMouseGrabber(this);
return result;
}