Changeset 769 for trunk/src/gui/kernel/qwidget_s60.cpp
- Timestamp:
- Aug 2, 2010, 9:27:30 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/vendor/nokia/qt/4.6.3 (added) merged: 768 /branches/vendor/nokia/qt/current merged: 767 /branches/vendor/nokia/qt/4.6.2 removed
- Property svn:mergeinfo changed
-
trunk/src/gui/kernel/qwidget_s60.cpp
r651 r769 388 388 drawableWindow->EnableVisibilityChangeEvents(); 389 389 390 if (!isOpaque) {391 RWindow *const window = static_cast<RWindow *>(drawableWindow);392 #ifdef Q_SYMBIAN_SEMITRANSPARENT_BG_SURFACE393 window->SetSurfaceTransparency(true);394 #else395 const TDisplayMode displayMode = static_cast<TDisplayMode>(window->SetRequiredDisplayMode(EColor16MA));396 if (window->SetTransparencyAlphaChannel() == KErrNone)397 window->SetBackgroundColor(TRgb(255, 255, 255, 0));398 #endif399 }400 390 } 401 391 … … 409 399 // this generates a WinIdChanged event. 410 400 setWinId(control.take()); 401 402 if (!desktop) 403 s60UpdateIsOpaque(); // must be called after setWinId() 411 404 412 405 } else if (q->testAttribute(Qt::WA_NativeWindow) || paintOnScreen()) { // create native child widget … … 488 481 489 482 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 490 521 491 522 id->MakeVisible(true); … … 1038 1069 } 1039 1070 1071 static 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 1040 1082 void QWidget::setWindowState(Qt::WindowStates newstate) 1041 1083 { … … 1043 1085 1044 1086 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) 1046 1094 return; 1047 1095 1048 1096 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); 1049 1102 1050 1103 QSymbianControl *window = static_cast<QSymbianControl *>(effectiveWinId()); … … 1059 1112 #ifdef Q_WS_S60 1060 1113 // 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 1063 1116 // 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)); 1067 1120 if (statusPane) 1068 1121 statusPane->MakeVisible(visible); 1069 if (buttonGroup) 1070 buttonGroup->MakeVisible(visible); 1122 if (buttonGroup) { 1123 // Visibility 1124 buttonGroup->MakeVisible(visible || (isFullscreen && cbaRequested)); 1125 } 1071 1126 #endif // Q_WS_S60 1072 1127 1073 createWinId();1074 Q_ASSERT(testAttribute(Qt::WA_WState_Created));1075 1128 // Ensure the initial size is valid, since we store it as normalGeometry below. 1076 if (! testAttribute(Qt::WA_Resized)&& !isVisible())1129 if (!wasResized && !isVisible()) 1077 1130 adjustSize(); 1078 1131 1079 1132 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 1087 1152 setGeometry(normalGeometry); 1153 } 1088 1154 1089 1155 //restore normal geometry 1090 1156 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 } 1091 1166 } 1092 1167 … … 1221 1296 if (!qt_nograb() && QWidgetPrivate::mouseGrabber == this) { 1222 1297 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 } 1225 1302 QWidgetPrivate::mouseGrabber = 0; 1226 1303 #ifndef QT_NO_CURSOR
Note:
See TracChangeset
for help on using the changeset viewer.