diff options
author | Lars Knoll <lars.knoll@nokia.com> | 2012-04-17 12:58:41 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@nokia.com> | 2012-04-17 12:58:52 +0200 |
commit | 64255ef6502b1144f7b0aa4b2bf62803e0d4788b (patch) | |
tree | 29bf116bfda2ccf61057115690d14f85cc9b085b /src/gui/kernel/qguiapplication.cpp | |
parent | 4a9fb41a7947d0bb7a47a9625603a436df288b24 (diff) | |
parent | 7e0beba891cb963a1d535bd45b0be78b43b8d07f (diff) |
Merge remote-tracking branch 'origin/api_changes'
Change-Id: I964b0a6f5c38351fdfafb8a2a128a349ff8c89d1
Diffstat (limited to 'src/gui/kernel/qguiapplication.cpp')
-rw-r--r-- | src/gui/kernel/qguiapplication.cpp | 55 |
1 files changed, 22 insertions, 33 deletions
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index 2c2d833209..f7675f5267 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -148,7 +148,6 @@ bool QGuiApplicationPrivate::obey_desktop_settings = true; static qreal fontSmoothingGamma = 1.7; extern void qRegisterGuiVariant(); -extern void qUnregisterGuiVariant(); extern void qInitDrawhelperAsm(); extern void qInitImageConversions(); @@ -363,8 +362,6 @@ QGuiApplication::~QGuiApplication() clearPalette(); - qUnregisterGuiVariant(); - #ifndef QT_NO_CURSOR d->cursor_list.clear(); #endif @@ -1127,12 +1124,6 @@ void QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePriv QGuiApplicationPrivate::processThemeChanged( static_cast<QWindowSystemInterfacePrivate::ThemeChangeEvent *>(e)); break; - case QWindowSystemInterfacePrivate::Map: - QGuiApplicationPrivate::processMapEvent(static_cast<QWindowSystemInterfacePrivate::MapEvent *>(e)); - break; - case QWindowSystemInterfacePrivate::Unmap: - QGuiApplicationPrivate::processUnmapEvent(static_cast<QWindowSystemInterfacePrivate::UnmapEvent *>(e)); - break; case QWindowSystemInterfacePrivate::Expose: QGuiApplicationPrivate::processExposeEvent(static_cast<QWindowSystemInterfacePrivate::ExposeEvent *>(e)); break; @@ -1295,8 +1286,9 @@ void QGuiApplicationPrivate::processKeyEvent(QWindowSystemInterfacePrivate::KeyE return; } - QKeyEventEx ev(e->keyType, e->key, e->modifiers, e->unicode, e->repeat, e->repeatCount, - e->nativeScanCode, e->nativeVirtualKey, e->nativeModifiers); + QKeyEvent ev(e->keyType, e->key, e->modifiers, + e->nativeScanCode, e->nativeVirtualKey, e->nativeModifiers, + e->unicode, e->repeat, e->repeatCount); ev.setTimestamp(e->timestamp); QGuiApplication::sendSpontaneousEvent(window, &ev); } @@ -1788,30 +1780,28 @@ void QGuiApplicationPrivate::reportLogicalDotsPerInchChange(QWindowSystemInterfa emit s->logicalDotsPerInchChanged(s->logicalDotsPerInch()); } -void QGuiApplicationPrivate::processMapEvent(QWindowSystemInterfacePrivate::MapEvent *e) +void QGuiApplicationPrivate::processExposeEvent(QWindowSystemInterfacePrivate::ExposeEvent *e) { - if (!e->mapped) + if (!e->exposed) return; - QEvent event(QEvent::Map); - QCoreApplication::sendSpontaneousEvent(e->mapped.data(), &event); -} + QWindow *window = e->exposed.data(); + QWindowPrivate *p = qt_window_private(window); -void QGuiApplicationPrivate::processUnmapEvent(QWindowSystemInterfacePrivate::UnmapEvent *e) -{ - if (!e->unmapped) - return; + if (!p->receivedExpose) { + if (p->resizeEventPending) { + // as a convenience for plugins, send a resize event before the first expose event if they haven't done so + QSize size = p->geometry.size(); + QResizeEvent e(size, size); + QGuiApplication::sendSpontaneousEvent(window, &e); - QEvent event(QEvent::Unmap); - QCoreApplication::sendSpontaneousEvent(e->unmapped.data(), &event); -} + p->resizeEventPending = false; + } -void QGuiApplicationPrivate::processExposeEvent(QWindowSystemInterfacePrivate::ExposeEvent *e) -{ - if (!e->exposed) - return; + p->receivedExpose = true; + } - QWindow *window = e->exposed.data(); + p->exposed = e->isExposed; QExposeEvent exposeEvent(e->region); QCoreApplication::sendSpontaneousEvent(window, &exposeEvent); @@ -2160,12 +2150,11 @@ void QGuiApplication::restoreOverrideCursor() \sa QStyleHints */ -QStyleHints *QGuiApplication::styleHints() const +QStyleHints *QGuiApplication::styleHints() { - Q_D(const QGuiApplication); - if (!d->styleHints) - const_cast<QGuiApplicationPrivate *>(d)->styleHints = new QStyleHints(); - return d->styleHints; + if (!qGuiApp->d_func()->styleHints) + qGuiApp->d_func()->styleHints = new QStyleHints(); + return qGuiApp->d_func()->styleHints; } /*! |