Implement QXcbIntegration::queryKeyboardModifiers()
Change-Id: Ifd2255362f5ef005e2a57f4001a72d932497b453 Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
This commit is contained in:
parent
3506ee51b2
commit
9a16e14666
@ -506,7 +506,7 @@ xcb_cursor_t QXcbCursor::createBitmapCursor(QCursor *cursor)
|
||||
return c;
|
||||
}
|
||||
|
||||
static void getPosAndRoot(xcb_connection_t *conn, xcb_window_t *rootWin, QPoint *pos)
|
||||
void QXcbCursor::queryPointer(xcb_connection_t *conn, xcb_window_t *rootWin, QPoint *pos, int *keybMask)
|
||||
{
|
||||
if (pos)
|
||||
*pos = QPoint();
|
||||
@ -521,6 +521,8 @@ static void getPosAndRoot(xcb_connection_t *conn, xcb_window_t *rootWin, QPoint
|
||||
*pos = QPoint(reply->root_x, reply->root_y);
|
||||
if (rootWin)
|
||||
*rootWin = root;
|
||||
if (keybMask)
|
||||
*keybMask = reply->mask;
|
||||
free(reply);
|
||||
return;
|
||||
}
|
||||
@ -533,7 +535,7 @@ static void getPosAndRoot(xcb_connection_t *conn, xcb_window_t *rootWin, QPoint
|
||||
QPoint QXcbCursor::pos() const
|
||||
{
|
||||
QPoint p;
|
||||
getPosAndRoot(xcb_connection(), 0, &p);
|
||||
queryPointer(xcb_connection(), 0, &p);
|
||||
return p;
|
||||
}
|
||||
|
||||
@ -541,7 +543,7 @@ void QXcbCursor::setPos(const QPoint &pos)
|
||||
{
|
||||
xcb_connection_t *conn = xcb_connection();
|
||||
xcb_window_t root;
|
||||
getPosAndRoot(conn, &root, 0);
|
||||
queryPointer(conn, &root, 0);
|
||||
xcb_warp_pointer(conn, XCB_NONE, root, 0, 0, 0, 0, pos.x(), pos.y());
|
||||
xcb_flush(conn);
|
||||
}
|
||||
|
@ -56,6 +56,8 @@ public:
|
||||
QPoint pos() const;
|
||||
void setPos(const QPoint &pos);
|
||||
|
||||
static void queryPointer(xcb_connection_t *conn, xcb_window_t *rootWin, QPoint *pos, int *keybMask = 0);
|
||||
|
||||
private:
|
||||
xcb_cursor_t createFontCursor(int cshape);
|
||||
xcb_cursor_t createBitmapCursor(QCursor *cursor);
|
||||
|
@ -43,6 +43,8 @@
|
||||
#include "qxcbconnection.h"
|
||||
#include "qxcbscreen.h"
|
||||
#include "qxcbwindow.h"
|
||||
#include "qxcbcursor.h"
|
||||
#include "qxcbkeyboard.h"
|
||||
#include "qxcbbackingstore.h"
|
||||
#include "qxcbnativeinterface.h"
|
||||
#include "qxcbclipboard.h"
|
||||
@ -257,6 +259,14 @@ QPlatformServices *QXcbIntegration::services() const
|
||||
return m_services.data();
|
||||
}
|
||||
|
||||
Qt::KeyboardModifiers QXcbIntegration::queryKeyboardModifiers() const
|
||||
{
|
||||
int keybMask = 0;
|
||||
QXcbConnection* conn = m_connections.at(0);
|
||||
QXcbCursor::queryPointer(conn->xcb_connection(), 0, 0, &keybMask);
|
||||
return conn->keyboard()->translateModifiers(keybMask);
|
||||
}
|
||||
|
||||
QStringList QXcbIntegration::themeNames() const
|
||||
{
|
||||
return QGenericUnixTheme::themeNames();
|
||||
|
@ -87,6 +87,8 @@ public:
|
||||
|
||||
QPlatformServices *services() const;
|
||||
|
||||
Qt::KeyboardModifiers queryKeyboardModifiers() const;
|
||||
|
||||
QStringList themeNames() const;
|
||||
QPlatformTheme *createPlatformTheme(const QString &name) const;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user