summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorMorten Sorvig <morten.sorvig@nokia.com>2009-11-30 17:57:58 -0600
committerMorten Sorvig <morten.sorvig@nokia.com>2009-11-30 17:57:58 -0600
commit76b4d189b7de4dec6a6ce24f2e28286adc95c0df (patch)
treee1a6241a59b6796ea04e26fe35ed4d1e131b087f /src/gui
parent007c69649747e8db2b9ddade5280185a8fa36d6b (diff)
parentd7667e96f2faa83ddb2d9465320fa30ba1891292 (diff)
Merge commit 'qml-lighthouse/lighthouse' into nacl-labs
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/egl/qegl.cpp2
-rw-r--r--src/gui/egl/qegl_lite.cpp4
-rw-r--r--src/gui/image/image.pri2
-rw-r--r--src/gui/image/qpixmap_blitter.cpp1
-rw-r--r--src/gui/kernel/qwidget_lite.cpp9
-rw-r--r--src/gui/painting/qgraphicssystemcursor.cpp109
-rw-r--r--src/gui/painting/qgraphicssystemcursor.h26
-rw-r--r--src/gui/painting/qwindowsurface_p.h1
8 files changed, 61 insertions, 93 deletions
diff --git a/src/gui/egl/qegl.cpp b/src/gui/egl/qegl.cpp
index c0e48903ac..0f51846399 100644
--- a/src/gui/egl/qegl.cpp
+++ b/src/gui/egl/qegl.cpp
@@ -188,7 +188,7 @@ bool QEglContext::createContext(QEglContext *shareContext, const QEglProperties
}
}
if (ctx == EGL_NO_CONTEXT) {
- ctx = eglCreateContext(dpy, cfg, 0, contextProps.properties());
+ ctx = eglCreateContext(dpy, cfg, EGL_NO_CONTEXT, contextProps.properties());
if (ctx == EGL_NO_CONTEXT) {
qWarning() << "QEglContext::createContext(): Unable to create EGL context:" << errorString(eglGetError());
return false;
diff --git a/src/gui/egl/qegl_lite.cpp b/src/gui/egl/qegl_lite.cpp
index 40439c6994..60b862b709 100644
--- a/src/gui/egl/qegl_lite.cpp
+++ b/src/gui/egl/qegl_lite.cpp
@@ -52,11 +52,11 @@
QT_BEGIN_NAMESPACE
-bool QEglContext::createSurface(QPaintDevice *device, const QEglProperties *properties)
+EGLSurface QEglContext::createSurface(QPaintDevice *device, const QEglProperties *properties)
{
Q_UNUSED(device);
Q_UNUSED(properties);
- return false;
+ return 0;
}
EGLDisplay QEglContext::getDisplay(QPaintDevice *device)
diff --git a/src/gui/image/image.pri b/src/gui/image/image.pri
index b2328484ca..10a073b74c 100644
--- a/src/gui/image/image.pri
+++ b/src/gui/image/image.pri
@@ -23,7 +23,7 @@ HEADERS += \
image/qpictureformatplugin.h \
image/qpixmap.h \
image/qpixmap_raster_p.h \
- miage/qpixmap_blitter_p.h \
+ image/qpixmap_blitter_p.h \
image/qpixmapcache.h \
image/qpixmapcache_p.h \
image/qpixmapdata_p.h \
diff --git a/src/gui/image/qpixmap_blitter.cpp b/src/gui/image/qpixmap_blitter.cpp
index 35d6ddb946..18761a92a0 100644
--- a/src/gui/image/qpixmap_blitter.cpp
+++ b/src/gui/image/qpixmap_blitter.cpp
@@ -104,7 +104,6 @@ void QBlittablePixmapData::fromImage(const QImage &image,
QImage *thisImg = blittable()->lock();
QPainter p(thisImg);
p.drawImage(0,0,image,flags);
-
}
QPaintEngine *QBlittablePixmapData::paintEngine() const
diff --git a/src/gui/kernel/qwidget_lite.cpp b/src/gui/kernel/qwidget_lite.cpp
index 91e7e1704c..3cc5663992 100644
--- a/src/gui/kernel/qwidget_lite.cpp
+++ b/src/gui/kernel/qwidget_lite.cpp
@@ -187,8 +187,13 @@ void QWidgetPrivate::updateCursor() const
void QWidgetPrivate::setWindowTitle_sys(const QString &caption)
{
- Q_UNUSED(caption);
- // XXX
+ Q_Q(QWidget);
+ if (!q->isWindow())
+ return;
+
+ if (QWindowSurface *surface = q->windowSurface())
+ surface->setWindowTitle(caption);
+
}
void QWidgetPrivate::setWindowIcon_sys(bool /*forceReset*/)
diff --git a/src/gui/painting/qgraphicssystemcursor.cpp b/src/gui/painting/qgraphicssystemcursor.cpp
index 3afaf4bfbc..9a0e135142 100644
--- a/src/gui/painting/qgraphicssystemcursor.cpp
+++ b/src/gui/painting/qgraphicssystemcursor.cpp
@@ -39,7 +39,6 @@
**
****************************************************************************/
#include "qgraphicssystemcursor.h"
-//#include "qlighthousegraphicsscreen.h"
#include <QWidget>
#include <QPainter>
@@ -52,80 +51,53 @@ QT_BEGIN_NAMESPACE
QPointer<QGraphicsSystemCursor> QGraphicsSystemCursor::instance = 0;
-QGraphicsSystemCursor::QGraphicsSystemCursor(QGraphicsSystemScreen *scr )
- :currentRect(QRect()), prevRect(QRect()), screen(scr)
-{
- graphic = new QGraphicsSystemCursorImage(0, 0, 0, 0, 0, 0);
- instance = this;
- setCursor(Qt::ArrowCursor);
-}
+/*!
+ \class QGraphicsSystemCursor
-QGraphicsSystemCursor::~QGraphicsSystemCursor()
-{
-}
+ \brief The QGraphicsSystemCursor class provides information about
+ pointer device events (movement, buttons), and requests to change
+ the currently displayed cursor.
-void QGraphicsSystemCursor::setCursor(Qt::CursorShape shape)
-{
- graphic->set(shape);
-}
+ Note that QGraphicsSystemCursor does not include any graphics for
+ display. An application that sets a QCursor may provide its own
+ graphics.
-void QGraphicsSystemCursor::setCursor(const uchar *data, const uchar *mask, int width, int height, int hotX, int hotY)
-{
- graphic->set(data, mask, width, height, hotX, hotY);
-}
+ \sa QGraphicsSystemCursorImage
+*/
-QRect QGraphicsSystemCursor::dirtyRect()
-{
- if (!prevRect.isNull()) {
- QRect rect = prevRect;
- prevRect = QRect();
- return rect;
- }
- return QRect();
-}
+/*!
+ \fn virtual void pointerEvent(const QMouseEvent & event)
-QRect QGraphicsSystemCursor::drawCursor(QPainter & painter)
-{
- if (currentRect.isNull())
- return QRect();
+ This method is called by Qt whenever a QMouseEvent is generated by the
+ underlying pointer input. \a event is a reference to the QMouseEvent in
+ question. A default do-nothing implementation is provided.
- prevRect = currentRect;
- painter.drawImage(prevRect, *graphic->image());
- return prevRect;
-}
+ \sa QApplicationPrivate::handleMouseEvent()
+*/
-QRect QGraphicsSystemCursor::getCurrentRect()
-{
- QRect rect = graphic->image()->rect().translated(-graphic->hotspot().x(),
- -graphic->hotspot().y());
- rect.translate(QCursor::pos());
- return rect;
-}
+/*!
+ \fn virtual void changeCursor(QCursor * widgetCursor, QWidget * widget)
-void QGraphicsSystemCursor::pointerEvent(const QMouseEvent & e)
-{
- Q_UNUSED(e);
- currentRect = getCurrentRect();
- screen->setDirty(currentRect);
-}
+ \brief This method is called by Qt whenever the cursor graphic should be changed.
+
+ Implementation of this method is mandatory for a subclass of QGraphicsSystemCursor.
+
+ \a widgetCursor is a pointer to the QCursor that should be displayed.
+
+ \a widget is a pointer to the widget currently displayed at QCursor::pos(). Note
+ that this may be 0 if the current position is not occupied by a displayed widget.
+
+ \sa QApplicationPrivate::handleMouseEvent(), QCursor::pos()
+*/
+
+/*!
+ Constructs a QGraphicsSystemCursor
-void QGraphicsSystemCursor::changeCursor(QCursor * widgetCursor, QWidget * widget)
+*/
+QGraphicsSystemCursor::QGraphicsSystemCursor(QGraphicsSystemScreen *scr )
+ : screen(scr)
{
- Q_UNUSED(widget);
- Qt::CursorShape shape = widgetCursor->shape();
-
- if (shape == Qt::BitmapCursor) {
- // application supplied cursor
- const QBitmap * map = widgetCursor->bitmap();
- const QBitmap * mask = widgetCursor->mask();
- QPoint spot = widgetCursor->hotSpot();
- setCursor(map->toImage().bits(), mask->toImage().bits(), map->width(), map->height(), spot.x(), spot.y());
- } else {
- // system cursor
- setCursor(shape);
- }
- currentRect = getCurrentRect();
- screen->setDirty(currentRect);
+ instance = this;
}
// End of display and pointer event handling code
@@ -541,6 +513,13 @@ void QGraphicsSystemCursorImage::set(Qt::CursorShape id)
hot = cursor->hot;
}
+void QGraphicsSystemCursorImage::set(const QImage * image, int hx, int hy)
+{
+ hot.setX(hx);
+ hot.setY(hy);
+ cursorImage = *image;
+}
+
void QGraphicsSystemCursorImage::set(const uchar *data, const uchar *mask,
int width, int height, int hx, int hy)
{
diff --git a/src/gui/painting/qgraphicssystemcursor.h b/src/gui/painting/qgraphicssystemcursor.h
index 776e0d57ef..0c5ffe1379 100644
--- a/src/gui/painting/qgraphicssystemcursor.h
+++ b/src/gui/painting/qgraphicssystemcursor.h
@@ -53,13 +53,14 @@ QT_BEGIN_NAMESPACE
#ifndef QT_NO_CURSOR
// Cursor graphics management
-class QGraphicsSystemCursorImage {
+class Q_GUI_EXPORT QGraphicsSystemCursorImage {
public:
QGraphicsSystemCursorImage(const uchar *data, const uchar *mask, int width, int height, int hotX, int hotY)
{ set(data, mask, width, height, hotX, hotY); }
QImage * image() { return &cursorImage; }
QPoint hotspot() { return hot; }
void set(const uchar *data, const uchar *mask, int width, int height, int hotX, int hotY);
+ void set(const QImage * image, int hx, int hy);
void set(Qt::CursorShape);
private:
static void createSystemCursor(int id);
@@ -70,34 +71,17 @@ private:
class Q_GUI_EXPORT QGraphicsSystemCursor : public QObject {
public:
QGraphicsSystemCursor(QGraphicsSystemScreen *);
- virtual ~QGraphicsSystemCursor();
// input methods
- virtual void pointerEvent(const QMouseEvent & event);
- virtual void changeCursor(QCursor * widgetCursor, QWidget * widget);
-
- // output methods
- virtual QRect drawCursor(QPainter &);
- virtual QRect dirtyRect();
+ virtual void pointerEvent(const QMouseEvent & event) { Q_UNUSED(event); }
+ virtual void changeCursor(QCursor * widgetCursor, QWidget * widget) = 0;
static QPointer<QGraphicsSystemCursor> getInstance() { return instance; }
protected:
- static QPointer<QGraphicsSystemCursor> instance;
-
- QRect currentRect; // next place to draw the cursor
- QRect prevRect; // last place the cursor was drawn
+ static QPointer<QGraphicsSystemCursor> instance; // limit 1 cursor at a time
QGraphicsSystemScreen * screen; // Where to request an update
- QWidget * currentWidget; // widget currently under the cursor
-
- QGraphicsSystemCursorImage * graphic;
-
-private:
-
- void setCursor(const uchar *data, const uchar *mask, int width, int height, int hotX, int hotY);
- void setCursor(Qt::CursorShape shape);
- QRect getCurrentRect();
};
#endif // QT_NO_CURSOR
diff --git a/src/gui/painting/qwindowsurface_p.h b/src/gui/painting/qwindowsurface_p.h
index 5e95d80842..1c0334c866 100644
--- a/src/gui/painting/qwindowsurface_p.h
+++ b/src/gui/painting/qwindowsurface_p.h
@@ -95,6 +95,7 @@ public:
virtual Qt::WindowFlags windowFlags() const;
virtual WId winId() const;
+ virtual void setWindowTitle(const QString &) {}
virtual void raise() { qWarning("This plugin does not support raise()"); }
virtual void lower() { qWarning("This plugin does not support lower()"); }
#endif