Ignore:
Timestamp:
Aug 2, 2010, 9:27:30 PM (15 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.6.3 sources from branches/vendor/nokia/qt.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/gui/kernel/qwidget_s60.cpp

    r651 r769  
    388388            drawableWindow->EnableVisibilityChangeEvents();
    389389
    390             if (!isOpaque) {
    391                 RWindow *const window = static_cast<RWindow *>(drawableWindow);
    392 #ifdef Q_SYMBIAN_SEMITRANSPARENT_BG_SURFACE
    393                 window->SetSurfaceTransparency(true);
    394 #else
    395                 const TDisplayMode displayMode = static_cast<TDisplayMode>(window->SetRequiredDisplayMode(EColor16MA));
    396                 if (window->SetTransparencyAlphaChannel() == KErrNone)
    397                     window->SetBackgroundColor(TRgb(255, 255, 255, 0));
    398 #endif
    399             }
    400390        }
    401391
     
    409399        // this generates a WinIdChanged event.
    410400        setWinId(control.take());
     401
     402        if (!desktop)
     403            s60UpdateIsOpaque(); // must be called after setWinId()
    411404
    412405    } else if (q->testAttribute(Qt::WA_NativeWindow) || paintOnScreen()) { // create native child widget
     
    488481
    489482         QSymbianControl *id = static_cast<QSymbianControl *>(q->internalWinId());
     483
     484#ifdef Q_WS_S60
     485        // Lazily initialize the S60 screen furniture when the first window is shown.
     486        if (!QApplication::testAttribute(Qt::AA_S60DontConstructApplicationPanes)
     487                && !S60->buttonGroupContainer() && !S60->statusPane()) {
     488
     489            bool isFullscreen = q->windowState() & Qt::WindowFullScreen;
     490
     491            if (!q->testAttribute(Qt::WA_DontShowOnScreen)) {
     492
     493                // Create the status pane and CBA here
     494                CEikAppUi *ui = static_cast<CEikAppUi *>(S60->appUi());
     495                MEikAppUiFactory *factory = CEikonEnv::Static()->AppUiFactory();
     496                TRAP_IGNORE(factory->ReadAppInfoResourceL(0, ui));
     497                if (S60->buttonGroupContainer())
     498                    S60->buttonGroupContainer()->SetCommandSetL(R_AVKON_SOFTKEYS_EMPTY_WITH_IDS);
     499
     500                if (S60->statusPane()) {
     501                    // Use QDesktopWidget as the status pane observer to proxy for the AppUi.
     502                    // Can't use AppUi directly because it privately inherits from MEikStatusPaneObserver.
     503                    QSymbianControl *desktopControl = static_cast<QSymbianControl *>(QApplication::desktop()->winId());
     504                    S60->statusPane()->SetObserver(desktopControl);
     505
     506                    // Hide the status pane if fullscreen OR
     507                    // Fill client area if maximized OR
     508                    // Put window below status pane unless the window has an explicit position.
     509                    if (isFullscreen) {
     510                        S60->statusPane()->MakeVisible(false);
     511                    } else if (q->windowState() & Qt::WindowMaximized) {
     512                        TRect r = static_cast<CEikAppUi*>(S60->appUi())->ClientRect();
     513                        id->SetExtent(r.iTl, r.Size());
     514                    } else if (!q->testAttribute(Qt::WA_Moved)) {
     515                        id->SetPosition(static_cast<CEikAppUi*>(S60->appUi())->ClientRect().iTl);
     516                    }
     517                }
     518            }
     519        }
     520#endif
    490521
    491522        id->MakeVisible(true);
     
    10381069}
    10391070
     1071static Qt::WindowStates effectiveState(Qt::WindowStates state)
     1072{
     1073    if (state & Qt::WindowMinimized)
     1074        return Qt::WindowMinimized;
     1075    else if (state & Qt::WindowFullScreen)
     1076        return Qt::WindowFullScreen;
     1077    else if (state & Qt::WindowMaximized)
     1078        return Qt::WindowMaximized;
     1079    return Qt::WindowNoState;
     1080}
     1081
    10401082void QWidget::setWindowState(Qt::WindowStates newstate)
    10411083{
     
    10431085
    10441086    Qt::WindowStates oldstate = windowState();
    1045     if (oldstate == newstate)
     1087
     1088    const TBool isFullscreen = newstate & Qt::WindowFullScreen;
     1089    const TBool cbaRequested = windowFlags() & Qt::WindowSoftkeysVisibleHint;
     1090    const TBool cbaVisible = CEikButtonGroupContainer::Current() ? true : false;
     1091    const TBool softkeyVisibilityChange = isFullscreen && (cbaRequested != cbaVisible);
     1092
     1093    if (oldstate == newstate && !softkeyVisibilityChange)
    10461094        return;
    10471095
    10481096    if (isWindow()) {
     1097        createWinId();
     1098        Q_ASSERT(testAttribute(Qt::WA_WState_Created));
     1099
     1100        const bool wasResized = testAttribute(Qt::WA_Resized);
     1101        const bool wasMoved = testAttribute(Qt::WA_Moved);
    10491102
    10501103        QSymbianControl *window = static_cast<QSymbianControl *>(effectiveWinId());
     
    10591112#ifdef Q_WS_S60
    10601113        // Hide window decoration when switching to fullsccreen / minimized otherwise show decoration.
    1061         // The window decoration visibility has to be changed before doing actual window state 
    1062         // change since in that order the availableGeometry will return directly the right size and 
     1114        // The window decoration visibility has to be changed before doing actual window state
     1115        // change since in that order the availableGeometry will return directly the right size and
    10631116        // we will avoid unnecessarty redraws
    1064         CEikStatusPane* statusPane = S60->statusPane();
    1065         CEikButtonGroupContainer* buttonGroup = S60->buttonGroupContainer();
    1066         TBool visible = !(newstate & (Qt::WindowFullScreen | Qt::WindowMinimized)); 
     1117        CEikStatusPane *statusPane = S60->statusPane();
     1118        CEikButtonGroupContainer *buttonGroup = S60->buttonGroupContainer();
     1119        TBool visible = !(newstate & (Qt::WindowFullScreen | Qt::WindowMinimized));
    10671120        if (statusPane)
    10681121            statusPane->MakeVisible(visible);
    1069         if (buttonGroup)
    1070             buttonGroup->MakeVisible(visible);
     1122        if (buttonGroup) {
     1123            // Visibility
     1124            buttonGroup->MakeVisible(visible || (isFullscreen && cbaRequested));
     1125        }
    10711126#endif // Q_WS_S60
    10721127
    1073         createWinId();
    1074         Q_ASSERT(testAttribute(Qt::WA_WState_Created));
    10751128        // Ensure the initial size is valid, since we store it as normalGeometry below.
    1076         if (!testAttribute(Qt::WA_Resized) && !isVisible())
     1129        if (!wasResized && !isVisible())
    10771130            adjustSize();
    10781131
    10791132        QTLWExtra *top = d->topData();
    1080         const QRect normalGeometry = (top->normalGeometry.width() < 0) ? geometry() : top->normalGeometry;
    1081 
    1082         if (newstate & Qt::WindowFullScreen)
    1083             setGeometry(qApp->desktop()->screenGeometry(this));
    1084         else if (newstate & Qt::WindowMaximized)
    1085             setGeometry(qApp->desktop()->availableGeometry(this));
    1086         else
     1133        QRect normalGeometry = (top->normalGeometry.width() < 0) ? geometry() : top->normalGeometry;
     1134
     1135        const bool cbaVisibilityHint = windowFlags() & Qt::WindowSoftkeysVisibleHint;
     1136        if (newstate & Qt::WindowFullScreen && !cbaVisibilityHint) {
     1137            window->SetExtentToWholeScreen();
     1138        } else if (newstate & Qt::WindowMaximized || ((newstate & Qt::WindowFullScreen) && cbaVisibilityHint)) {
     1139            TRect maxExtent = qt_QRect2TRect(qApp->desktop()->availableGeometry(this));
     1140            window->SetExtent(maxExtent.iTl, maxExtent.Size());
     1141        } else {
     1142#ifdef Q_WS_S60
     1143            // With delayed creation of S60 app panes, the normalGeometry calculated above is not
     1144            // accurate because it did not consider the status pane. This means that when returning
     1145            // normal mode after showing the status pane, the geometry would overlap so we should
     1146            // move it if it never had an explicit position.
     1147            if (!wasMoved && statusPane && visible) {
     1148                TPoint tl = static_cast<CEikAppUi*>(S60->appUi())->ClientRect().iTl;
     1149                normalGeometry.setTopLeft(QPoint(tl.iX, tl.iY));
     1150            }
     1151#endif
    10871152            setGeometry(normalGeometry);
     1153        }
    10881154
    10891155        //restore normal geometry
    10901156        top->normalGeometry = normalGeometry;
     1157
     1158        // FixMe QTBUG-8977
     1159        // In some platforms, WA_Resized and WA_Moved are also not set when application window state is
     1160        // anything else than normal. In Symbian we can restore them only for normal window state since
     1161        // restoring for other modes, will make fluidlauncher to be launched in wrong size (200x100)
     1162        if (effectiveState(newstate) == Qt::WindowNoState) {
     1163            setAttribute(Qt::WA_Resized, wasResized);
     1164            setAttribute(Qt::WA_Moved, wasMoved);
     1165        }
    10911166    }
    10921167
     
    12211296    if (!qt_nograb() && QWidgetPrivate::mouseGrabber == this) {
    12221297        Q_ASSERT(testAttribute(Qt::WA_WState_Created));
    1223         WId id = effectiveWinId();
    1224         id->SetPointerCapture(false);
     1298        if(!window()->isModal()) {
     1299            WId id = effectiveWinId();
     1300            id->SetPointerCapture(false);
     1301        }
    12251302        QWidgetPrivate::mouseGrabber = 0;
    12261303#ifndef QT_NO_CURSOR
Note: See TracChangeset for help on using the changeset viewer.