summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel
diff options
context:
space:
mode:
authorOlivier Goffart <olivier.goffart@nokia.com>2010-06-08 10:02:23 (GMT)
committerOlivier Goffart <olivier.goffart@nokia.com>2010-06-08 10:02:23 (GMT)
commit03dc74984749adf5b11482bf871a47086217845c (patch)
tree58eaa299c0d87d6d678fe635fddaab42177328cf /src/gui/kernel
parentdfd7c876263310c03d8b64033749efe2b6b1e081 (diff)
parent0cd433404210fdaa6b21a98ef5768c9b761ed024 (diff)
downloadQt-03dc74984749adf5b11482bf871a47086217845c.zip
Qt-03dc74984749adf5b11482bf871a47086217845c.tar.gz
Qt-03dc74984749adf5b11482bf871a47086217845c.tar.bz2
Merge remote branch 'origin/4.6' into qt-4.7-from-4.6
Conflicts: src/3rdparty/webkit/VERSION src/3rdparty/webkit/WebCore/ChangeLog src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp src/3rdparty/webkit/WebKit/qt/ChangeLog src/gui/painting/qpainter.cpp src/gui/painting/qtextureglyphcache.cpp src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp src/opengl/gl2paintengineex/qtextureglyphcache_gl_p.h src/s60installs/bwins/QtGuiu.def src/s60installs/eabi/QtCoreu.def src/s60installs/eabi/QtGuiu.def src/s60installs/eabi/QtNetworku.def src/s60installs/eabi/QtOpenVGu.def tests/auto/qfontmetrics/tst_qfontmetrics.cpp tools/linguist/lupdate/main.cpp
Diffstat (limited to 'src/gui/kernel')
-rw-r--r--src/gui/kernel/qapplication_s60.cpp27
-rw-r--r--src/gui/kernel/qapplication_win.cpp2
-rw-r--r--src/gui/kernel/qapplication_x11.cpp2
-rw-r--r--src/gui/kernel/qwidget.cpp57
-rw-r--r--src/gui/kernel/qwidget_p.h44
-rw-r--r--src/gui/kernel/qwidget_s60.cpp10
6 files changed, 115 insertions, 27 deletions
diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp
index 8ab82c9..a50fd95 100644
--- a/src/gui/kernel/qapplication_s60.cpp
+++ b/src/gui/kernel/qapplication_s60.cpp
@@ -1032,6 +1032,9 @@ void QSymbianControl::SizeChanged()
qwidget->d_func()->syncBackingStore();
if (!slowResize && tlwExtra)
tlwExtra->inTopLevelResize = false;
+ } else {
+ QResizeEvent *e = new QResizeEvent(newSize, oldSize);
+ QApplication::postEvent(qwidget, e);
}
}
@@ -1800,19 +1803,27 @@ int QApplicationPrivate::symbianProcessWsEvent(const QSymbianEvent *symbianEvent
return 1;
const TWsVisibilityChangedEvent *visChangedEvent = event->VisibilityChanged();
QWidget *w = QWidgetPrivate::mapper->value(control);
- if (!w->d_func()->maybeTopData())
+ QWidget *const window = w->window();
+ if (!window->d_func()->maybeTopData())
break;
+ QRefCountedWidgetBackingStore &backingStore = window->d_func()->maybeTopData()->backingStore;
if (visChangedEvent->iFlags & TWsVisibilityChangedEvent::ENotVisible) {
- delete w->d_func()->topData()->backingStore;
- w->d_func()->topData()->backingStore = 0;
+ // Decrement backing store reference count
+ backingStore.deref();
// In order to ensure that any resources used by the window surface
// are immediately freed, we flush the WSERV command buffer.
S60->wsSession().Flush();
- } else if ((visChangedEvent->iFlags & TWsVisibilityChangedEvent::EPartiallyVisible)
- && !w->d_func()->maybeBackingStore()) {
- w->d_func()->topData()->backingStore = new QWidgetBackingStore(w);
- w->d_func()->invalidateBuffer(w->rect());
- w->repaint();
+ } else if (visChangedEvent->iFlags & TWsVisibilityChangedEvent::EPartiallyVisible) {
+ if (backingStore.data()) {
+ // Increment backing store reference count
+ backingStore.ref();
+ } else {
+ // Create backing store with an initial reference count of 1
+ backingStore.create(window);
+ backingStore.ref();
+ w->d_func()->invalidateBuffer(w->rect());
+ w->repaint();
+ }
}
return 1;
}
diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp
index c52fbdf..09535fa 100644
--- a/src/gui/kernel/qapplication_win.cpp
+++ b/src/gui/kernel/qapplication_win.cpp
@@ -1550,7 +1550,7 @@ extern "C" LRESULT QT_WIN_CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wPa
case WM_SETTINGCHANGE:
#ifdef Q_WS_WINCE
// CE SIP hide/show
- if (wParam == SPI_SETSIPINFO) {
+ if (qt_desktopWidget && wParam == SPI_SETSIPINFO) {
QResizeEvent re(QSize(0, 0), QSize(0, 0)); // Calculated by QDesktopWidget
QApplication::sendEvent(qt_desktopWidget, &re);
break;
diff --git a/src/gui/kernel/qapplication_x11.cpp b/src/gui/kernel/qapplication_x11.cpp
index 78fc704..3664743 100644
--- a/src/gui/kernel/qapplication_x11.cpp
+++ b/src/gui/kernel/qapplication_x11.cpp
@@ -5268,7 +5268,7 @@ bool QETWidget::translateConfigEvent(const XEvent *event)
if (isVisible() && data->crect.size() != oldSize) {
Q_ASSERT(d->extra->topextra);
- QWidgetBackingStore *bs = d->extra->topextra->backingStore;
+ QWidgetBackingStore *bs = d->extra->topextra->backingStore.data();
const bool hasStaticContents = bs && bs->hasStaticContents();
// If we have a backing store with static contents, we have to disable the top-level
// resize optimization in order to get invalidated regions for resized widgets.
diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp
index 2fc76ed..895c85d 100644
--- a/src/gui/kernel/qwidget.cpp
+++ b/src/gui/kernel/qwidget.cpp
@@ -161,6 +161,51 @@ static inline bool hasBackingStoreSupport()
extern bool qt_sendSpontaneousEvent(QObject*, QEvent*); // qapplication.cpp
extern QDesktopWidget *qt_desktopWidget; // qapplication.cpp
+
+QRefCountedWidgetBackingStore::QRefCountedWidgetBackingStore()
+ : m_ptr(0)
+ , m_count(0)
+{
+
+}
+
+QRefCountedWidgetBackingStore::~QRefCountedWidgetBackingStore()
+{
+ delete m_ptr;
+}
+
+void QRefCountedWidgetBackingStore::create(QWidget *widget)
+{
+ destroy();
+ m_ptr = new QWidgetBackingStore(widget);
+ m_count = 0;
+}
+
+void QRefCountedWidgetBackingStore::destroy()
+{
+ delete m_ptr;
+ m_ptr = 0;
+ m_count = 0;
+}
+
+void QRefCountedWidgetBackingStore::ref()
+{
+ Q_ASSERT(m_ptr);
+ ++m_count;
+}
+
+void QRefCountedWidgetBackingStore::deref()
+{
+ if (m_count) {
+ Q_ASSERT(m_ptr);
+ if (0 == --m_count) {
+ delete m_ptr;
+ m_ptr = 0;
+ }
+ }
+}
+
+
QWidgetPrivate::QWidgetPrivate(int version)
: QObjectPrivate(version)
, extra(0)
@@ -1350,11 +1395,9 @@ void QWidget::create(WId window, bool initializeWindow, bool destroyOldWindow)
// a real toplevel window needs a backing store
if (isWindow() && windowType() != Qt::Desktop) {
- delete d->topData()->backingStore;
- // QWidgetBackingStore will check this variable, hence it must be 0
- d->topData()->backingStore = 0;
+ d->topData()->backingStore.destroy();
if (hasBackingStoreSupport())
- d->topData()->backingStore = new QWidgetBackingStore(this);
+ d->topData()->backingStore.create(this);
}
d->setModal_sys();
@@ -1482,8 +1525,7 @@ QWidget::~QWidget()
// the backing store will delete its window surface, which may or may
// not have a reference to this widget that will be used later to
// notify the window it no longer has a surface.
- delete d->extra->topextra->backingStore;
- d->extra->topextra->backingStore = 0;
+ d->extra->topextra->backingStore.destroy();
}
#endif
if (QWidgetBackingStore *bs = d->maybeBackingStore()) {
@@ -1580,7 +1622,6 @@ void QWidgetPrivate::createTLExtra()
QTLWExtra* x = extra->topextra = new QTLWExtra;
x->icon = 0;
x->iconPixmap = 0;
- x->backingStore = 0;
x->windowSurface = 0;
x->sharedPainter = 0;
x->incw = x->inch = 0;
@@ -1664,7 +1705,7 @@ void QWidgetPrivate::deleteExtra()
#endif
if (extra->topextra) {
deleteTLSysExtra();
- delete extra->topextra->backingStore;
+ extra->topextra->backingStore.destroy();
delete extra->topextra->icon;
delete extra->topextra->iconPixmap;
#if defined(Q_WS_QWS) && !defined(QT_NO_QWS_MANAGER)
diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h
index f23a94c..49a2dc8 100644
--- a/src/gui/kernel/qwidget_p.h
+++ b/src/gui/kernel/qwidget_p.h
@@ -110,13 +110,53 @@ class QWidgetItemV2;
class QStyle;
+class Q_AUTOTEST_EXPORT QRefCountedWidgetBackingStore
+{
+public:
+ QRefCountedWidgetBackingStore();
+ ~QRefCountedWidgetBackingStore();
+
+ void create(QWidget *tlw);
+ void destroy();
+
+ void ref();
+ void deref();
+
+ inline QWidgetBackingStore* data()
+ {
+ return m_ptr;
+ }
+
+ inline QWidgetBackingStore* operator->()
+ {
+ return m_ptr;
+ }
+
+ inline QWidgetBackingStore& operator*()
+ {
+ return *m_ptr;
+ }
+
+ inline operator bool() const
+ {
+ return (0 != m_ptr);
+ }
+
+private:
+ Q_DISABLE_COPY(QRefCountedWidgetBackingStore)
+
+private:
+ QWidgetBackingStore* m_ptr;
+ int m_count;
+};
+
struct QTLWExtra {
// *************************** Cross-platform variables *****************************
// Regular pointers (keep them together to avoid gaps on 64 bits architectures).
QIcon *icon; // widget icon
QPixmap *iconPixmap;
- QWidgetBackingStore *backingStore;
+ QRefCountedWidgetBackingStore backingStore;
QWindowSurface *windowSurface;
QPainter *sharedPainter;
@@ -932,7 +972,7 @@ inline QWidgetBackingStore *QWidgetPrivate::maybeBackingStore() const
{
Q_Q(const QWidget);
QTLWExtra *x = q->window()->d_func()->maybeTopData();
- return x ? x->backingStore : 0;
+ return x ? x->backingStore.data() : 0;
}
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp
index 02e7cb8..86b858d 100644
--- a/src/gui/kernel/qwidget_s60.cpp
+++ b/src/gui/kernel/qwidget_s60.cpp
@@ -433,6 +433,7 @@ void QWidgetPrivate::create_sys(WId window, bool /* initializeWindow */, bool de
// Request mouse move events.
drawableWindow->PointerFilter(EPointerFilterEnterExit
| EPointerFilterMove | EPointerFilterDrag, 0);
+ drawableWindow->EnableVisibilityChangeEvents();
if (q->isVisible() && q->testAttribute(Qt::WA_Mapped)) {
activateSymbianWindow(control.data());
@@ -487,11 +488,8 @@ void QWidgetPrivate::show_sys()
&& !S60->buttonGroupContainer() && !S60->statusPane()) {
bool isFullscreen = q->windowState() & Qt::WindowFullScreen;
- bool cbaRequested = q->windowFlags() & Qt::WindowSoftkeysVisibleHint;
- // If the window is fullscreen and has not explicitly requested that the CBA be visible
- // we delay the creation even more.
- if ((!isFullscreen || cbaRequested) && !q->testAttribute(Qt::WA_DontShowOnScreen)) {
+ if (!q->testAttribute(Qt::WA_DontShowOnScreen)) {
// Create the status pane and CBA here
CEikAppUi *ui = static_cast<CEikAppUi *>(S60->appUi());
@@ -911,14 +909,12 @@ void QWidgetPrivate::registerDropSite(bool /* on */)
void QWidgetPrivate::createTLSysExtra()
{
- extra->topextra->backingStore = 0;
extra->topextra->inExpose = 0;
}
void QWidgetPrivate::deleteTLSysExtra()
{
- delete extra->topextra->backingStore;
- extra->topextra->backingStore = 0;
+ extra->topextra->backingStore.destroy();
}
void QWidgetPrivate::createSysExtra()