|
|
| version 1.1, 2003/11/26 15:08:42 | version 1.3, 2004/03/02 16:34:50 |
|---|---|
| Line 30 | Line 30 |
| #include "np2.h" | #include "np2.h" |
| #include "qt/xnp2.h" | #include "qt/xnp2.h" |
| #if defined(Q_WS_X11) | |
| #include <X11/Xlib.h> | #include <X11/Xlib.h> |
| #include <qcursor.h> | |
| const ScreenInfo | const ScreenInfo |
| qt_getScreenInfo() | qt_getScreenInfo() |
| Line 96 qt_getScreenInfo() | Line 97 qt_getScreenInfo() |
| return info; | return info; |
| } | } |
| bool | |
| hasPendingEvents() | |
| { | |
| return XPending(QPaintDevice::x11AppDisplay()); | |
| } | |
| #endif /* Q_WS_X11 */ | |
| #if defined(Q_WS_QWS) | |
| #include <qpixmap.h> | |
| const ScreenInfo | |
| qt_getScreenInfo() | |
| { | |
| ScreenInfo info; | |
| info.bpp = 0; | |
| // 16bpp only... | |
| if (QPixmap::defaultDepth() == 16) { | |
| info.bpp = 16; | |
| info.mask.red = 0xf800; | |
| info.mask.green = 0x07e0; | |
| info.mask.blue = 0x001f; | |
| } | |
| return info; | |
| } | |
| bool | |
| hasPendingEvents() | |
| { | |
| return false; | |
| } | |
| #endif | |
| 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 | |
| } | } |