summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorUli Schlachter <psychon@znc.in>2012-06-21 21:01:48 +0200
committerQt by Nokia <qt-info@nokia.com>2012-06-22 11:47:24 +0200
commit6481218da13539529b87626a352a17f42c57be61 (patch)
tree35387068a9312b148ac38c420f2546de791e42ef /src/plugins
parent652d82991d1d5591d9a7f6c4b95b38091600fa45 (diff)
Reimplement QXcbWindow::startSystemResize() with xcb
This function just sends a ClientMessage to the window manager. XCB can do this fine and there is no need to require Xlib for the job. Change-Id: Iad3d78c393c1f439fff987fa19b4d82513810930 Signed-off-by: Uli Schlachter <psychon@znc.in> Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/platforms/xcb/qxcbwindow.cpp35
-rw-r--r--src/plugins/platforms/xcb/qxcbwindow.h2
2 files changed, 15 insertions, 22 deletions
diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp
index a1ac5c5eb1..59e805fd0e 100644
--- a/src/plugins/platforms/xcb/qxcbwindow.cpp
+++ b/src/plugins/platforms/xcb/qxcbwindow.cpp
@@ -1670,37 +1670,32 @@ 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;
+ xcb_client_message_event_t xev;
+ xev.response_type = XCB_CLIENT_MESSAGE;
+ xev.type = moveResize;
+ xev.window = xcb_window();
+ xev.format = 32;
const QPoint globalPos = window()->mapToGlobal(pos);
- xev.xclient.data.l[0] = globalPos.x();
- xev.xclient.data.l[1] = globalPos.y();
+ xev.data.data32[0] = globalPos.x();
+ xev.data.data32[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
+ xev.data.data32[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);
+ xev.data.data32[2] = left ? 0 : 2; // topleft/topright
+ xev.data.data32[3] = Button1;
+ xev.data.data32[4] = 0;
+ xcb_ungrab_pointer(connection()->xcb_connection(), XCB_CURRENT_TIME);
+ xcb_send_event(connection()->xcb_connection(), false, m_screen->root(),
+ XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT | XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY,
+ (const char *)&xev);
return true;
}
-#endif // XCB_USE_XLIB
-
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/xcb/qxcbwindow.h b/src/plugins/platforms/xcb/qxcbwindow.h
index 6cafa0330b..d383248428 100644
--- a/src/plugins/platforms/xcb/qxcbwindow.h
+++ b/src/plugins/platforms/xcb/qxcbwindow.h
@@ -107,9 +107,7 @@ public:
QSurfaceFormat format() const;
-#ifdef XCB_USE_XLIB
bool startSystemResize(const QPoint &pos, Qt::Corner corner);
-#endif // XCB_USE_XLIB
xcb_window_t xcb_window() const { return m_window; }
uint depth() const { return m_depth; }