diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2010-10-08 19:19:33 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2010-10-08 19:19:33 (GMT) |
commit | 9c7cb0dcd6b302186feb5ee5dc82987fd791a946 (patch) | |
tree | f6ddb8ab49f58bcfdcc67c7be09aaa2f62919923 /src/gui/kernel | |
parent | 46c36d6a939b6d808348106164663b8f732c090b (diff) | |
parent | 1966b88611bb45d18d586847eeb3597d6e022eb7 (diff) | |
download | Qt-9c7cb0dcd6b302186feb5ee5dc82987fd791a946.zip Qt-9c7cb0dcd6b302186feb5ee5dc82987fd791a946.tar.gz Qt-9c7cb0dcd6b302186feb5ee5dc82987fd791a946.tar.bz2 |
Merge branch 'master' of scm.dev.nokia.troll.no:qt/oslo-staging-2 into master-integration
* 'master' of scm.dev.nokia.troll.no:qt/oslo-staging-2:
Experimental support of the unified toolbar with
Diffstat (limited to 'src/gui/kernel')
-rw-r--r-- | src/gui/kernel/qcocoaview_mac.mm | 11 | ||||
-rw-r--r-- | src/gui/kernel/qt_cocoa_helpers_mac.mm | 7 | ||||
-rw-r--r-- | src/gui/kernel/qt_cocoa_helpers_mac_p.h | 2 | ||||
-rw-r--r-- | src/gui/kernel/qwidget.cpp | 14 | ||||
-rw-r--r-- | src/gui/kernel/qwidget.h | 4 | ||||
-rw-r--r-- | src/gui/kernel/qwidget_p.h | 7 |
6 files changed, 43 insertions, 2 deletions
diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm index 8576f52..2016d40 100644 --- a/src/gui/kernel/qcocoaview_mac.mm +++ b/src/gui/kernel/qcocoaview_mac.mm @@ -534,7 +534,7 @@ static int qCocoaViewCount = 0; return; // We use a different graphics system. - if (QApplicationPrivate::graphicsSystem() != 0) { + if (QApplicationPrivate::graphicsSystem() != 0 && !qwidgetprivate->isInUnifiedToolbar) { // Qt handles the painting occuring inside the window. // Cocoa also keeps track of all widgets as NSView and therefore might @@ -558,6 +558,15 @@ static int qCocoaViewCount = 0; CGContextRef cg = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort]; qwidgetprivate->hd = cg; + + // We steal the CGContext for flushing in the unified toolbar with the raster engine. + if (QApplicationPrivate::graphicsSystem() != 0 && qwidgetprivate->isInUnifiedToolbar) { + qwidgetprivate->cgContext = cg; + qwidgetprivate->hasOwnContext = true; + qwidgetprivate->unifiedSurface->flush(qwidget, qwidgetprivate->ut_rg, qwidgetprivate->ut_pt); + return; + } + CGContextSaveGState(cg); if (qwidget->isVisible() && qwidget->updatesEnabled()) { //process the actual paint event. diff --git a/src/gui/kernel/qt_cocoa_helpers_mac.mm b/src/gui/kernel/qt_cocoa_helpers_mac.mm index 2dd3791..cce9daa 100644 --- a/src/gui/kernel/qt_cocoa_helpers_mac.mm +++ b/src/gui/kernel/qt_cocoa_helpers_mac.mm @@ -1561,6 +1561,13 @@ void qt_cocoaStackChildWindowOnTopOfOtherChildren(QWidget *childWidget) } } +void qt_mac_display(QWidget *widget) +{ + NSView *theNSView = qt_mac_nativeview_for(widget); + [theNSView display]; + return; +} + #endif // QT_MAC_USE_COCOA QT_END_NAMESPACE diff --git a/src/gui/kernel/qt_cocoa_helpers_mac_p.h b/src/gui/kernel/qt_cocoa_helpers_mac_p.h index 5c23392..04c2d06 100644 --- a/src/gui/kernel/qt_cocoa_helpers_mac_p.h +++ b/src/gui/kernel/qt_cocoa_helpers_mac_p.h @@ -227,6 +227,8 @@ void qt_cocoaPostMessage(id target, SEL selector, int argCount=0, id arg1=0, id void qt_mac_post_retranslateAppMenu(); +void qt_mac_display(QWidget *widget); + QT_END_NAMESPACE #endif // QT_COCOA_HELPERS_MAC_P_H diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 11bcd26..a75fc38 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -304,6 +304,9 @@ QWidgetPrivate::QWidgetPrivate(int version) drawRectOriginalAdded = false; originalDrawMethod = true; changeMethods = false; + hasOwnContext = false; + isInUnifiedToolbar = false; + unifiedSurface = 0; #endif // QT_MAC_USE_COCOA #ifdef QWIDGET_EXTRA_DEBUG static int count = 0; @@ -5319,6 +5322,14 @@ void QWidgetPrivate::drawWidget(QPaintDevice *pdev, const QRegion &rgn, const QP if (rgn.isEmpty()) return; +#ifdef Q_WS_MAC + // We disable the rendering of QToolBar in the backingStore if + // it's supposed to be in the unified toolbar on Mac OS X. + if (backingStore && isInUnifiedToolbar) + return; +#endif // Q_WS_MAC + + Q_Q(QWidget); #ifndef QT_NO_GRAPHICSEFFECT if (graphicsEffect && graphicsEffect->isEnabled()) { @@ -5381,6 +5392,7 @@ void QWidgetPrivate::drawWidget(QPaintDevice *pdev, const QRegion &rgn, const QP QPaintEngine *paintEngine = pdev->paintEngine(); if (paintEngine) { setRedirected(pdev, -offset); + #ifdef Q_WS_MAC // (Alien support) Special case for Mac when redirecting: If the paint device // is of the Widget type we need to set WA_WState_InPaintEvent since painting @@ -5423,7 +5435,7 @@ void QWidgetPrivate::drawWidget(QPaintDevice *pdev, const QRegion &rgn, const QP //actually send the paint event QPaintEvent e(toBePainted); QCoreApplication::sendSpontaneousEvent(q, &e); -#if !defined(Q_WS_MAC) && !defined(Q_WS_QWS) +#if !defined(Q_WS_QWS) if (backingStore && !onScreen && !asRoot && (q->internalWinId() || !q->nativeParentWidget()->isWindow())) backingStore->markDirtyOnScreen(toBePainted, q, offset); #endif diff --git a/src/gui/kernel/qwidget.h b/src/gui/kernel/qwidget.h index 980f40f..81b3618 100644 --- a/src/gui/kernel/qwidget.h +++ b/src/gui/kernel/qwidget.h @@ -97,6 +97,8 @@ class QWindowSurface; class QLocale; class QGraphicsProxyWidget; class QGraphicsEffect; +class QRasterWindowSurface; +class QUnifiedToolbarSurface; #if defined(Q_WS_X11) class QX11Info; #endif @@ -758,6 +760,8 @@ private: friend OSViewRef qt_mac_nativeview_for(const QWidget *w); friend void qt_event_request_window_change(QWidget *widget); friend bool qt_mac_sendMacEventToWidget(QWidget *widget, EventRef ref); + friend class QRasterWindowSurface; + friend class QUnifiedToolbarSurface; #endif #ifdef Q_WS_QWS friend class QWSBackingStore; diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h index a8ddfe7..ee3ca59 100644 --- a/src/gui/kernel/qwidget_p.h +++ b/src/gui/kernel/qwidget_p.h @@ -843,6 +843,13 @@ public: bool originalDrawMethod; // Do we need to change the methods? bool changeMethods; + bool hasOwnContext; + CGContextRef cgContext; + QRegion ut_rg; + QPoint ut_pt; + bool isInUnifiedToolbar; + QWindowSurface *unifiedSurface; + QPoint toolbar_offset; #endif void determineWindowClass(); void transferChildren(); |