|
|
| version 1.1, 2003/11/26 15:08:42 | version 1.2, 2003/12/19 16:08:02 |
|---|---|
| Line 31 | Line 31 |
| #include "qt/xnp2.h" | #include "qt/xnp2.h" |
| #include <X11/Xlib.h> | #include <X11/Xlib.h> |
| #include <qcursor.h> | |
| const ScreenInfo | const ScreenInfo |
| Line 96 qt_getScreenInfo() | Line 97 qt_getScreenInfo() |
| return info; | return info; |
| } | } |
| bool | |
| hasPendingEvents() | |
| { | |
| return XPending(QPaintDevice::x11AppDisplay()); | |
| } | |
| void | void |
| qt_setPointer(QWidget *w, int x, int y) | qt_setPointer(QWidget *w, int x, int y) |
| { | { |
| QPoint gp; | |
| #if defined(Q_WS_X11) | gp = w->mapToGlobal(QPoint(x, y)); |
| ::XWarpPointer(QPaintDevice::x11AppDisplay(), None, | QCursor::setPos(gp); |
| w->winId(), 0, 0, 0, 0, x, y); | |
| #endif | |
| } | } |
| void | void |
| qt_getPointer(QWidget *w, int *x, int *y) | qt_getPointer(QWidget *w, int *x, int *y) |
| { | { |
| QPoint gp; | |
| QPoint wp; | |
| #if defined(Q_WS_X11) | gp = QCursor::pos(); |
| Window root, child; | wp = w->mapFromGlobal(gp); |
| int rootx, rooty; | *x = wp.x(); |
| int winx = 0, winy = 0; | *y = wp.y(); |
| unsigned int xmask; | |
| ::XQueryPointer(QPaintDevice::x11AppDisplay(), w->winId(), | |
| &root, &child, &rootx, &rooty, &winx, &winy, &xmask); | |
| *x = winx; | |
| *y = winy; | |
| #endif | |
| } | } |