summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/kernel/kernel.pri2
-rw-r--r--src/gui/kernel/qapplication_qpa.cpp4
-rw-r--r--src/gui/kernel/qguiapplication_qpa.cpp12
-rw-r--r--src/gui/kernel/qplatformscreen_qpa.cpp5
-rw-r--r--src/gui/kernel/qplatformscreen_qpa.h3
-rw-r--r--src/gui/kernel/qwidget.cpp11
-rw-r--r--src/gui/kernel/qwidget.h1
-rw-r--r--src/gui/kernel/qwidget_p.h4
-rw-r--r--src/gui/kernel/qwidget_qpa.cpp5
-rw-r--r--src/gui/kernel/qwidgetwindow_qpa.cpp59
-rw-r--r--src/gui/kernel/qwidgetwindow_qpa_p.h74
-rw-r--r--src/gui/kernel/qwindow_qpa.cpp12
-rw-r--r--src/gui/kernel/qwindow_qpa.h9
-rw-r--r--src/gui/kernel/qwindow_qpa_p.h2
-rw-r--r--src/gui/painting/qbackingstore.cpp4
-rw-r--r--src/gui/painting/qgraphicssystem_p.h2
-rw-r--r--src/gui/painting/qwindowsurface.cpp96
-rw-r--r--src/gui/painting/qwindowsurface_p.h25
18 files changed, 215 insertions, 115 deletions
diff --git a/src/gui/kernel/kernel.pri b/src/gui/kernel/kernel.pri
index c77d62ad6d..798d6aaf6f 100644
--- a/src/gui/kernel/kernel.pri
+++ b/src/gui/kernel/kernel.pri
@@ -230,6 +230,7 @@ qpa {
kernel/qwindowformat_qpa.h \
kernel/qguiapplication_qpa.h \
kernel/qguiapplication_qpa_p.h \
+ kernel/qwidgetwindow_qpa_p.h \
kernel/qwindow_qpa_p.h \
kernel/qwindow_qpa.h
@@ -259,6 +260,7 @@ qpa {
kernel/qsessionmanager_qpa.cpp \
kernel/qwindowformat_qpa.cpp \
kernel/qguiapplication_qpa.cpp \
+ kernel/qwidgetwindow_qpa.cpp \
kernel/qwindow_qpa.cpp
contains(QT_CONFIG, glib) {
diff --git a/src/gui/kernel/qapplication_qpa.cpp b/src/gui/kernel/qapplication_qpa.cpp
index 94b6cd5c41..a1c120183a 100644
--- a/src/gui/kernel/qapplication_qpa.cpp
+++ b/src/gui/kernel/qapplication_qpa.cpp
@@ -117,7 +117,7 @@ static bool qt_try_modal(QWidget *widget, QEvent::Type type)
-void QApplicationPrivate::enterModal_sys(QWidget *widget)
+void QApplicationPrivate::enterModal_sys(QWidget *)
{
#if 0
if (!qt_modal_stack)
@@ -127,7 +127,7 @@ void QApplicationPrivate::enterModal_sys(QWidget *widget)
#endif
}
-void QApplicationPrivate::leaveModal_sys(QWidget *widget )
+void QApplicationPrivate::leaveModal_sys(QWidget *)
{
#if 0
if (qt_modal_stack && qt_modal_stack->removeAll(widget)) {
diff --git a/src/gui/kernel/qguiapplication_qpa.cpp b/src/gui/kernel/qguiapplication_qpa.cpp
index e5fcf4445e..7a6c184fff 100644
--- a/src/gui/kernel/qguiapplication_qpa.cpp
+++ b/src/gui/kernel/qguiapplication_qpa.cpp
@@ -388,7 +388,7 @@ void QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mo
QWindow *window = e->window.data();
- QWidget * tlw = window ? window->widget() : 0;
+ QWidget * tlw = 0;//window ? window->widget() : 0;
QPoint localPoint = e->localPos;
QPoint globalPoint = e->globalPos;
@@ -512,10 +512,12 @@ void QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mo
implicit_mouse_grabber.clear();
}
+#if 0
if (mouseWidget != qt_last_mouse_receiver) {
// dispatchEnterLeave(mouseWidget, qt_last_mouse_receiver);
qt_last_mouse_receiver = mouseWidget;
}
+#endif
// Remember, we might enter a modal event loop when sending the event,
// so think carefully before adding code below this point.
@@ -561,7 +563,7 @@ void QGuiApplicationPrivate::processWheelEvent(QWindowSystemInterfacePrivate::Wh
if (!window)
return;
- QWidget *mouseWidget = window ? window->widget() : 0;
+ QWidget *mouseWidget = 0;//window ? window->widget() : 0;
// find the tlw if we didn't get it from the plugin
#if 0
@@ -605,7 +607,7 @@ void QGuiApplicationPrivate::processKeyEvent(QWindowSystemInterfacePrivate::KeyE
if (!window)
return;
- QObject *target = window->widget() ? static_cast<QObject *>(window->widget()) : static_cast<QObject *>(window);
+ QObject *target = window;//window->widget() ? static_cast<QObject *>(window->widget()) : static_cast<QObject *>(window);
#if 0
QWidget *focusW = 0;
@@ -643,7 +645,7 @@ void QGuiApplicationPrivate::processKeyEvent(QWindowSystemInterfacePrivate::KeyE
void QGuiApplicationPrivate::processEnterEvent(QWindowSystemInterfacePrivate::EnterEvent *e)
{
// QGuiApplicationPrivate::dispatchEnterLeave(e->enter.data(),0);
- qt_last_mouse_receiver = e->enter.data() ? e->enter.data()->widget() : 0;
+// qt_last_mouse_receiver = e->enter.data();
}
void QGuiApplicationPrivate::processLeaveEvent(QWindowSystemInterfacePrivate::LeaveEvent *)
@@ -672,7 +674,7 @@ void QGuiApplicationPrivate::processGeometryChangeEvent(QWindowSystemInterfacePr
if (!window)
return;
- QWidget *tlw = window->widget();
+ QWidget *tlw = 0;//window->widget();
QObject *target = tlw ? static_cast<QObject *>(tlw) : static_cast<QObject *>(window);
QRect newRect = e->newGeometry;
diff --git a/src/gui/kernel/qplatformscreen_qpa.cpp b/src/gui/kernel/qplatformscreen_qpa.cpp
index 4fd6896a95..79059de4f7 100644
--- a/src/gui/kernel/qplatformscreen_qpa.cpp
+++ b/src/gui/kernel/qplatformscreen_qpa.cpp
@@ -95,6 +95,11 @@ QPlatformScreen * QPlatformScreen::platformScreenForWidget(const QWidget *widget
return integration->screens()[screenIndex];
}
+QPlatformScreen * QPlatformScreen::platformScreenForWindow(const QWindow *window)
+{
+ return QGuiApplicationPrivate::platformIntegration()->screens().at(0);
+}
+
/*!
\class QPlatformScreen
\since 4.8
diff --git a/src/gui/kernel/qplatformscreen_qpa.h b/src/gui/kernel/qplatformscreen_qpa.h
index b3bb121331..cbaf5b9c47 100644
--- a/src/gui/kernel/qplatformscreen_qpa.h
+++ b/src/gui/kernel/qplatformscreen_qpa.h
@@ -77,6 +77,9 @@ public:
//jl: should this function be in QPlatformIntegration
//jl: maybe screenForWidget is a better name?
static QPlatformScreen *platformScreenForWidget(const QWidget *widget);
+
+ // temporary convenience
+ static QPlatformScreen *platformScreenForWindow(const QWindow *window);
};
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp
index d107bf1df9..f6c95719c2 100644
--- a/src/gui/kernel/qwidget.cpp
+++ b/src/gui/kernel/qwidget.cpp
@@ -78,6 +78,7 @@
#endif
#if defined(Q_WS_QPA)
#include "qplatformwindow_qpa.h"
+#include "private/qwidgetwindow_qpa_p.h"
#endif
#include "qpainter.h"
#include "qtooltip.h"
@@ -358,9 +359,9 @@ QWidgetPrivate::~QWidgetPrivate()
class QDummyWindowSurface : public QWindowSurface
{
public:
- QDummyWindowSurface(QWidget *window) : QWindowSurface(window) {}
- QPaintDevice *paintDevice() { return window(); }
- void flush(QWidget *, const QRegion &, const QPoint &) {}
+ QDummyWindowSurface(QWindow *window) : QWindowSurface(window) {}
+ QPaintDevice *paintDevice() { return static_cast<QWidgetWindow *>(window())->widget(); }
+ void flush(QWindow *, const QRegion &, const QPoint &) {}
};
QWindowSurface *QWidgetPrivate::createDefaultWindowSurface()
@@ -370,12 +371,12 @@ QWindowSurface *QWidgetPrivate::createDefaultWindowSurface()
QWindowSurface *surface;
#ifndef QT_NO_PROPERTIES
if (q->property("_q_DummyWindowSurface").toBool()) {
- surface = new QDummyWindowSurface(q);
+ surface = new QDummyWindowSurface(q->windowHandle());
} else
#endif
{
if (QApplicationPrivate::graphicsSystem())
- surface = QApplicationPrivate::graphicsSystem()->createWindowSurface(q);
+ surface = QApplicationPrivate::graphicsSystem()->createWindowSurface(q->windowHandle());
else
surface = createDefaultWindowSurface_sys();
}
diff --git a/src/gui/kernel/qwidget.h b/src/gui/kernel/qwidget.h
index 3ba0d3e2f0..03643646f8 100644
--- a/src/gui/kernel/qwidget.h
+++ b/src/gui/kernel/qwidget.h
@@ -761,6 +761,7 @@ private:
friend class QGraphicsProxyWidgetPrivate;
friend class QStyleSheetStyle;
friend struct QWidgetExceptionCleaner;
+ friend class QWidgetWindow;
#ifndef QT_NO_GESTURES
friend class QGestureManager;
friend class QWinNativePanGestureRecognizer;
diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h
index e9e9ff8c72..7826cab795 100644
--- a/src/gui/kernel/qwidget_p.h
+++ b/src/gui/kernel/qwidget_p.h
@@ -103,7 +103,7 @@ class QWSManager;
class QCoreGraphicsPaintEnginePrivate;
#endif
#if defined(Q_WS_QPA)
-class QWindow;
+class QWidgetWindow;
#endif
class QPaintEngine;
class QPixmap;
@@ -233,7 +233,7 @@ struct QTLWExtra {
uint inExpose : 1; // Prevents drawing recursion
uint nativeWindowTransparencyEnabled : 1; // Tracks native window transparency
#elif defined(Q_WS_QPA)
- QWindow *window;
+ QWidgetWindow *window;
quint32 screenIndex; // index in qplatformscreenlist
#endif
};
diff --git a/src/gui/kernel/qwidget_qpa.cpp b/src/gui/kernel/qwidget_qpa.cpp
index 75c54a2c55..aef49dd212 100644
--- a/src/gui/kernel/qwidget_qpa.cpp
+++ b/src/gui/kernel/qwidget_qpa.cpp
@@ -44,6 +44,7 @@
#include "QtGui/qapplication.h"
#include "QtGui/private/qbackingstore_p.h"
#include "QtGui/private/qwidget_p.h"
+#include "QtGui/private/qwidgetwindow_qpa_p.h"
#include "QtGui/private/qgraphicssystem_p.h"
#include "QtGui/private/qapplication_p.h"
#include "QtGui/qdesktopwidget.h"
@@ -102,6 +103,7 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO
if (!surface ) {
if (win) {
surface = QApplicationPrivate::platformIntegration()->createWindowSurface(win, win->winId());
+ q->setWindowSurface(surface);
} else {
q->setAttribute(Qt::WA_PaintOnScreen,true);
}
@@ -700,8 +702,7 @@ void QWidgetPrivate::createTLSysExtra()
{
Q_Q(QWidget);
extra->topextra->screenIndex = 0;
- extra->topextra->window = new QWindow;
- extra->topextra->window->setWidget(q);
+ extra->topextra->window = new QWidgetWindow(q);
}
void QWidgetPrivate::deleteTLSysExtra()
diff --git a/src/gui/kernel/qwidgetwindow_qpa.cpp b/src/gui/kernel/qwidgetwindow_qpa.cpp
new file mode 100644
index 0000000000..8ab6c9cec3
--- /dev/null
+++ b/src/gui/kernel/qwidgetwindow_qpa.cpp
@@ -0,0 +1,59 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qwidgetwindow_qpa_p.h"
+
+QT_BEGIN_NAMESPACE
+
+QWidgetWindow::QWidgetWindow(QWidget *widget)
+ : m_widget(widget)
+{
+}
+
+bool QWidgetWindow::event(QEvent *event)
+{
+ if (m_widget->event(event))
+ return true;
+
+ return QWindow::event(event);
+}
+
+QT_END_NAMESPACE
diff --git a/src/gui/kernel/qwidgetwindow_qpa_p.h b/src/gui/kernel/qwidgetwindow_qpa_p.h
new file mode 100644
index 0000000000..3768d655b7
--- /dev/null
+++ b/src/gui/kernel/qwidgetwindow_qpa_p.h
@@ -0,0 +1,74 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QWIDGETWINDOW_QPA_P_H
+#define QWIDGETWINDOW_QPA_P_H
+
+#include <QtGui/qwindow_qpa.h>
+
+#include <QtCore/private/qobject_p.h>
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+QT_MODULE(Gui)
+
+class QWidgetWindow : public QWindow
+{
+ Q_OBJECT
+public:
+ QWidgetWindow(QWidget *widget);
+
+ QWidget *widget() const { return m_widget; }
+
+protected:
+ bool event(QEvent *);
+
+private:
+ QWidget *m_widget;
+};
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif // QWIDGETWINDOW_QPA_P_H
diff --git a/src/gui/kernel/qwindow_qpa.cpp b/src/gui/kernel/qwindow_qpa.cpp
index 6822664664..67eeb94e72 100644
--- a/src/gui/kernel/qwindow_qpa.cpp
+++ b/src/gui/kernel/qwindow_qpa.cpp
@@ -66,18 +66,6 @@ QWindow::~QWindow()
destroy();
}
-QWidget *QWindow::widget() const
-{
- Q_D(const QWindow);
- return d->widget;
-}
-
-void QWindow::setWidget(QWidget *widget)
-{
- Q_D(QWindow);
- d->widget = widget;
-}
-
void QWindow::setVisible(bool visible)
{
Q_D(QWindow);
diff --git a/src/gui/kernel/qwindow_qpa.h b/src/gui/kernel/qwindow_qpa.h
index 2e9de57cb6..b13cf9165b 100644
--- a/src/gui/kernel/qwindow_qpa.h
+++ b/src/gui/kernel/qwindow_qpa.h
@@ -53,7 +53,6 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Gui)
class QWindowPrivate;
-class QWidget;
class QResizeEvent;
class QShowEvent;
@@ -84,18 +83,18 @@ public:
QWindow(QWindow *parent = 0);
virtual ~QWindow();
- // to be removed at some point in the future
- QWidget *widget() const;
- void setWidget(QWidget *widget);
-
void setVisible(bool visible);
bool visible() const;
void create();
WId winId() const;
+
+ QWindow *parent() const;
void setParent(QWindow *parent);
+ QWindow *topLevelWindow() const;
+
void setWindowFormat(const QWindowFormat &format);
QWindowFormat requestedWindowFormat() const;
QWindowFormat actualWindowFormat() const;
diff --git a/src/gui/kernel/qwindow_qpa_p.h b/src/gui/kernel/qwindow_qpa_p.h
index 5a1b8cdcdd..06458290f1 100644
--- a/src/gui/kernel/qwindow_qpa_p.h
+++ b/src/gui/kernel/qwindow_qpa_p.h
@@ -62,7 +62,6 @@ public:
, platformWindow(0)
, visible(false)
, glContext(0)
- , widget(0)
{
isWindow = true;
}
@@ -81,7 +80,6 @@ public:
QString windowTitle;
QRect geometry;
QWindowContext *glContext;
- QWidget *widget;
};
diff --git a/src/gui/painting/qbackingstore.cpp b/src/gui/painting/qbackingstore.cpp
index 42c1c354b6..7ec878c39d 100644
--- a/src/gui/painting/qbackingstore.cpp
+++ b/src/gui/painting/qbackingstore.cpp
@@ -114,9 +114,9 @@ static inline void qt_flush(QWidget *widget, const QRegion &region, QWindowSurfa
}
}
if (widget != tlw)
- windowSurface->flush(widget, region, tlwOffset + widget->mapTo(tlw, QPoint()));
+ windowSurface->flush(widget->windowHandle(), region, tlwOffset + widget->mapTo(tlw, QPoint()));
else
- windowSurface->flush(widget, region, tlwOffset);
+ windowSurface->flush(widget->windowHandle(), region, tlwOffset);
}
#ifndef QT_NO_PAINT_DEBUG
diff --git a/src/gui/painting/qgraphicssystem_p.h b/src/gui/painting/qgraphicssystem_p.h
index 0f99a311a6..2271d4dba6 100644
--- a/src/gui/painting/qgraphicssystem_p.h
+++ b/src/gui/painting/qgraphicssystem_p.h
@@ -69,7 +69,7 @@ class Q_GUI_EXPORT QGraphicsSystem
public:
virtual QPixmapData *createPixmapData(QPixmapData::PixelType type) const = 0;
virtual QPixmapData *createPixmapData(QPixmapData *origin);
- virtual QWindowSurface *createWindowSurface(QWidget *widget) const = 0;
+ virtual QWindowSurface *createWindowSurface(QWindow *window) const = 0;
virtual ~QGraphicsSystem();
diff --git a/src/gui/painting/qwindowsurface.cpp b/src/gui/painting/qwindowsurface.cpp
index 0fb9bf78a9..97fb7a9972 100644
--- a/src/gui/painting/qwindowsurface.cpp
+++ b/src/gui/painting/qwindowsurface.cpp
@@ -40,8 +40,8 @@
****************************************************************************/
#include <private/qwindowsurface_p.h>
-#include <qwidget.h>
-#include <private/qwidget_p.h>
+#include <qwindow_qpa.h>
+#include <private/qwindow_qpa_p.h>
#include <private/qbackingstore_p.h>
#include <private/qapplication_p.h>
@@ -50,19 +50,18 @@ QT_BEGIN_NAMESPACE
class QWindowSurfacePrivate
{
public:
- QWindowSurfacePrivate(QWidget *w)
+ QWindowSurfacePrivate(QWindow *w)
: window(w)
{
}
- QWidget *window;
+ QWindow *window;
#if !defined(Q_WS_QPA)
QRect geometry;
#else
QSize size;
#endif //Q_WS_QPA
QRegion staticContents;
- QList<QImage*> bufferImages;
};
/*!
@@ -96,10 +95,10 @@ public:
*/
/*!
- \fn void QWindowSurface::flush(QWidget *widget, const QRegion &region,
+ \fn void QWindowSurface::flush(QWindow *window, const QRegion &region,
const QPoint &offset)
- Flushes the given \a region from the specified \a widget onto the
+ Flushes the given \a region from the specified \a window onto the
screen.
Note that the \a offset parameter is currently unused.
@@ -114,13 +113,15 @@ public:
/*!
Constructs an empty surface for the given top-level \a window.
*/
-QWindowSurface::QWindowSurface(QWidget *window, bool setDefaultSurface)
+QWindowSurface::QWindowSurface(QWindow *window, bool /*setDefaultSurface*/)
: d_ptr(new QWindowSurfacePrivate(window))
{
+#if 0
if (!QApplicationPrivate::runtime_graphics_system) {
- if(setDefaultSurface && window)
+ if (setDefaultSurface && window)
window->setWindowSurface(this);
}
+#endif
}
/*!
@@ -128,8 +129,8 @@ QWindowSurface::QWindowSurface(QWidget *window, bool setDefaultSurface)
*/
QWindowSurface::~QWindowSurface()
{
- if (d_ptr->window)
- d_ptr->window->d_func()->extra->topextra->windowSurface = 0;
+// if (d_ptr->window)
+// d_ptr->window->d_func()->extra->topextra->windowSurface = 0;
delete d_ptr;
}
@@ -137,7 +138,7 @@ QWindowSurface::~QWindowSurface()
Returns a pointer to the top-level window associated with this
surface.
*/
-QWidget* QWindowSurface::window() const
+QWindow* QWindowSurface::window() const
{
return d_ptr->window;
}
@@ -149,8 +150,6 @@ void QWindowSurface::beginPaint(const QRegion &)
void QWindowSurface::endPaint(const QRegion &)
{
// QApplication::syncX();
- qDeleteAll(d_ptr->bufferImages);
- d_ptr->bufferImages.clear();
}
#if !defined(Q_WS_QPA)
@@ -211,67 +210,35 @@ bool QWindowSurface::scroll(const QRegion &area, int dx, int dy)
}
/*!
- Returns a QImage pointer which represents the actual buffer the \a widget
- is drawn into or 0 if this is unavailable.
-
- You must call beginPaint() before you call this function and the returned
- pointer is only valid until endPaint() is called.
-*/
-QImage* QWindowSurface::buffer(const QWidget *widget)
-{
- if (widget->window() != window())
- return 0;
-
- QPaintDevice *pdev = paintDevice();
- if (!pdev || pdev->devType() != QInternal::Image)
- return 0;
-
- const QPoint off = offset(widget);
- QImage *img = static_cast<QImage*>(pdev);
-
- QRect rect(off, widget->size());
- rect &= QRect(QPoint(), img->size());
-
- if (rect.isEmpty())
- return 0;
-
- img = new QImage(img->scanLine(rect.y()) + rect.x() * img->depth() / 8,
- rect.width(), rect.height(),
- img->bytesPerLine(), img->format());
- d_ptr->bufferImages.append(img);
-
- return img;
-}
-
-/*!
Returns a QPixmap generated from the part of the backing store
- corresponding to \a widget. Returns a null QPixmap if an error
+ corresponding to \a window. Returns a null QPixmap if an error
occurs. The contents of the pixmap are only defined for the regions
- of \a widget that have received paint events since the last resize
+ of \a window that have received paint events since the last resize
of the backing store.
- If \a rectangle is a null rectangle (the default), the entire widget
+ If \a rectangle is a null rectangle (the default), the entire window
is grabbed. Otherwise, the grabbed area is limited to \a rectangle.
The default implementation uses QWindowSurface::buffer().
- \sa QPixmap::grabWidget()
+ \sa QPixmap::grabWindow()
*/
-QPixmap QWindowSurface::grabWidget(const QWidget *widget, const QRect &rectangle) const
+QPixmap QWindowSurface::grabWindow(const QWindow *, const QRect &) const
{
QPixmap result;
- if (widget->window() != window())
+#if 0
+ if (window->window() != window())
return result;
- const QImage *img = const_cast<QWindowSurface *>(this)->buffer(widget->window());
+ const QImage *img = const_cast<QWindowSurface *>(this)->buffer(window->window());
if (!img || img->isNull())
return result;
- QRect rect = rectangle.isEmpty() ? widget->rect() : (widget->rect() & rectangle);
+ QRect rect = rectangle.isEmpty() ? window->rect() : (window->rect() & rectangle);
- rect.translate(offset(widget) - offset(widget->window()));
+ rect.translate(offset(window) - offset(window->window()));
rect &= QRect(QPoint(), img->size());
if (rect.isEmpty())
@@ -283,27 +250,28 @@ QPixmap QWindowSurface::grabWidget(const QWidget *widget, const QRect &rectangle
subimg.detach(); //### expensive -- maybe we should have a real SubImage that shares reference count
result = QPixmap::fromImage(subimg);
+#endif
return result;
}
/*!
- Returns the offset of \a widget in the coordinates of this
+ Returns the offset of \a window in the coordinates of this
window surface.
*/
-QPoint QWindowSurface::offset(const QWidget *widget) const
+QPoint QWindowSurface::offset(const QWindow *) const
{
- QWidget *window = d_ptr->window;
- QPoint offset = widget->mapTo(window, QPoint());
-#ifdef Q_WS_QWS
- offset += window->geometry().topLeft() - window->frameGeometry().topLeft();
+ QPoint offset;
+#if 0
+ QWindow *window = d_ptr->window;
+ QPoint offset = window->mapTo(window, QPoint());
#endif
return offset;
}
/*!
- \fn QRect QWindowSurface::rect(const QWidget *widget) const
+ \fn QRect QWindowSurface::rect(const QWindow *window) const
- Returns the rectangle for \a widget in the coordinates of this
+ Returns the rectangle for \a window in the coordinates of this
window surface.
*/
diff --git a/src/gui/painting/qwindowsurface_p.h b/src/gui/painting/qwindowsurface_p.h
index a3fea67f24..9d3e95e1ca 100644
--- a/src/gui/painting/qwindowsurface_p.h
+++ b/src/gui/painting/qwindowsurface_p.h
@@ -53,7 +53,7 @@
// We mean it.
//
-#include <QtGui/qwidget.h>
+#include <QtGui/qwindow_qpa.h>
QT_BEGIN_NAMESPACE
@@ -76,18 +76,18 @@ public:
};
Q_DECLARE_FLAGS(WindowSurfaceFeatures, WindowSurfaceFeature)
- QWindowSurface(QWidget *window, bool setDefaultSurface = true);
+ QWindowSurface(QWindow *window, bool setDefaultSurface = true);
virtual ~QWindowSurface();
- QWidget *window() const;
+ QWindow *window() const;
virtual QPaintDevice *paintDevice() = 0;
- // 'widget' can be a child widget, in which case 'region' is in child widget coordinates and
- // offset is the (child) widget's offset in relation to the window surface. On QWS, 'offset'
- // can be larger than just the offset from the top-level widget as there may also be window
+ // 'window' can be a child window, in which case 'region' is in child window coordinates and
+ // offset is the (child) window's offset in relation to the window surface. On QWS, 'offset'
+ // can be larger than just the offset from the top-level window as there may also be window
// decorations which are painted into the window surface.
- virtual void flush(QWidget *widget, const QRegion &region, const QPoint &offset) = 0;
+ virtual void flush(QWindow *window, const QRegion &region, const QPoint &offset) = 0;
#if !defined(Q_WS_QPA)
virtual void setGeometry(const QRect &rect);
QRect geometry() const;
@@ -102,11 +102,10 @@ public:
virtual void beginPaint(const QRegion &);
virtual void endPaint(const QRegion &);
- virtual QImage* buffer(const QWidget *widget);
- virtual QPixmap grabWidget(const QWidget *widget, const QRect& rectangle = QRect()) const;
+ virtual QPixmap grabWindow(const QWindow *window, const QRect& rectangle = QRect()) const;
- virtual QPoint offset(const QWidget *widget) const;
- inline QRect rect(const QWidget *widget) const;
+ virtual QPoint offset(const QWindow *window) const;
+ inline QRect rect(const QWindow *window) const;
bool hasFeature(WindowSurfaceFeature feature) const;
virtual WindowSurfaceFeatures features() const;
@@ -123,9 +122,9 @@ private:
Q_DECLARE_OPERATORS_FOR_FLAGS(QWindowSurface::WindowSurfaceFeatures)
-inline QRect QWindowSurface::rect(const QWidget *widget) const
+inline QRect QWindowSurface::rect(const QWindow *window) const
{
- return widget->rect().translated(offset(widget));
+ return window->geometry().translated(offset(window));
}
inline bool QWindowSurface::hasFeature(WindowSurfaceFeature feature) const