summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorPaul Olav Tvete <paul.tvete@nokia.com>2009-11-19 17:02:36 +0100
committerPaul Olav Tvete <paul.tvete@nokia.com>2009-11-19 17:02:36 +0100
commitd7a94e8839d6a5caeea3f6ebb4661b7da3020e21 (patch)
treeffa743377a9bdb9441e2a64d6ffe37133b4425cd /src/gui
parent879e2ea7d15510ec5f94d6d7a005b157b115f69f (diff)
parent869c9dad8f4c42db47c448a4c644dc2e54c60c2b (diff)
Merge branch 'lighthouse' of scm.dev.nokia.troll.no:qt/qt-lighthouse into lighthouse
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/kernel/qapplication_lite.cpp27
-rw-r--r--src/gui/painting/qgraphicssystem.cpp13
-rw-r--r--src/gui/painting/qgraphicssystem_p.h6
-rw-r--r--src/gui/painting/qgraphicssystemcursor.cpp8
-rw-r--r--src/gui/painting/qgraphicssystemcursor.h2
5 files changed, 34 insertions, 22 deletions
diff --git a/src/gui/kernel/qapplication_lite.cpp b/src/gui/kernel/qapplication_lite.cpp
index 061ac5bf08..f2be5c7c27 100644
--- a/src/gui/kernel/qapplication_lite.cpp
+++ b/src/gui/kernel/qapplication_lite.cpp
@@ -56,7 +56,8 @@
#include <qdesktopwidget.h>
#include <qinputcontext.h>
-
+#include "private/qgraphicssystem_p.h"
+#include "qgraphicssystemcursor.h"
#include <qdebug.h>
@@ -354,19 +355,14 @@ void QApplication::restoreOverrideCursor()
QWidget *QApplication::topLevelAt(const QPoint &pos)
{
-//### We have to implement a windowsystem-aware way to do this
-
- //fallback implementation assuming widgets are in stacking order
-
- QWidgetList list = topLevelWidgets();
- for (int i = list.size()-1; i >= 0; --i) {
- QWidget *w = list[i];
- //### mask is ignored
- if (w != QApplication::desktop() && w->isVisible() && w->geometry().contains(pos))
- return w;
- }
-
- return 0;
+ QGraphicsSystem *gs = QApplicationPrivate::graphicsSystem();
+ if (!gs)
+ return 0;
+ QGraphicsSystemScreen *screen = gs->screens().first();
+ if (!screen)
+ return 0;
+ QWidget *w = screen->topLevelAt(pos);
+ return w;
}
void QApplication::beep()
@@ -530,6 +526,9 @@ void QApplicationPrivate::handleMouseEvent(QWidget *tlw, const QMouseEvent &ev)
static QWidget *implicit_mouse_grabber=0;
+ if (QGraphicsSystemCursor::instance)
+ QGraphicsSystemCursor::instance->pointerEvent(ev);
+
QPoint localPoint = ev.pos();
QPoint globalPoint = ev.globalPos();
QWidget *mouseWindow = tlw;
diff --git a/src/gui/painting/qgraphicssystem.cpp b/src/gui/painting/qgraphicssystem.cpp
index 2071127fcb..948223d3b3 100644
--- a/src/gui/painting/qgraphicssystem.cpp
+++ b/src/gui/painting/qgraphicssystem.cpp
@@ -85,6 +85,19 @@ QPixmapData *QGraphicsSystem::createDefaultPixmapData(QPixmapData::PixelType typ
}
#ifdef Q_WS_LITE
+QWidget *QGraphicsSystemScreen::topLevelAt(const QPoint & pos) const
+{
+ QWidgetList list = QApplication::topLevelWidgets();
+ for (int i = list.size()-1; i >= 0; --i) {
+ QWidget *w = list[i];
+ //### mask is ignored
+ if (w != QApplication::desktop() && w->isVisible() && w->geometry().contains(pos))
+ return w;
+ }
+
+ return 0;
+}
+
QList<QGraphicsSystemScreen *> QGraphicsSystem::screens() const
{
return QList<QGraphicsSystemScreen *>();
diff --git a/src/gui/painting/qgraphicssystem_p.h b/src/gui/painting/qgraphicssystem_p.h
index ddba22d149..0b0dfb58fc 100644
--- a/src/gui/painting/qgraphicssystem_p.h
+++ b/src/gui/painting/qgraphicssystem_p.h
@@ -56,6 +56,8 @@
#include "private/qpixmapdata_p.h"
#include "private/qwindowsurface_p.h"
+#include <qdebug.h>
+
QT_BEGIN_NAMESPACE
class QPixmapFilter;
@@ -73,8 +75,8 @@ public:
virtual int depth() const = 0;
virtual QImage::Format format() const = 0;
virtual QSize physicalSize() const = 0;
- virtual void setDirty(QRect) { }
- virtual void pointerEvent(QMouseEvent &) { }
+ virtual void setDirty(const QRect &) {}
+ virtual QWidget *topLevelAt(const QPoint &point) const;
};
#endif // Q_WS_LITE
diff --git a/src/gui/painting/qgraphicssystemcursor.cpp b/src/gui/painting/qgraphicssystemcursor.cpp
index 08dcbbe505..6aef76c1c1 100644
--- a/src/gui/painting/qgraphicssystemcursor.cpp
+++ b/src/gui/painting/qgraphicssystemcursor.cpp
@@ -57,8 +57,7 @@ QGraphicsSystemCursor::QGraphicsSystemCursor(QGraphicsSystemScreen *scr )
{
graphic = new QGraphicsSystemCursorImage(0, 0, 0, 0, 0, 0);
instance = this;
- QWidget * widget = QApplication::widgetAt(QCursor::pos());
- changeCursor(widget);
+ setCursor(Qt::ArrowCursor);
}
QGraphicsSystemCursor::~QGraphicsSystemCursor()
@@ -95,13 +94,12 @@ QRect QGraphicsSystemCursor::drawCursor(QPainter & painter)
return prevRect;
}
-void QGraphicsSystemCursor::pointerEvent(QMouseEvent & e)
+void QGraphicsSystemCursor::pointerEvent(const QMouseEvent & e)
{
currentRect = graphic->image()->rect().translated(-graphic->hotspot().x(),
-graphic->hotspot().y());
currentRect.translate(e.pos());
-
- screen->pointerEvent(e);
+ screen->setDirty(QRect(QRect(e.pos(), QSize(1, 1))));
}
void QGraphicsSystemCursor::changeCursor(QCursor * widgetCursor)
diff --git a/src/gui/painting/qgraphicssystemcursor.h b/src/gui/painting/qgraphicssystemcursor.h
index eab72037ce..de7ce84858 100644
--- a/src/gui/painting/qgraphicssystemcursor.h
+++ b/src/gui/painting/qgraphicssystemcursor.h
@@ -73,7 +73,7 @@ public:
// input methods
virtual void setCursor(const uchar *data, const uchar *mask, int width, int height, int hotX, int hotY);
virtual void setCursor(Qt::CursorShape shape);
- virtual void pointerEvent(QMouseEvent & event);
+ virtual void pointerEvent(const QMouseEvent & event);
virtual void changeCursor(QWidget * widget);
virtual void changeCursor(QCursor * widgetCursor);