summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/xcb/qxcbwindow.cpp
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@nokia.com>2012-06-12 10:47:42 +0200
committerQt by Nokia <qt-info@nokia.com>2012-06-14 03:05:41 +0200
commit0137f092af12110c427f05358f7b207ea95ea341 (patch)
treef314b8d0f744c4822af8f0d8890ecd9983a284d7 /src/plugins/platforms/xcb/qxcbwindow.cpp
parent1539e8e310ee3da8ae44a4b5b28d0f72b1345eb4 (diff)
Introduce QPA API for size grip handling.
- Introduce API to do size grip handling (mouse press and move). - Move Windows code to Windows plugin. - Move X11 code to XCB plugin and activate it. Change-Id: I2f61d6ddc1fa07447e668554d41ecc820efca23f Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
Diffstat (limited to 'src/plugins/platforms/xcb/qxcbwindow.cpp')
-rw-r--r--src/plugins/platforms/xcb/qxcbwindow.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp
index 390628d291..a1ac5c5eb1 100644
--- a/src/plugins/platforms/xcb/qxcbwindow.cpp
+++ b/src/plugins/platforms/xcb/qxcbwindow.cpp
@@ -1670,4 +1670,37 @@ void QXcbWindow::setCursor(xcb_cursor_t cursor)
xcb_flush(xcb_connection());
}
+#ifdef XCB_USE_XLIB
+
+bool QXcbWindow::startSystemResize(const QPoint &pos, Qt::Corner corner)
+{
+ const xcb_atom_t moveResize = connection()->atom(QXcbAtom::_NET_WM_MOVERESIZE);
+ if (!connection()->wmSupport()->isSupportedByWM(moveResize))
+ return false;
+ XEvent xev;
+ xev.xclient.type = ClientMessage;
+ xev.xclient.message_type = moveResize;
+ Display *display = (Display *)connection()->xlib_display();
+ xev.xclient.display = display;
+ xev.xclient.window = xcb_window();
+ xev.xclient.format = 32;
+ const QPoint globalPos = window()->mapToGlobal(pos);
+ xev.xclient.data.l[0] = globalPos.x();
+ xev.xclient.data.l[1] = globalPos.y();
+ const bool bottom = corner == Qt::BottomRightCorner || corner == Qt::BottomLeftCorner;
+ const bool left = corner == Qt::BottomLeftCorner || corner == Qt::TopLeftCorner;
+ if (bottom)
+ xev.xclient.data.l[2] = left ? 6 : 4; // bottomleft/bottomright
+ else
+ xev.xclient.data.l[2] = left ? 0 : 2; // topleft/topright
+ xev.xclient.data.l[3] = Button1;
+ xev.xclient.data.l[4] = 0;
+ XUngrabPointer(display, CurrentTime);
+ XSendEvent(display, m_screen->root(), False,
+ SubstructureRedirectMask | SubstructureNotifyMask, &xev);
+ return true;
+}
+
+#endif // XCB_USE_XLIB
+
QT_END_NAMESPACE