--- np2/x11/qt/Attic/qtwrapper.cpp 2003/11/26 15:08:42 1.1 +++ np2/x11/qt/Attic/qtwrapper.cpp 2004/03/02 16:34:50 1.3 @@ -30,8 +30,9 @@ #include "np2.h" #include "qt/xnp2.h" +#if defined(Q_WS_X11) #include - +#include const ScreenInfo qt_getScreenInfo() @@ -96,29 +97,60 @@ qt_getScreenInfo() return info; } +bool +hasPendingEvents() +{ + + return XPending(QPaintDevice::x11AppDisplay()); +} +#endif /* Q_WS_X11 */ + +#if defined(Q_WS_QWS) +#include + +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 qt_setPointer(QWidget *w, int x, int y) { + QPoint gp; -#if defined(Q_WS_X11) - ::XWarpPointer(QPaintDevice::x11AppDisplay(), None, - w->winId(), 0, 0, 0, 0, x, y); -#endif + gp = w->mapToGlobal(QPoint(x, y)); + QCursor::setPos(gp); } void qt_getPointer(QWidget *w, int *x, int *y) { + QPoint gp; + QPoint wp; -#if defined(Q_WS_X11) - Window root, child; - int rootx, rooty; - int winx = 0, winy = 0; - unsigned int xmask; - - ::XQueryPointer(QPaintDevice::x11AppDisplay(), w->winId(), - &root, &child, &rootx, &rooty, &winx, &winy, &xmask); - *x = winx; - *y = winy; -#endif + gp = QCursor::pos(); + wp = w->mapFromGlobal(gp); + *x = wp.x(); + *y = wp.y(); }