Changeset 769 for trunk/src/gui/kernel
- Timestamp:
- Aug 2, 2010, 9:27:30 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 48 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/qapplication.cpp
r651 r769 139 139 QT_BEGIN_NAMESPACE 140 140 141 extern void qt_call_post_routines();141 Q_DECL_IMPORT extern void qt_call_post_routines(); 142 142 143 143 int QApplicationPrivate::app_compile_version = 0x040000; //we don't know exactly, but it's at least 4.0.0 … … 895 895 QWidgetPrivate::mapper = new QWidgetMapper; 896 896 QWidgetPrivate::allWidgets = new QWidgetSet; 897 898 #if !defined(Q_WS_X11) && !defined(Q_WS_QWS) 899 // initialize the graphics system - on X11 this is initialized inside 900 // qt_init() in qapplication_x11.cpp because of several reasons. 901 // On QWS, the graphics system is set by the QScreen plugin. 902 graphics_system = QGraphicsSystemFactory::create(graphics_system_name); 903 #endif 904 897 905 if (qt_appType != QApplication::Tty) 898 906 (void) QApplication::style(); // trigger creation of application style … … 929 937 qInitDrawhelperAsm(); 930 938 931 #if !defined(Q_WS_X11) && !defined(Q_WS_QWS)932 // initialize the graphics system - on X11 this is initialized inside933 // qt_init() in qapplication_x11.cpp because of several reasons.934 // On QWS, the graphics system is set by the QScreen plugin.935 graphics_system = QGraphicsSystemFactory::create(graphics_system_name);936 #endif937 939 #ifndef QT_NO_WHEELEVENT 938 940 QApplicationPrivate::wheel_scroll_lines = 3; -
trunk/src/gui/kernel/qapplication_mac.mm
r651 r769 2144 2144 2145 2145 if (wheel_deltaX || wheel_deltaY) { 2146 #ifndef QT_NO_WHEELEVENT 2146 2147 if (wheel_deltaX) { 2147 2148 QWheelEvent qwe(plocal, p, wheel_deltaX, buttons, modifiers, Qt::Horizontal); … … 2166 2167 } 2167 2168 } 2169 #endif // QT_NO_WHEELEVENT 2168 2170 } else { 2169 2171 #ifdef QMAC_SPEAK_TO_ME … … 2718 2720 } 2719 2721 2722 #ifndef QT_NO_WHEELEVENT 2720 2723 void QApplication::setWheelScrollLines(int n) 2721 2724 { … … 2727 2730 return QApplicationPrivate::wheel_scroll_lines; 2728 2731 } 2732 #endif 2729 2733 2730 2734 void QApplication::setEffectEnabled(Qt::UIEffect effect, bool enable) … … 2889 2893 QApplication::setCursorFlashTime(num); 2890 2894 2895 #ifndef QT_NO_WHEELEVENT 2891 2896 num = settings.value(QLatin1String("wheelScrollLines"), 2892 2897 QApplication::wheelScrollLines()).toInt(); 2893 2898 QApplication::setWheelScrollLines(num); 2899 #endif 2894 2900 2895 2901 QString colorspec = settings.value(QLatin1String("colorSpec"), -
trunk/src/gui/kernel/qapplication_p.h
r651 r769 429 429 static int mouse_double_click_time; 430 430 static int keyboard_input_time; 431 #ifndef QT_NO_WHEELEVENT 431 432 static int wheel_scroll_lines; 433 #endif 432 434 433 435 static bool animate_ui; … … 533 535 534 536 #if defined(Q_WS_WIN) 537 static bool HasTouchSupport; 535 538 static PtrRegisterTouchWindow RegisterTouchWindow; 536 539 static PtrGetTouchInputInfo GetTouchInputInfo; … … 568 571 #endif 569 572 570 #if defined(Q_WS_S60) 573 #if defined(Q_OS_SYMBIAN) 574 int pressureSupported; 571 575 int maxTouchPressure; 572 576 QList<QTouchEvent::TouchPoint> appAllTouchPoints; -
trunk/src/gui/kernel/qapplication_s60.cpp
r651 r769 53 53 #include "qdebug.h" 54 54 #include "qimage.h" 55 #include "qcombobox.h" 55 56 #include "private/qkeymapper_p.h" 56 57 #include "private/qfont_p.h" … … 64 65 65 66 #include "apgwgnam.h" // For CApaWindowGroupName 66 #include < MdaAudioTonePlayer.h> // For CMdaAudioToneUtility67 #include <mdaaudiotoneplayer.h> // For CMdaAudioToneUtility 67 68 68 69 #if defined(Q_WS_S60) … … 73 74 # include <private/qs60mainapplication_p.h> 74 75 # include <centralrepository.h> 76 # include "qs60mainappui.h" 75 77 #endif 76 78 … … 372 374 if (S60->curWin == this) 373 375 S60->curWin = 0; 374 if (!QApplicationPrivate::is_app_closing) 375 setFocusSafely(false); 376 if (!QApplicationPrivate::is_app_closing) { 377 QT_TRY { 378 setFocusSafely(false); 379 } QT_CATCH(const std::exception&) { 380 // ignore exceptions, nothing can be done 381 } 382 } 376 383 S60->appUi()->RemoveFromStack(this); 377 384 delete m_longTapDetector; … … 401 408 { 402 409 QApplicationPrivate *d = QApplicationPrivate::instance(); 410 qreal pressure; 411 if(d->pressureSupported 412 && event->Pressure() > 0) //workaround for misconfigured HAL 413 pressure = event->Pressure() / qreal(d->maxTouchPressure); 414 else 415 pressure = qreal(1.0); 403 416 404 417 QRect screenGeometry = qApp->desktop()->screenGeometry(qwidget); 405 418 406 while (d->appAllTouchPoints.count() <= event->PointerNumber()) 407 d->appAllTouchPoints.append(QTouchEvent::TouchPoint(d->appAllTouchPoints.count())); 419 QList<QTouchEvent::TouchPoint> points = d->appAllTouchPoints; 420 while (points.count() <= event->PointerNumber()) 421 points.append(QTouchEvent::TouchPoint(points.count())); 408 422 409 423 Qt::TouchPointStates allStates = 0; 410 for (int i = 0; i < d->appAllTouchPoints.count(); ++i) {411 QTouchEvent::TouchPoint &touchPoint = d->appAllTouchPoints[i];424 for (int i = 0; i < points.count(); ++i) { 425 QTouchEvent::TouchPoint &touchPoint = points[i]; 412 426 413 427 if (touchPoint.id() == event->PointerNumber()) { … … 434 448 touchPoint.setState(state); 435 449 436 QPointF screenPos = QPointF(event->iPosition.iX, event->iPosition.iY);450 QPointF screenPos = qwidget->mapToGlobal(QPoint(event->iPosition.iX, event->iPosition.iY)); 437 451 touchPoint.setScreenPos(screenPos); 438 452 touchPoint.setNormalizedPos(QPointF(screenPos.x() / screenGeometry.width(), 439 453 screenPos.y() / screenGeometry.height())); 440 454 441 touchPoint.setPressure( event->Pressure() / qreal(d->maxTouchPressure));455 touchPoint.setPressure(pressure); 442 456 } else if (touchPoint.state() != Qt::TouchPointReleased) { 443 457 // all other active touch points should be marked as stationary … … 451 465 // all touch points released 452 466 d->appAllTouchPoints.clear(); 467 } else { 468 d->appAllTouchPoints = points; 453 469 } 454 470 455 471 QApplicationPrivate::translateRawTouchEvent(qwidget, 456 472 QTouchEvent::TouchScreen, 457 d->appAllTouchPoints);473 points); 458 474 } 459 475 #endif … … 533 549 sendMouseEvent(receiver, type, globalPos, button, modifiers); 534 550 } 551 552 #ifdef Q_WS_S60 553 void QSymbianControl::HandleStatusPaneSizeChange() 554 { 555 QS60MainAppUi *s60AppUi = static_cast<QS60MainAppUi *>(S60->appUi()); 556 s60AppUi->HandleStatusPaneSizeChange(); 557 } 558 #endif 535 559 536 560 void QSymbianControl::sendMouseEvent( … … 598 622 keyEvent.iCode); 599 623 int keyCode; 600 if (s60Keysym >= 0x20 && s60Keysym < ENonCharacterKeyBase) { 624 if (s60Keysym == EKeyNull){ //some key events have 0 in iCode, for them iScanCode should be used 625 keyCode = qt_keymapper_private()->mapS60ScanCodesToQt(keyEvent.iScanCode); 626 } else if (s60Keysym >= 0x20 && s60Keysym < ENonCharacterKeyBase) { 601 627 // Normal characters keys. 602 628 keyCode = s60Keysym; … … 626 652 QPoint pos = QCursor::pos(); 627 653 TPointerEvent fakeEvent; 654 fakeEvent.iType = (TPointerEvent::TType)(-1); 628 655 TInt x = pos.x(); 629 656 TInt y = pos.y(); 630 657 if (type == EEventKeyUp) { 631 if (keyCode == Qt::Key_Select) 658 if (keyCode == Qt::Key_Select && 659 (S60->virtualMousePressedKeys & QS60Data::Select)) 632 660 fakeEvent.iType = TPointerEvent::EButton1Up; 633 661 S60->virtualMouseAccel = 1; … … 678 706 // down messages for some keys. Therefore, make sure we have a clean slate 679 707 // of pressed keys before starting a new button press. 680 if (S60->virtualMousePressedKeys != 0) { 681 S60->virtualMousePressedKeys |= QS60Data::Select; 708 if (S60->virtualMousePressedKeys & QS60Data::Select) { 682 709 return EKeyWasConsumed; 683 710 } else { … … 702 729 fakeEvent.iPosition = cpos; 703 730 fakeEvent.iParentPosition = epos; 704 HandlePointerEvent(fakeEvent); 731 if(fakeEvent.iType != -1) 732 HandlePointerEvent(fakeEvent); 705 733 return EKeyWasConsumed; 706 734 } … … 907 935 if (!slowResize && tlwExtra) 908 936 tlwExtra->inTopLevelResize = false; 937 } else { 938 QResizeEvent *e = new QResizeEvent(newSize, oldSize); 939 QApplication::postEvent(qwidget, e); 909 940 } 910 941 } … … 965 996 #ifdef Q_WS_S60 966 997 // If widget is fullscreen/minimized, hide status pane and button container otherwise show them. 967 CEikStatusPane *statusPane = S60->statusPane();968 CEikButtonGroupContainer *buttonGroup = S60->buttonGroupContainer();998 CEikStatusPane *statusPane = S60->statusPane(); 999 CEikButtonGroupContainer *buttonGroup = S60->buttonGroupContainer(); 969 1000 TBool visible = !(qwidget->windowState() & (Qt::WindowFullScreen | Qt::WindowMinimized)); 970 1001 if (statusPane) 971 1002 statusPane->MakeVisible(visible); 972 if (buttonGroup) 973 buttonGroup->MakeVisible(visible); 1003 if (buttonGroup) { 1004 // Visibility 1005 const TBool isFullscreen = qwidget->windowState() & Qt::WindowFullScreen; 1006 const TBool cbaVisibilityHint = qwidget->windowFlags() & Qt::WindowSoftkeysVisibleHint; 1007 buttonGroup->MakeVisible(visible || (isFullscreen && cbaVisibilityHint)); 1008 } 974 1009 #endif 975 1010 } else if (QApplication::activeWindow() == qwidget->window()) { 976 if (CCoeEnv::Static()->AppUi()->IsDisplayingMenuOrDialog() ) {1011 if (CCoeEnv::Static()->AppUi()->IsDisplayingMenuOrDialog() || S60->menuBeingConstructed) { 977 1012 QWidget *fw = QApplication::focusWidget(); 978 1013 if (fw) { … … 989 1024 } 990 1025 1026 void QSymbianControl::handleClientAreaChange() 1027 { 1028 const bool cbaVisibilityHint = qwidget->windowFlags() & Qt::WindowSoftkeysVisibleHint; 1029 if (qwidget->isFullScreen() && !cbaVisibilityHint) { 1030 SetExtentToWholeScreen(); 1031 } else if (qwidget->isMaximized() || (qwidget->isFullScreen() && cbaVisibilityHint)) { 1032 TRect r = static_cast<CEikAppUi*>(S60->appUi())->ClientRect(); 1033 SetExtent(r.iTl, r.Size()); 1034 } else if (!qwidget->isMinimized()) { // Normal geometry 1035 if (!qwidget->testAttribute(Qt::WA_Resized)) { 1036 qwidget->adjustSize(); 1037 qwidget->setAttribute(Qt::WA_Resized, false); //not a user resize 1038 } 1039 if (!qwidget->testAttribute(Qt::WA_Moved) && qwidget->windowType() != Qt::Dialog) { 1040 TRect r = static_cast<CEikAppUi*>(S60->appUi())->ClientRect(); 1041 SetPosition(r.iTl); 1042 qwidget->setAttribute(Qt::WA_Moved, false); // not really an explicit position 1043 } 1044 } 1045 } 1046 991 1047 void QSymbianControl::HandleResourceChange(int resourceType) 992 1048 { 993 1049 switch (resourceType) { 994 1050 case KInternalStatusPaneChange: 995 if (qwidget->isFullScreen()) { 996 SetExtentToWholeScreen(); 997 } else if (qwidget->isMaximized()) { 998 TRect r = static_cast<CEikAppUi*>(S60->appUi())->ClientRect(); 999 SetExtent(r.iTl, r.Size()); 1000 } 1051 handleClientAreaChange(); 1001 1052 if (IsFocused() && IsVisible()) { 1002 1053 qwidget->d_func()->setWindowIcon_sys(true); … … 1010 1061 case KEikDynamicLayoutVariantSwitch: 1011 1062 { 1012 if (qwidget->isFullScreen()) { 1013 SetExtentToWholeScreen(); 1014 } else if (qwidget->isMaximized()) { 1015 TRect r = static_cast<CEikAppUi*>(S60->appUi())->ClientRect(); 1016 SetExtent(r.iTl, r.Size()); 1017 } 1063 handleClientAreaChange(); 1018 1064 break; 1019 1065 } … … 1146 1192 #endif 1147 1193 S60->wsSession().SetAutoFlush(ETrue); 1194 1195 #ifdef Q_SYMBIAN_WINDOW_SIZE_CACHE 1196 TRAP_IGNORE(S60->wsSession().EnableWindowSizeCacheL()); 1197 #endif 1148 1198 1149 1199 S60->updateScreenSize(); … … 1209 1259 1210 1260 S60->avkonComponentsSupportTransparency = false; 1261 S60->menuBeingConstructed = false; 1211 1262 1212 1263 #ifdef Q_WS_S60 … … 1224 1275 } 1225 1276 } 1226 #endif 1277 #endif 1227 1278 1228 1279 if (touch) { … … 1379 1430 void QApplicationPrivate::openPopup(QWidget *popup) 1380 1431 { 1432 if (popup && qobject_cast<QComboBox *>(popup->parentWidget())) 1433 static_cast<QSymbianControl *>(popup->effectiveWinId())->FadeBehindPopup(ETrue); 1434 1381 1435 if (!QApplicationPrivate::popupWidgets) 1382 1436 QApplicationPrivate::popupWidgets = new QWidgetList; 1383 1437 QApplicationPrivate::popupWidgets->append(popup); 1384 1385 1438 1386 1439 // Cancel focus widget pointer capture and long tap timer … … 1422 1475 void QApplicationPrivate::closePopup(QWidget *popup) 1423 1476 { 1477 if (popup && qobject_cast<QComboBox *>(popup->parentWidget())) 1478 static_cast<QSymbianControl *>(popup->effectiveWinId())->FadeBehindPopup(EFalse); 1479 1424 1480 if (!QApplicationPrivate::popupWidgets) 1425 1481 return; … … 1445 1501 : q_func()->focusWidget(); 1446 1502 if (fw) { 1503 if(fw->window()->isModal()) // restore pointer capture for modal window 1504 fw->effectiveWinId()->SetPointerCapture(true); 1505 1447 1506 if (fw != q_func()->focusWidget()) { 1448 1507 fw->setFocus(Qt::PopupFocusReason); … … 1870 1929 { 1871 1930 #ifdef QT_SYMBIAN_SUPPORTS_ADVANCED_POINTER 1931 if (HAL::Get(HALData::EPointer3DPressureSupported, pressureSupported) != KErrNone) 1932 pressureSupported = 0; 1872 1933 if (HAL::Get(HALData::EPointer3DMaxPressure, maxTouchPressure) != KErrNone) 1873 1934 maxTouchPressure = KMaxTInt; -
trunk/src/gui/kernel/qapplication_win.cpp
r651 r769 116 116 #endif 117 117 118 #include "private/qwinnativepangesturerecognizer_win_p.h" 119 118 120 #ifndef WM_TOUCH 119 121 # define WM_TOUCH 0x0240 … … 929 931 bool icon; 930 932 QString cname; 931 if (flags & Qt::MSWindowsOwnDC) { 933 if (qt_widget_private(w)->isGLWidget) { 934 cname = QLatin1String("QGLWidget"); 935 style = CS_DBLCLKS; 936 icon = true; 937 } else if (flags & Qt::MSWindowsOwnDC) { 932 938 cname = QLatin1String("QWidgetOwnDC"); 933 939 style = CS_DBLCLKS; … … 1022 1028 wc.hCursor = 0; 1023 1029 #ifndef Q_WS_WINCE 1024 wc.hbrBackground = (HBRUSH)GetSysColorBrush(COLOR_WINDOW);1030 wc.hbrBackground = qt_widget_private(w)->isGLWidget ? 0 : (HBRUSH)GetSysColorBrush(COLOR_WINDOW); 1025 1031 #else 1026 1032 wc.hbrBackground = 0; … … 1902 1908 1903 1909 if (!msg.wParam) { 1910 #ifdef Q_WS_WINCE 1911 // On Windows CE, lParam parameter is a constant, not a char pointer. 1912 if (msg.lParam == INI_INTL) { 1913 #else 1904 1914 QString area = QString::fromWCharArray((wchar_t*)msg.lParam); 1905 1915 if (area == QLatin1String("intl")) { 1916 #endif 1906 1917 QLocalePrivate::updateSystemPrivate(); 1907 1918 if (!widget->testAttribute(Qt::WA_SetLocale)) … … 2437 2448 else 2438 2449 #ifndef QT_NO_MENUBAR 2439 QMenuBar::wceCommands(LOWORD(wParam) , (HWND) lParam);2450 QMenuBar::wceCommands(LOWORD(wParam)); 2440 2451 #endif 2441 2452 result = true; … … 2516 2527 result = false; 2517 2528 break; 2529 #if !defined(Q_WS_WINCE) || defined(QT_WINCE_GESTURES) 2518 2530 case WM_GESTURE: { 2519 2531 GESTUREINFO gi; … … 2548 2560 break; 2549 2561 } 2562 #endif // !defined(Q_WS_WINCE) || defined(QT_WINCE_GESTURES) 2550 2563 default: 2551 2564 result = false; // event was not processed … … 3617 3630 3618 3631 setAttribute(Qt::WA_PendingUpdate, false); 3619 const QRegion dirtyInBackingStore(qt_dirtyRegion(this)); 3620 // Make sure the invalidated region contains the region we're about to repaint. 3621 // BeginPaint will set the clip to the invalidated region and it is impossible 3622 // to enlarge it afterwards (only shrink it). Using GetDCEx is not suffient 3623 // as it may return an invalid context (especially on Windows Vista). 3624 if (!dirtyInBackingStore.isEmpty()) 3625 InvalidateRgn(internalWinId(), dirtyInBackingStore.handle(), false); 3632 3633 if (d_func()->isGLWidget) { 3634 if (d_func()->usesDoubleBufferedGLContext) 3635 InvalidateRect(internalWinId(), 0, false); 3636 } else { 3637 const QRegion dirtyInBackingStore(qt_dirtyRegion(this)); 3638 // Make sure the invalidated region contains the region we're about to repaint. 3639 // BeginPaint will set the clip to the invalidated region and it is impossible 3640 // to enlarge it afterwards (only shrink it). Using GetDCEx is not suffient 3641 // as it may return an invalid context (especially on Windows Vista). 3642 if (!dirtyInBackingStore.isEmpty()) 3643 InvalidateRgn(internalWinId(), dirtyInBackingStore.handle(), false); 3644 } 3626 3645 PAINTSTRUCT ps; 3627 3646 d_func()->hd = BeginPaint(internalWinId(), &ps); … … 3984 4003 3985 4004 4005 bool QApplicationPrivate::HasTouchSupport = false; 3986 4006 PtrRegisterTouchWindow QApplicationPrivate::RegisterTouchWindow = 0; 3987 4007 PtrGetTouchInputInfo QApplicationPrivate::GetTouchInputInfo = 0; … … 3990 4010 void QApplicationPrivate::initializeMultitouch_sys() 3991 4011 { 4012 static const IID QT_IID_IInkTablets = {0x112086D9, 0x7779, 0x4535, {0xA6, 0x99, 0x86, 0x2B, 0x43, 0xAC, 0x18, 0x63} }; 4013 static const IID QT_IID_IInkTablet2 = {0x90c91ad2, 0xfa36, 0x49d6, {0x95, 0x16, 0xce, 0x8d, 0x57, 0x0f, 0x6f, 0x85} }; 4014 static const CLSID QT_CLSID_InkTablets = {0x6E4FCB12, 0x510A, 0x4d40, {0x93, 0x04, 0x1D, 0xA1, 0x0A, 0xE9, 0x14, 0x7C} }; 4015 4016 IInkTablets *iInkTablets = 0; 4017 HRESULT hr = CoCreateInstance(QT_CLSID_InkTablets, NULL, CLSCTX_ALL, QT_IID_IInkTablets, (void**)&iInkTablets); 4018 if (SUCCEEDED(hr)) { 4019 long count = 0; 4020 iInkTablets->get_Count(&count); 4021 for (long i = 0; i < count; ++i) { 4022 IInkTablet *iInkTablet = 0; 4023 hr = iInkTablets->Item(i, &iInkTablet); 4024 if (FAILED(hr)) 4025 continue; 4026 IInkTablet2 *iInkTablet2 = 0; 4027 hr = iInkTablet->QueryInterface(QT_IID_IInkTablet2, (void**)&iInkTablet2); 4028 iInkTablet->Release(); 4029 if (FAILED(hr)) 4030 continue; 4031 TabletDeviceKind kind; 4032 hr = iInkTablet2->get_DeviceKind(&kind); 4033 iInkTablet2->Release(); 4034 if (FAILED(hr)) 4035 continue; 4036 if (kind == TDK_Touch) { 4037 QApplicationPrivate::HasTouchSupport = true; 4038 break; 4039 } 4040 } 4041 iInkTablets->Release(); 4042 } 4043 3992 4044 QLibrary library(QLatin1String("user32")); 3993 4045 // MinGW (g++ 3.4.5) accepts only C casts. -
trunk/src/gui/kernel/qapplication_x11.cpp
r651 r769 97 97 #endif 98 98 99 #ifndef QT_GUI_DOUBLE_CLICK_RADIUS 100 #define QT_GUI_DOUBLE_CLICK_RADIUS 5 101 #endif 102 103 99 104 //#define ALIEN_DEBUG 100 105 … … 316 321 "_XEMBED_INFO\0" 317 322 323 // Wacom old. (before version 0.10) 318 324 "Wacom Stylus\0" 319 325 "Wacom Cursor\0" 320 326 "Wacom Eraser\0" 327 328 // Tablet 329 "STYLUS\0" 330 "ERASER\0" 321 331 }; 322 332 … … 945 955 QApplication::setCursorFlashTime(num); 946 956 957 #ifndef QT_NO_WHEELEVENT 947 958 num = 948 959 settings.value(QLatin1String("wheelScrollLines"), 949 960 QApplication::wheelScrollLines()).toInt(); 950 961 QApplication::setWheelScrollLines(num); 962 #endif 951 963 952 964 QString colorspec = settings.value(QLatin1String("colorSpec"), … … 2360 2372 } 2361 2373 #else 2362 if (devs->type == ATOM(XWacomStylus) ) {2374 if (devs->type == ATOM(XWacomStylus) || devs->type == ATOM(XTabletStylus)) { 2363 2375 deviceType = QTabletEvent::Stylus; 2364 2376 if (wacomDeviceName()->isEmpty()) 2365 2377 wacomDeviceName()->append(devs->name); 2366 2378 gotStylus = true; 2367 } else if (devs->type == ATOM(XWacomEraser) ) {2379 } else if (devs->type == ATOM(XWacomEraser) || devs->type == ATOM(XTabletEraser)) { 2368 2380 deviceType = QTabletEvent::XFreeEraser; 2369 2381 gotEraser = true; … … 4214 4226 (long)event->xbutton.time -(long)mouseButtonPressTime 4215 4227 < QApplication::doubleClickInterval() && 4216 qAbs(event->xbutton.x - mouseXPos) < 5&&4217 qAbs(event->xbutton.y - mouseYPos) < 5) {4228 qAbs(event->xbutton.x - mouseXPos) < QT_GUI_DOUBLE_CLICK_RADIUS && 4229 qAbs(event->xbutton.y - mouseYPos) < QT_GUI_DOUBLE_CLICK_RADIUS) { 4218 4230 type = QEvent::MouseButtonDblClick; 4219 4231 mouseButtonPressTime -= 2000; // no double-click next time … … 4402 4414 if (popup && window() != popup) 4403 4415 popup->close(); 4416 #ifndef QT_NO_WHEELEVENT 4404 4417 QWheelEvent e(pos, globalPos, delta, buttons, modifiers, orient); 4405 4418 if (QApplication::sendSpontaneousEvent(widget, &e)) 4419 #endif 4406 4420 return true; 4407 4421 } … … 4414 4428 if (popup && widget != popup) 4415 4429 popup->hide(); 4430 #ifndef QT_NO_WHEELEVENT 4416 4431 QWheelEvent e(pos, globalPos, delta, buttons, modifiers, orient); 4417 4432 if (QApplication::sendSpontaneousEvent(widget, &e)) 4433 #endif 4418 4434 return true; 4419 4435 } … … 5314 5330 } 5315 5331 5332 #ifndef QT_NO_WHEELEVENT 5316 5333 void QApplication::setWheelScrollLines(int n) 5317 5334 { … … 5323 5340 return QApplicationPrivate::wheel_scroll_lines; 5324 5341 } 5342 #endif 5325 5343 5326 5344 void QApplication::setEffectEnabled(Qt::UIEffect effect, bool enable) -
trunk/src/gui/kernel/qclipboard_mac.cpp
r651 r769 389 389 QStringList formats = mime_src->formats(); 390 390 391 #ifdef QT_MAC_USE_COCOA 392 // QMimeData sub classes reimplementing the formats() might not expose the 393 // temporary "application/x-qt-mime-type-name" mimetype. So check the existence 394 // of this mime type while doing drag and drop. 395 QString dummyMimeType(QLatin1String("application/x-qt-mime-type-name")); 396 if (!formats.contains(dummyMimeType)) { 397 QByteArray dummyType = mime_src->data(dummyMimeType); 398 if (!dummyType.isEmpty()) { 399 formats.append(dummyMimeType); 400 } 401 } 402 #endif 391 403 for(int f = 0; f < formats.size(); ++f) { 392 404 QString mimeType = formats.at(f); -
trunk/src/gui/kernel/qclipboard_s60.cpp
r651 r769 165 165 aStream >> mimeTypeSize; 166 166 HBufC* mimeTypeBuf = HBufC::NewLC(aStream,mimeTypeSize); 167 QString mimeType = QString::fromUtf16(mimeTypeBuf->Des().Ptr(),mimeTypeBuf->Length()); 167 QString mimeType = QString(reinterpret_cast<const QChar *>(mimeTypeBuf->Des().Ptr()), 168 mimeTypeBuf->Length()); 168 169 CleanupStack::PopAndDestroy(mimeTypeBuf); 169 170 // mime data -
trunk/src/gui/kernel/qcocoamenuloader_mac.mm
r651 r769 111 111 } 112 112 113 - (void)removeActionsFromAppMenu 114 { 115 for (NSMenuItem *item in [appMenu itemArray]) 116 [item setTag:nil]; 117 } 118 113 119 - (void)dealloc 114 120 { -
trunk/src/gui/kernel/qcocoamenuloader_mac_p.h
r651 r769 71 71 } 72 72 - (void)ensureAppMenuInMenu:(NSMenu *)menu; 73 - (void)removeActionsFromAppMenu; 73 74 - (NSMenu *)applicationMenu; 74 75 - (NSMenu *)menu; -
trunk/src/gui/kernel/qcocoapanel_mac.mm
r651 r769 47 47 #import <private/qcocoaview_mac_p.h> 48 48 #import <private/qcocoawindowcustomthemeframe_mac_p.h> 49 #include <private/qapplication_p.h> 50 #include <private/qbackingstore_p.h> 51 49 52 50 53 #include <QtGui/QWidget> -
trunk/src/gui/kernel/qcocoasharedwindowmethods_mac_p.h
r651 r769 51 51 NSPanel, while QCocoaWindow needs to inherit NSWindow rather than NSPanel). 52 52 ****************************************************************************/ 53 54 // WARNING: Don't include any header files from within this file. Put them 55 // directly into qcocoawindow_mac_p.h and qcocoapanel_mac_p.h 53 56 54 57 QT_BEGIN_NAMESPACE … … 186 189 } 187 190 191 - (void)displayIfNeeded 192 { 193 194 QWidget *qwidget = [[QT_MANGLE_NAMESPACE(QCocoaWindowDelegate) sharedDelegate] qt_qwidgetForWindow:self]; 195 if (qwidget == 0) { 196 [super displayIfNeeded]; 197 return; 198 } 199 200 if (QApplicationPrivate::graphicsSystem() != 0) { 201 if (QWidgetBackingStore *bs = qt_widget_private(qwidget)->maybeBackingStore()) 202 bs->sync(qwidget, qwidget->rect()); 203 } 204 [super displayIfNeeded]; 205 } 206 207 -
trunk/src/gui/kernel/qcocoaview_mac.mm
r651 r769 521 521 { 522 522 if (QApplicationPrivate::graphicsSystem() != 0) { 523 if (QWidgetBackingStore *bs = qwidgetprivate->maybeBackingStore()) 524 bs->markDirty(qwidget->rect(), qwidget); 525 qwidgetprivate->syncBackingStore(qwidget->rect()); 526 return; 523 if (QWidgetBackingStore *bs = qwidgetprivate->maybeBackingStore()) { 524 // Drawing is handled on the window level 525 // See qcocoasharedwindowmethods_mac_p. 526 return; 527 } 527 528 } 528 529 CGContextRef cg = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort]; … … 645 646 - (void)mouseEntered:(NSEvent *)event 646 647 { 648 if (qwidgetprivate->data.in_destructor) 649 return; 647 650 QEvent enterEvent(QEvent::Enter); 648 651 NSPoint windowPoint = [event locationInWindow]; … … 826 829 } 827 830 831 #ifndef QT_NO_WHEELEVENT 828 832 if (deltaX != 0) { 829 833 QWheelEvent qwe(qlocal, qglobal, deltaX, buttons, keyMods, Qt::Horizontal); … … 866 870 } 867 871 } 872 #endif //QT_NO_WHEELEVENT 873 868 874 if (!wheelOK) { 869 875 return [super scrollWheel:theEvent]; … … 1402 1408 // setup the data 1403 1409 QMacPasteboard dragBoard((CFStringRef) NSDragPboard, QMacPasteboardMime::MIME_DND); 1404 dragPrivate()->data->setData(QLatin1String("application/x-qt-mime-type-name"), QByteArray( ));1410 dragPrivate()->data->setData(QLatin1String("application/x-qt-mime-type-name"), QByteArray("dummy")); 1405 1411 dragBoard.setMimeData(dragPrivate()->data); 1406 1412 -
trunk/src/gui/kernel/qcocoawindow_mac_p.h
r651 r769 54 54 #include "qmacdefines_mac.h" 55 55 #import <Cocoa/Cocoa.h> 56 #include <private/qapplication_p.h> 57 #include <private/qbackingstore_p.h> 58 56 59 57 60 enum { QtMacCustomizeWindow = 1 << 21 }; // This will one day be run over by -
trunk/src/gui/kernel/qcursor.cpp
r651 r769 343 343 \o B=0 and M=1 gives white. 344 344 \o B=0 and M=0 gives transparent. 345 \o B=1 and M=0 gives an XOR'd result. 345 \o B=1 and M=0 gives an XOR'd result under Windows, undefined 346 results on all other platforms. 346 347 \endlist 347 348 -
trunk/src/gui/kernel/qdesktopwidget_s60.cpp
r651 r769 89 89 void QDesktopWidgetPrivate::init(QDesktopWidget *that) 90 90 { 91 int screenCount=0; 91 Q_UNUSED(that); 92 // int screenCount=0; 92 93 93 if (HAL::Get(0, HALData::EDisplayNumberOfScreens, screenCount) == KErrNone) 94 QDesktopWidgetPrivate::screenCount = screenCount; 95 else 96 QDesktopWidgetPrivate::screenCount = 0; 94 // ### TODO: Implement proper multi-display support 95 QDesktopWidgetPrivate::screenCount = 1; 96 // if (HAL::Get(0, HALData::EDisplayNumberOfScreens, screenCount) == KErrNone) 97 // QDesktopWidgetPrivate::screenCount = screenCount; 98 // else 99 // QDesktopWidgetPrivate::screenCount = 0; 97 100 98 101 rects = new QVector<QRect>(); … … 101 104 rects->resize(QDesktopWidgetPrivate::screenCount); 102 105 workrects->resize(QDesktopWidgetPrivate::screenCount); 103 104 // ### TODO: Implement proper multi-display support105 rects->resize(1);106 rects->replace(0, that->rect());107 workrects->resize(1);108 workrects->replace(0, that->rect());109 106 } 110 107 -
trunk/src/gui/kernel/qdnd_s60.cpp
r651 r769 53 53 #include "qt_s60_p.h" 54 54 55 #include < COECNTRL.H>55 #include <coecntrl.h> 56 56 // pointer cursor 57 57 #include <w32std.h> -
trunk/src/gui/kernel/qdnd_x11.cpp
r651 r769 618 618 // to verify that it is utf16 619 619 if (data.size() > 1 && data.at(1) == 0) 620 return QString::from Utf16(reinterpret_cast<const ushort *>(data.constData()),620 return QString::fromRawData((const QChar *)data.constData(), 621 621 data.size() / 2).split(QLatin1Char('\n')).first().toLatin1(); 622 622 } -
trunk/src/gui/kernel/qeventdispatcher_mac.mm
r651 r769 493 493 case NSOtherMouseUp: 494 494 case NSOtherMouseDragged: 495 #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 496 case NSEventTypeGesture: // touch events 497 case NSEventTypeMagnify: 498 case NSEventTypeSwipe: 499 case NSEventTypeRotate: 500 case NSEventTypeBeginGesture: 501 case NSEventTypeEndGesture: 502 #endif 495 503 result = true; 496 504 break; -
trunk/src/gui/kernel/qgesturemanager.cpp
r651 r769 46 46 #include "private/qgraphicsitem_p.h" 47 47 #include "private/qevent_p.h" 48 #include "private/qapplication_p.h" 48 49 #include "qgesture.h" 49 50 #include "qevent.h" … … 87 88 #if defined(Q_OS_WIN) 88 89 #if !defined(QT_NO_NATIVE_GESTURES) 89 registerGestureRecognizer(new QWinNativePanGestureRecognizer); 90 if (QApplicationPrivate::HasTouchSupport) 91 registerGestureRecognizer(new QWinNativePanGestureRecognizer); 90 92 #endif 91 93 #else -
trunk/src/gui/kernel/qgridlayout.cpp
r651 r769 1853 1853 \fn int QGridLayout::colSpacing(int col) const 1854 1854 1855 Use column Spacing() instead.1855 Use columnMinimumWidth() instead. 1856 1856 */ 1857 1857 -
trunk/src/gui/kernel/qguifunctions_wince.cpp
r651 r769 279 279 bool qt_wince_is_windows_mobile_65() 280 280 { 281 return ((qt_wince_get_version() == 52) && (qt_wince_get_build() > 2000)); 281 const DWORD dwFirstWM65BuildNumber = 21139; 282 OSVERSIONINFO osvi; 283 osvi.dwOSVersionInfoSize = sizeof(osvi); 284 if (!GetVersionEx(&osvi)) 285 return false; 286 return osvi.dwMajorVersion > 5 287 || (osvi.dwMajorVersion == 5 && (osvi.dwMinorVersion > 2 || 288 (osvi.dwMinorVersion == 2 && osvi.dwBuildNumber >= dwFirstWM65BuildNumber))); 282 289 } 283 290 -
trunk/src/gui/kernel/qkeymapper_p.h
r651 r769 217 217 #elif defined(Q_WS_QWS) 218 218 #elif defined(Q_OS_SYMBIAN) 219 private:220 QHash<TUint, int> s60ToQtKeyMap;221 void fillKeyMap();222 219 public: 223 220 QString translateKeyEvent(int keySym, Qt::KeyboardModifiers modifiers); 224 221 int mapS60KeyToQt(TUint s60key); 222 int mapS60ScanCodesToQt(TUint s60key); 223 int mapQtToS60Key(int qtKey); 224 int mapQtToS60ScanCodes(int qtKey); 225 225 #endif 226 226 }; -
trunk/src/gui/kernel/qkeymapper_s60.cpp
r651 r769 47 47 QKeyMapperPrivate::QKeyMapperPrivate() 48 48 { 49 fillKeyMap();50 49 } 51 50 … … 75 74 } 76 75 77 void QKeyMapperPrivate::fillKeyMap() 78 { 79 using namespace Qt; 80 static const struct { 81 TUint s60Key; 82 int qtKey; 83 } map[] = { 84 {EKeyBell, Key_unknown}, 85 {EKeyBackspace, Key_Backspace}, 86 {EKeyTab, Key_Tab}, 87 {EKeyLineFeed, Key_unknown}, 88 {EKeyVerticalTab, Key_unknown}, 89 {EKeyFormFeed, Key_unknown}, 90 {EKeyEnter, Key_Enter}, 91 {EKeyEscape, Key_Escape}, 92 {EKeySpace, Key_Space}, 93 {EKeyDelete, Key_Delete}, 94 {EKeyPrintScreen, Key_SysReq}, 95 {EKeyPause, Key_Pause}, 96 {EKeyHome, Key_Home}, 97 {EKeyEnd, Key_End}, 98 {EKeyPageUp, Key_PageUp}, 99 {EKeyPageDown, Key_PageDown}, 100 {EKeyInsert, Key_Insert}, 101 {EKeyLeftArrow, Key_Left}, 102 {EKeyRightArrow, Key_Right}, 103 {EKeyUpArrow, Key_Up}, 104 {EKeyDownArrow, Key_Down}, 105 {EKeyLeftShift, Key_Shift}, 106 {EKeyRightShift, Key_Shift}, 107 {EKeyLeftAlt, Key_Alt}, 108 {EKeyRightAlt, Key_AltGr}, 109 {EKeyLeftCtrl, Key_Control}, 110 {EKeyRightCtrl, Key_Control}, 111 {EKeyLeftFunc, Key_Super_L}, 112 {EKeyRightFunc, Key_Super_R}, 113 {EKeyCapsLock, Key_CapsLock}, 114 {EKeyNumLock, Key_NumLock}, 115 {EKeyScrollLock, Key_ScrollLock}, 116 {EKeyF1, Key_F1}, 117 {EKeyF2, Key_F2}, 118 {EKeyF3, Key_F3}, 119 {EKeyF4, Key_F4}, 120 {EKeyF5, Key_F5}, 121 {EKeyF6, Key_F6}, 122 {EKeyF7, Key_F7}, 123 {EKeyF8, Key_F8}, 124 {EKeyF9, Key_F9}, 125 {EKeyF10, Key_F10}, 126 {EKeyF11, Key_F11}, 127 {EKeyF12, Key_F12}, 128 {EKeyF13, Key_F13}, 129 {EKeyF14, Key_F14}, 130 {EKeyF15, Key_F15}, 131 {EKeyF16, Key_F16}, 132 {EKeyF17, Key_F17}, 133 {EKeyF18, Key_F18}, 134 {EKeyF19, Key_F19}, 135 {EKeyF20, Key_F20}, 136 {EKeyF21, Key_F21}, 137 {EKeyF22, Key_F22}, 138 {EKeyF23, Key_F23}, 139 {EKeyF24, Key_F24}, 140 {EKeyOff, Key_unknown}, 141 {EKeyIncContrast, Key_unknown}, 142 {EKeyDecContrast, Key_unknown}, 143 {EKeyBacklightOn, Key_unknown}, 144 {EKeyBacklightOff, Key_unknown}, 145 {EKeyBacklightToggle, Key_unknown}, 146 {EKeySliderDown, Key_unknown}, 147 {EKeySliderUp, Key_unknown}, 148 {EKeyMenu, Key_Menu}, 149 {EKeyDictaphonePlay, Key_unknown}, 150 {EKeyDictaphoneStop, Key_unknown}, 151 {EKeyDictaphoneRecord, Key_unknown}, 152 {EKeyHelp, Key_unknown}, 153 {EKeyDial, Key_Call}, 154 {EKeyScreenDimension0, Key_unknown}, 155 {EKeyScreenDimension1, Key_unknown}, 156 {EKeyScreenDimension2, Key_unknown}, 157 {EKeyScreenDimension3, Key_unknown}, 158 {EKeyIncVolume, Key_unknown}, 159 {EKeyDecVolume, Key_unknown}, 160 {EKeyDevice0, Key_Context1}, // Found by manual testing, left softkey. 161 {EKeyDevice1, Key_Context2}, // Found by manual testing. 162 {EKeyDevice2, Key_unknown}, 163 {EKeyDevice3, Key_Select}, // Found by manual testing. 164 {EKeyDevice4, Key_unknown}, 165 {EKeyDevice5, Key_unknown}, 166 {EKeyDevice6, Key_unknown}, 167 {EKeyDevice7, Key_unknown}, 168 {EKeyDevice8, Key_unknown}, 169 {EKeyDevice9, Key_unknown}, 170 {EKeyDeviceA, Key_unknown}, 171 {EKeyDeviceB, Key_unknown}, 172 {EKeyDeviceC, Key_unknown}, 173 {EKeyDeviceD, Key_unknown}, 174 {EKeyDeviceE, Key_unknown}, 175 {EKeyDeviceF, Key_unknown}, 176 {EKeyApplication0, Key_Launch0}, 177 {EKeyApplication1, Key_Launch1}, 178 {EKeyApplication2, Key_Launch2}, 179 {EKeyApplication3, Key_Launch3}, 180 {EKeyApplication4, Key_Launch4}, 181 {EKeyApplication5, Key_Launch5}, 182 {EKeyApplication6, Key_Launch6}, 183 {EKeyApplication7, Key_Launch7}, 184 {EKeyApplication8, Key_Launch8}, 185 {EKeyApplication9, Key_Launch9}, 186 {EKeyApplicationA, Key_LaunchA}, 187 {EKeyApplicationB, Key_LaunchB}, 188 {EKeyApplicationC, Key_LaunchC}, 189 {EKeyApplicationD, Key_LaunchD}, 190 {EKeyApplicationE, Key_LaunchE}, 191 {EKeyApplicationF, Key_LaunchF}, 192 {EKeyYes, Key_Yes}, 193 {EKeyNo, Key_No}, 194 {EKeyIncBrightness, Key_unknown}, 195 {EKeyDecBrightness, Key_unknown}, 196 {EKeyKeyboardExtend, Key_unknown}, 197 {EKeyDevice10, Key_unknown}, 198 {EKeyDevice11, Key_unknown}, 199 {EKeyDevice12, Key_unknown}, 200 {EKeyDevice13, Key_unknown}, 201 {EKeyDevice14, Key_unknown}, 202 {EKeyDevice15, Key_unknown}, 203 {EKeyDevice16, Key_unknown}, 204 {EKeyDevice17, Key_unknown}, 205 {EKeyDevice18, Key_unknown}, 206 {EKeyDevice19, Key_unknown}, 207 {EKeyDevice1A, Key_unknown}, 208 {EKeyDevice1B, Key_unknown}, 209 {EKeyDevice1C, Key_unknown}, 210 {EKeyDevice1D, Key_unknown}, 211 {EKeyDevice1E, Key_unknown}, 212 {EKeyDevice1F, Key_unknown}, 213 {EKeyApplication10, Key_unknown}, 214 {EKeyApplication11, Key_unknown}, 215 {EKeyApplication12, Key_unknown}, 216 {EKeyApplication13, Key_unknown}, 217 {EKeyApplication14, Key_unknown}, 218 {EKeyApplication15, Key_unknown}, 219 {EKeyApplication16, Key_unknown}, 220 {EKeyApplication17, Key_unknown}, 221 {EKeyApplication18, Key_unknown}, 222 {EKeyApplication19, Key_unknown}, 223 {EKeyApplication1A, Key_unknown}, 224 {EKeyApplication1B, Key_unknown}, 225 {EKeyApplication1C, Key_unknown}, 226 {EKeyApplication1D, Key_unknown}, 227 {EKeyApplication1E, Key_unknown}, 228 {EKeyApplication1F, Key_unknown} 229 }; 230 const int mapSize = int(sizeof(map)/sizeof(map[0])); 231 s60ToQtKeyMap.reserve(mapSize + 5); // +5? docs: Ideally, slightly more than number of items 232 for (int i = 0; i < mapSize; ++i) 233 s60ToQtKeyMap.insert(map[i].s60Key, map[i].qtKey); 234 } 76 #include <e32keys.h> 77 struct KeyMapping{ 78 TKeyCode s60KeyCode; 79 TStdScanCode s60ScanCode; 80 Qt::Key qtKey; 81 }; 82 83 using namespace Qt; 84 85 static const KeyMapping keyMapping[] = { 86 {EKeyBackspace, EStdKeyBackspace, Key_Backspace}, 87 {EKeyTab, EStdKeyTab, Key_Tab}, 88 {EKeyEnter, EStdKeyEnter, Key_Enter}, 89 {EKeyEscape, EStdKeyEscape, Key_Escape}, 90 {EKeySpace, EStdKeySpace, Key_Space}, 91 {EKeyDelete, EStdKeyDelete, Key_Delete}, 92 {EKeyPrintScreen, EStdKeyPrintScreen, Key_SysReq}, 93 {EKeyPause, EStdKeyPause, Key_Pause}, 94 {EKeyHome, EStdKeyHome, Key_Home}, 95 {EKeyEnd, EStdKeyEnd, Key_End}, 96 {EKeyPageUp, EStdKeyPageUp, Key_PageUp}, 97 {EKeyPageDown, EStdKeyPageDown, Key_PageDown}, 98 {EKeyInsert, EStdKeyInsert, Key_Insert}, 99 {EKeyLeftArrow, EStdKeyLeftArrow, Key_Left}, 100 {EKeyRightArrow, EStdKeyRightArrow, Key_Right}, 101 {EKeyUpArrow, EStdKeyUpArrow, Key_Up}, 102 {EKeyDownArrow, EStdKeyDownArrow, Key_Down}, 103 {EKeyLeftShift, EStdKeyLeftShift, Key_Shift}, 104 {EKeyRightShift, EStdKeyRightShift, Key_Shift}, 105 {EKeyLeftAlt, EStdKeyLeftAlt, Key_Alt}, 106 {EKeyRightAlt, EStdKeyRightAlt, Key_AltGr}, 107 {EKeyLeftCtrl, EStdKeyLeftCtrl, Key_Control}, 108 {EKeyRightCtrl, EStdKeyRightCtrl, Key_Control}, 109 {EKeyLeftFunc, EStdKeyLeftFunc, Key_Super_L}, 110 {EKeyRightFunc, EStdKeyRightFunc, Key_Super_R}, 111 {EKeyCapsLock, EStdKeyCapsLock, Key_CapsLock}, 112 {EKeyNumLock, EStdKeyNumLock, Key_NumLock}, 113 {EKeyScrollLock, EStdKeyScrollLock, Key_ScrollLock}, 114 {EKeyF1, EStdKeyF1, Key_F1}, 115 {EKeyF2, EStdKeyF2, Key_F2}, 116 {EKeyF3, EStdKeyF3, Key_F3}, 117 {EKeyF4, EStdKeyF4, Key_F4}, 118 {EKeyF5, EStdKeyF5, Key_F5}, 119 {EKeyF6, EStdKeyF6, Key_F6}, 120 {EKeyF7, EStdKeyF7, Key_F7}, 121 {EKeyF8, EStdKeyF8, Key_F8}, 122 {EKeyF9, EStdKeyF9, Key_F9}, 123 {EKeyF10, EStdKeyF10, Key_F10}, 124 {EKeyF11, EStdKeyF11, Key_F11}, 125 {EKeyF12, EStdKeyF12, Key_F12}, 126 {EKeyF13, EStdKeyF13, Key_F13}, 127 {EKeyF14, EStdKeyF14, Key_F14}, 128 {EKeyF15, EStdKeyF15, Key_F15}, 129 {EKeyF16, EStdKeyF16, Key_F16}, 130 {EKeyF17, EStdKeyF17, Key_F17}, 131 {EKeyF18, EStdKeyF18, Key_F18}, 132 {EKeyF19, EStdKeyF19, Key_F19}, 133 {EKeyF20, EStdKeyF20, Key_F20}, 134 {EKeyF21, EStdKeyF21, Key_F21}, 135 {EKeyF22, EStdKeyF22, Key_F22}, 136 {EKeyF23, EStdKeyF23, Key_F23}, 137 {EKeyF24, EStdKeyF24, Key_F24}, 138 {EKeyOff, EStdKeyOff, Key_PowerOff}, 139 // {EKeyMenu, EStdKeyMenu, Key_Menu}, // Menu is EKeyApplication0 140 {EKeyHelp, EStdKeyHelp, Key_Help}, 141 {EKeyDial, EStdKeyDial, Key_Call}, 142 {EKeyIncVolume, EStdKeyIncVolume, Key_VolumeUp}, 143 {EKeyDecVolume, EStdKeyDecVolume, Key_VolumeDown}, 144 {EKeyDevice0, EStdKeyDevice0, Key_Context1}, // Found by manual testing. 145 {EKeyDevice1, EStdKeyDevice1, Key_Context2}, // Found by manual testing. 146 {EKeyDevice3, EStdKeyDevice3, Key_Select}, 147 // {EKeyDevice7, EStdKeyDevice7, Key_Camera}, //not supported by qt yet 148 {EKeyApplication0, EStdKeyApplication0, Key_Menu}, // Found by manual testing. 149 {EKeyApplication1, EStdKeyApplication1, Key_Launch1}, // Found by manual testing. 150 {EKeyApplication2, EStdKeyApplication2, Key_MediaPlay}, // Found by manual testing. 151 {EKeyApplication3, EStdKeyApplication3, Key_MediaStop}, // Found by manual testing. 152 {EKeyApplication4, EStdKeyApplication4, Key_MediaNext}, // Found by manual testing. 153 {EKeyApplication5, EStdKeyApplication5, Key_MediaPrevious}, // Found by manual testing. 154 {EKeyApplication6, EStdKeyApplication6, Key_Launch6}, 155 {EKeyApplication7, EStdKeyApplication7, Key_Launch7}, 156 {EKeyApplication8, EStdKeyApplication8, Key_Launch8}, 157 {EKeyApplication9, EStdKeyApplication9, Key_Launch9}, 158 {EKeyApplicationA, EStdKeyApplicationA, Key_LaunchA}, 159 {EKeyApplicationB, EStdKeyApplicationB, Key_LaunchB}, 160 {EKeyApplicationC, EStdKeyApplicationC, Key_LaunchC}, 161 {EKeyApplicationD, EStdKeyApplicationD, Key_LaunchD}, 162 {EKeyApplicationE, EStdKeyApplicationE, Key_LaunchE}, 163 {EKeyApplicationF, EStdKeyApplicationF, Key_LaunchF}, 164 // {EKeyApplication19, EStdKeyApplication19, Key_CameraFocus}, //not supported by qt yet 165 {EKeyYes, EStdKeyYes, Key_Yes}, 166 {EKeyNo, EStdKeyNo, Key_No}, 167 {TKeyCode(0), TStdScanCode(0), Qt::Key(0)} 168 }; 235 169 236 170 int QKeyMapperPrivate::mapS60KeyToQt(TUint s60key) 237 171 { 238 QHash<TUint, int>::const_iterator mapping; 239 mapping = s60ToQtKeyMap.find(s60key); 240 if (mapping != s60ToQtKeyMap.end()) { 241 return *mapping; 242 } else { 243 return Qt::Key_unknown; 244 } 245 } 246 172 int res = Qt::Key_unknown; 173 for (int i = 0; keyMapping[i].s60KeyCode != 0; i++) { 174 if (keyMapping[i].s60KeyCode == s60key) { 175 res = keyMapping[i].qtKey; 176 break; 177 } 178 } 179 return res; 180 } 181 182 int QKeyMapperPrivate::mapS60ScanCodesToQt(TUint s60scanCode) 183 { 184 int res = Qt::Key_unknown; 185 for (int i = 0; keyMapping[i].s60KeyCode != 0; i++) { 186 if (keyMapping[i].s60ScanCode == s60scanCode) { 187 res = keyMapping[i].qtKey; 188 break; 189 } 190 } 191 return res; 192 } 193 194 int QKeyMapperPrivate::mapQtToS60Key(int qtKey) 195 { 196 int res = KErrUnknown; 197 for (int i = 0; keyMapping[i].s60KeyCode != 0; i++) { 198 if (keyMapping[i].qtKey == qtKey) { 199 res = keyMapping[i].s60KeyCode; 200 break; 201 } 202 } 203 return res; 204 } 205 206 int QKeyMapperPrivate::mapQtToS60ScanCodes(int qtKey) 207 { 208 int res = KErrUnknown; 209 for (int i = 0; keyMapping[i].s60KeyCode != 0; i++) { 210 if (keyMapping[i].qtKey == qtKey) { 211 res = keyMapping[i].s60ScanCode; 212 break; 213 } 214 } 215 return res; 216 } 247 217 QT_END_NAMESPACE -
trunk/src/gui/kernel/qkeymapper_x11.cpp
r651 r769 361 361 if (code && code < 0xfffe) 362 362 code = QChar(code).toUpper().unicode(); 363 364 if (code == Qt::Key_Tab && (baseModifiers & Qt::ShiftModifier)) { 365 // map shift+tab to shift+backtab 366 code = Qt::Key_Backtab; 367 text = QString(); 368 } 369 363 370 if (code == baseCode) 364 371 continue; … … 449 456 if (code && code < 0xfffe) 450 457 code = QChar(code).toUpper().unicode(); 458 459 if (code == Qt::Key_Tab && (baseModifiers & Qt::ShiftModifier)) { 460 // map shift+tab to shift+backtab 461 code = Qt::Key_Backtab; 462 text = QString(); 463 } 464 451 465 if (code == baseCode) 452 466 continue; … … 1060 1074 XF86XK_AudioRecord, Qt::Key_MediaRecord, 1061 1075 XF86XK_Mail, Qt::Key_LaunchMail, 1062 XF86XK_MyComputer, Qt::Key_Launch0, 1063 XF86XK_Calculator, Qt::Key_ Calculator,1076 XF86XK_MyComputer, Qt::Key_Launch0, // ### Qt 5: remap properly 1077 XF86XK_Calculator, Qt::Key_Launch1, 1064 1078 XF86XK_Memo, Qt::Key_Memo, 1065 1079 XF86XK_ToDoList, Qt::Key_ToDoList, … … 1159 1173 XF86XK_Suspend, Qt::Key_Suspend, 1160 1174 XF86XK_Hibernate, Qt::Key_Hibernate, 1161 XF86XK_Launch0, Qt::Key_Launch2, 1175 XF86XK_Launch0, Qt::Key_Launch2, // ### Qt 5: remap properly 1162 1176 XF86XK_Launch1, Qt::Key_Launch3, 1163 1177 XF86XK_Launch2, Qt::Key_Launch4, -
trunk/src/gui/kernel/qmime_mac.cpp
r651 r769 432 432 ret = QString(str); 433 433 } else if (flavor == QLatin1String("public.utf16-plain-text")) { 434 ret = QString ::fromUtf16(reinterpret_cast<const ushort*>(firstData.constData()),435 firstData.size() / sizeof(ushort));434 ret = QString(reinterpret_cast<const QChar *>(firstData.constData()), 435 firstData.size() / sizeof(QChar)); 436 436 } else { 437 437 qWarning("QMime::convertToMime: unhandled mimetype: %s", qPrintable(mimetype)); -
trunk/src/gui/kernel/qmime_win.cpp
r651 r769 641 641 QList<QUrl> urls = mimeData->urls(); 642 642 QByteArray result; 643 QString url = urls.at(0).toString(); 644 result = QByteArray((const char *)url.utf16(), url.length() * sizeof(ushort)); 643 if (!urls.isEmpty()) { 644 QString url = urls.at(0).toString(); 645 result = QByteArray((const char *)url.utf16(), url.length() * sizeof(ushort)); 646 } 645 647 result.append('\0'); 646 648 result.append('\0'); … … 648 650 } else if (getCf(formatetc) == CF_INETURL) { 649 651 QList<QUrl> urls = mimeData->urls(); 650 QByteArray result = urls.at(0).toString().toLocal8Bit(); 652 QByteArray result; 653 if (!urls.isEmpty()) 654 result = urls.at(0).toString().toLocal8Bit(); 651 655 return setData(result, pmedium); 652 656 } -
trunk/src/gui/kernel/qsoftkeymanager.cpp
r651 r769 56 56 QSoftKeyManager *QSoftKeyManagerPrivate::self = 0; 57 57 58 const char *QSoftKeyManager::standardSoftKeyText(StandardSoftKey standardKey)59 { 60 const char *softKeyText = 0;58 QString QSoftKeyManager::standardSoftKeyText(StandardSoftKey standardKey) 59 { 60 QString softKeyText; 61 61 switch (standardKey) { 62 62 case OkSoftKey: 63 softKeyText = Q T_TRANSLATE_NOOP("QSoftKeyManager","Ok");63 softKeyText = QSoftKeyManager::tr("Ok"); 64 64 break; 65 65 case SelectSoftKey: 66 softKeyText = Q T_TRANSLATE_NOOP("QSoftKeyManager","Select");66 softKeyText = QSoftKeyManager::tr("Select"); 67 67 break; 68 68 case DoneSoftKey: 69 softKeyText = Q T_TRANSLATE_NOOP("QSoftKeyManager","Done");69 softKeyText = QSoftKeyManager::tr("Done"); 70 70 break; 71 71 case MenuSoftKey: 72 softKeyText = Q T_TRANSLATE_NOOP("QSoftKeyManager","Options");72 softKeyText = QSoftKeyManager::tr("Options"); 73 73 break; 74 74 case CancelSoftKey: 75 softKeyText = Q T_TRANSLATE_NOOP("QSoftKeyManager","Cancel");75 softKeyText = QSoftKeyManager::tr("Cancel"); 76 76 break; 77 77 default: … … 101 101 QAction *QSoftKeyManager::createAction(StandardSoftKey standardKey, QWidget *actionWidget) 102 102 { 103 const char* text = standardSoftKeyText(standardKey); 104 QAction *action = new QAction(QSoftKeyManager::tr(text), actionWidget); 103 QAction *action = new QAction(standardSoftKeyText(standardKey), actionWidget); 105 104 QAction::SoftKeyRole softKeyRole = QAction::NoSoftKey; 106 105 switch (standardKey) { … … 117 116 } 118 117 action->setSoftKeyRole(softKeyRole); 118 action->setVisible(false); 119 setForceEnabledInSoftkeys(action); 119 120 return action; 120 121 } … … 170 171 Q_D(QSoftKeyManager); 171 172 bool ret = false; 172 QList<QAction*> actions = source.actions();173 for (int i = 0; i < actions.count(); ++i) {174 if (actions.at(i)->softKeyRole() != QAction::NoSoftKey) {175 d->requestedSoftKeyActions.insert(level, action s.at(i));173 foreach(QAction *action, source.actions()) { 174 if (action->softKeyRole() != QAction::NoSoftKey 175 && (action->isVisible() || isForceEnabledInSofkeys(action))) { 176 d->requestedSoftKeyActions.insert(level, action); 176 177 ret = true; 177 178 } 178 179 } 179 180 return ret; 181 } 182 183 184 static bool isChildOf(const QWidget *c, const QWidget *p) 185 { 186 while (c) { 187 if (c == p) 188 return true; 189 c = c->parentWidget(); 190 } 191 return false; 180 192 } 181 193 … … 186 198 if (!previousSource) { 187 199 // Initial source is primarily focuswidget and secondarily activeWindow 188 source = QApplication::focusWidget(); 189 if (!source) 190 source = QApplication::activeWindow(); 200 QWidget *focus = QApplication::focusWidget(); 201 QWidget *popup = QApplication::activePopupWidget(); 202 if (popup) { 203 if (isChildOf(focus, popup)) 204 source = focus; 205 else 206 source = popup; 207 } 208 if (!source) { 209 QWidget *modal = QApplication::activeModalWidget(); 210 if (modal) { 211 if (isChildOf(focus, modal)) 212 source = focus; 213 else 214 source = modal; 215 } 216 } 217 if (!source) { 218 source = focus; 219 if (!source) 220 source = QApplication::activeWindow(); 221 } 191 222 } else { 192 223 // Softkey merging is based on four criterias … … 212 243 bool recursiveMerging = false; 213 244 QWidget *source = softkeySource(NULL, recursiveMerging); 214 do { 215 if (source) { 216 bool added = appendSoftkeys(*source, level); 217 source = softkeySource(source, recursiveMerging); 218 level = added ? ++level : level; 219 } 220 } while (source); 245 d->initialSoftKeySource = source; 246 while (source) { 247 if (appendSoftkeys(*source, level)) 248 ++level; 249 source = softkeySource(source, recursiveMerging); 250 } 221 251 222 252 d->updateSoftKeys_sys(); 223 253 return true; 254 } 255 256 void QSoftKeyManager::setForceEnabledInSoftkeys(QAction *action) 257 { 258 action->setProperty(FORCE_ENABLED_PROPERTY, QVariant(true)); 259 } 260 261 bool QSoftKeyManager::isForceEnabledInSofkeys(QAction *action) 262 { 263 bool ret = false; 264 QVariant property = action->property(FORCE_ENABLED_PROPERTY); 265 if (property.isValid() && property.toBool()) 266 ret = true; 267 return ret; 224 268 } 225 269 -
trunk/src/gui/kernel/qsoftkeymanager_common_p.h
r651 r769 71 71 QHash<QAction*, Qt::Key> keyedActions; 72 72 QMultiHash<int, QAction*> requestedSoftKeyActions; 73 QWidget *initialSoftKeySource; 73 74 74 75 }; -
trunk/src/gui/kernel/qsoftkeymanager_p.h
r651 r769 64 64 class QSoftKeyManagerPrivate; 65 65 66 const char MENU_ACTION_PROPERTY[] = "_q_menuaction"; 66 const char MENU_ACTION_PROPERTY[] = "_q_menuAction"; 67 const char FORCE_ENABLED_PROPERTY[] = "_q_forceEnabledInSoftkeys"; 67 68 68 69 class Q_AUTOTEST_EXPORT QSoftKeyManager : public QObject … … 88 89 static QAction *createAction(StandardSoftKey standardKey, QWidget *actionWidget); 89 90 static QAction *createKeyedAction(StandardSoftKey standardKey, Qt::Key key, QWidget *actionWidget); 91 static QString standardSoftKeyText(StandardSoftKey standardKey); 92 static void setForceEnabledInSoftkeys(QAction *action); 93 static bool isForceEnabledInSofkeys(QAction *action); 90 94 91 95 protected: … … 95 99 QSoftKeyManager(); 96 100 static QSoftKeyManager *instance(); 97 static const char *standardSoftKeyText(StandardSoftKey standardKey);98 101 bool appendSoftkeys(const QWidget &source, int level); 99 102 QWidget *softkeySource(QWidget *previousSource, bool& recursiveMerging); -
trunk/src/gui/kernel/qsoftkeymanager_s60.cpp
r651 r769 61 61 const int RSK_POSITION = 2; 62 62 63 QSoftKeyManagerPrivateS60::QSoftKeyManagerPrivateS60() 63 QSoftKeyManagerPrivateS60::QSoftKeyManagerPrivateS60() : cbaHasImage(4) // 4 since MSK position index is 3 64 64 { 65 65 cachedCbaIconSize[0] = QSize(0,0); … … 67 67 cachedCbaIconSize[2] = QSize(0,0); 68 68 cachedCbaIconSize[3] = QSize(0,0); 69 skipNextUpdate = false;70 69 } 71 70 72 71 bool QSoftKeyManagerPrivateS60::skipCbaUpdate() 73 72 { 74 // lets not update softkeys if73 // Lets not update softkeys if 75 74 // 1. We don't have application panes, i.e. cba 76 // 2. S60 native dialog or menu is shown 77 if (QApplication::testAttribute(Qt::AA_S60DontConstructApplicationPanes) || 78 CCoeEnv::Static()->AppUi()->IsDisplayingMenuOrDialog() || skipNextUpdate) { 79 skipNextUpdate = false; 75 // 2. Our CBA is not active, i.e. S60 native dialog or menu with custom CBA is shown 76 // 2.1. Except if thre is no current CBA at all and WindowSoftkeysRespondHint is set 77 78 // Note: Cannot use IsDisplayingMenuOrDialog since CBA update can be triggered before 79 // menu/dialog CBA is actually displayed i.e. it is being costructed. 80 CEikButtonGroupContainer *appUiCba = S60->buttonGroupContainer(); 81 if (!appUiCba) 82 return true; 83 // CEikButtonGroupContainer::Current returns 0 if CBA is not visible at all 84 CEikButtonGroupContainer *currentCba = CEikButtonGroupContainer::Current(); 85 // Check if softkey need to be update even they are not visible 86 bool cbaRespondsWhenInvisible = false; 87 QWidget *window = QApplication::activeWindow(); 88 if (window && (window->windowFlags() & Qt::WindowSoftkeysRespondHint)) 89 cbaRespondsWhenInvisible = true; 90 91 if (QApplication::testAttribute(Qt::AA_S60DontConstructApplicationPanes) 92 || (appUiCba != currentCba && !cbaRespondsWhenInvisible)) { 80 93 return true; 81 94 } … … 255 268 256 269 EikSoftkeyImage::SetImage(cba, *myimage, left); // Takes myimage ownership 270 cbaHasImage[position] = true; 257 271 ret = true; 258 272 } else { 259 273 // Restore softkey to text based 260 EikSoftkeyImage::SetLabel(cba, left); 274 if (cbaHasImage[position]) { 275 EikSoftkeyImage::SetLabel(cba, left); 276 cbaHasImage[position] = false; 277 } 261 278 } 262 279 } … … 274 291 int command = S60_COMMAND_START + position; 275 292 setNativeSoftkey(cba, position, command, nativeText); 276 cba.DimCommand(command, !action->isEnabled()); 293 const bool dimmed = !action->isEnabled() && !QSoftKeyManager::isForceEnabledInSofkeys(action); 294 cba.DimCommand(command, dimmed); 277 295 realSoftKeyActions.insert(command, action); 278 296 return true; … … 297 315 { 298 316 if (!setSoftkey(cba, QAction::NegativeSoftKey, RSK_POSITION)) { 299 Qt::WindowType windowType = Qt::Window; 300 QAction *action = requestedSoftKeyActions.value(0); 301 if (action) { 302 QWidget *actionParent = action->parentWidget(); 303 Q_ASSERT_X(actionParent, Q_FUNC_INFO, "No parent set for softkey action!"); 304 305 QWidget *actionWindow = actionParent->window(); 306 Q_ASSERT_X(actionWindow, Q_FUNC_INFO, "Softkey action does not have window!"); 307 windowType = actionWindow->windowType(); 308 } 309 317 const Qt::WindowType windowType = initialSoftKeySource 318 ? initialSoftKeySource->window()->windowType() : Qt::Window; 310 319 if (windowType != Qt::Dialog && windowType != Qt::Popup) { 311 320 QString text(QSoftKeyManager::tr("Exit")); 312 321 TPtrC nativeText = qt_QString2TPtrC(text); 313 EikSoftkeyImage::SetLabel(&cba, false); 322 if (cbaHasImage[RSK_POSITION]) { 323 EikSoftkeyImage::SetLabel(&cba, false); 324 cbaHasImage[RSK_POSITION] = false; 325 } 314 326 setNativeSoftkey(cba, RSK_POSITION, EAknSoftkeyExit, nativeText); 327 cba.DimCommand(EAknSoftkeyExit, false); 315 328 return true; 316 329 } … … 355 368 } 356 369 370 static void resetMenuBeingConstructed(TAny* /*aAny*/) 371 { 372 S60->menuBeingConstructed = false; 373 } 374 375 void QSoftKeyManagerPrivateS60::tryDisplayMenuBarL() 376 { 377 CleanupStack::PushL(TCleanupItem(resetMenuBeingConstructed, NULL)); 378 S60->menuBeingConstructed = true; 379 S60->menuBar()->TryDisplayMenuBarL(); 380 CleanupStack::PopAndDestroy(); // Reset menuBeingConstructed to false in all cases 381 } 382 357 383 bool QSoftKeyManagerPrivateS60::handleCommand(int command) 358 384 { … … 361 387 QVariant property = action->property(MENU_ACTION_PROPERTY); 362 388 if (property.isValid() && property.toBool()) { 363 QT_TRAP_THROWING( S60->menuBar()->TryDisplayMenuBarL());389 QT_TRAP_THROWING(tryDisplayMenuBarL()); 364 390 } else if (action->menu()) { 365 391 // TODO: This is hack, in order to use exising QMenuBar implementation for Symbian 366 392 // menubar needs to have widget to which it is associated. Since we want to associate 367 // menubar to action (which is inherited from QOb ejct), we create and associate QWidget393 // menubar to action (which is inherited from QObject), we create and associate QWidget 368 394 // to action and pass that for QMenuBar. This associates the menubar to action, and we 369 395 // can have own menubar for each action. … … 384 410 } 385 411 qt_symbian_next_menu_from_action(actionContainer); 386 QT_TRAP_THROWING(S60->menuBar()->TryDisplayMenuBarL()); 387 // TODO: hack remove, it can happen that IsDisplayingMenuOrDialog return false 388 // in updateSoftKeys_sys, and we will override menu CBA with our own 389 skipNextUpdate = true; 390 } else { 391 Q_ASSERT(action->softKeyRole() != QAction::NoSoftKey); 392 QWidget *actionParent = action->parentWidget(); 393 Q_ASSERT_X(actionParent, Q_FUNC_INFO, "No parent set for softkey action!"); 394 if (actionParent->isEnabled()) { 395 action->activate(QAction::Trigger); 396 return true; 397 } 412 QT_TRAP_THROWING(tryDisplayMenuBarL()); 413 } 414 415 Q_ASSERT(action->softKeyRole() != QAction::NoSoftKey); 416 QWidget *actionParent = action->parentWidget(); 417 Q_ASSERT_X(actionParent, Q_FUNC_INFO, "No parent set for softkey action!"); 418 if (actionParent->isEnabled()) { 419 action->activate(QAction::Trigger); 420 return true; 398 421 } 399 422 } -
trunk/src/gui/kernel/qsoftkeymanager_s60_p.h
r651 r769 54 54 // 55 55 56 #include "qbitarray.h" 56 57 #include "private/qobject_p.h" 57 58 #include "private/qsoftkeymanager_common_p.h" … … 78 79 79 80 private: 81 void tryDisplayMenuBarL(); 80 82 bool skipCbaUpdate(); 81 83 void ensureCbaVisibilityAndResponsiviness(CEikButtonGroupContainer &cba); … … 99 101 QHash<int, QAction*> realSoftKeyActions; 100 102 QSize cachedCbaIconSize[4]; 101 bool skipNextUpdate;103 QBitArray cbaHasImage; 102 104 }; 103 105 -
trunk/src/gui/kernel/qsound.cpp
r651 r769 155 155 \o A built-in mixing sound server is used, accessing \c /dev/dsp 156 156 directly. Only the WAVE format is supported. 157 \row 157 158 \o Symbian 158 159 \o CMdaAudioPlayerUtility is used. All formats that Symbian OS or devices support -
trunk/src/gui/kernel/qsound_mac.mm
r651 r769 175 175 QMacSoundDelegate * const delegate = [[QMacSoundDelegate alloc] initWithQSound:qSound:this]; 176 176 [nsSound setDelegate:delegate]; 177 [nsFileName release]; 177 178 return nsSound; 178 179 } -
trunk/src/gui/kernel/qsound_s60.cpp
r651 r769 52 52 53 53 #include <e32std.h> 54 #include < MdaAudioSamplePlayer.h>54 #include <mdaaudiosampleplayer.h> 55 55 56 56 QT_BEGIN_NAMESPACE -
trunk/src/gui/kernel/qt_cocoa_helpers_mac.mm
r651 r769 144 144 void macWindowFade(void * /*OSWindowRef*/ window, float durationSeconds) 145 145 { 146 #ifdef QT_MAC_USE_COCOA 147 QMacCocoaAutoReleasePool pool; 148 #endif 146 149 OSWindowRef wnd = static_cast<OSWindowRef>(window); 147 150 if (wnd) { … … 1160 1163 QDBeginCGContext(port, &context); 1161 1164 #else 1162 CGContextRef context = (CGContextRef)[[NSGraphicsContext graphicsContextWithWindow:qt_mac_window_for(widget)] graphicsPort];1165 CGContextRef context = reinterpret_cast<CGContextRef>([[qt_mac_window_for(widget) graphicsContext] graphicsPort]); 1163 1166 #endif 1164 1167 return context; 1168 } 1169 1170 void qt_mac_dispatchPendingUpdateRequests(QWidget *widget) 1171 { 1172 if (!widget) 1173 return; 1174 #ifndef QT_MAC_USE_COCOA 1175 HIViewRender(qt_mac_nativeview_for(widget)); 1176 #else 1177 [qt_mac_nativeview_for(widget) displayIfNeeded]; 1178 #endif 1165 1179 } 1166 1180 … … 1279 1293 #endif 1280 1294 1295 QMacCocoaAutoReleasePool::QMacCocoaAutoReleasePool() 1296 { 1297 #ifndef QT_MAC_USE_COCOA 1298 NSApplicationLoad(); 1299 #endif 1300 pool = (void*)[[NSAutoreleasePool alloc] init]; 1301 } 1302 1303 QMacCocoaAutoReleasePool::~QMacCocoaAutoReleasePool() 1304 { 1305 [(NSAutoreleasePool*)pool release]; 1306 } 1307 1281 1308 QT_END_NAMESPACE -
trunk/src/gui/kernel/qt_s60_p.h
r651 r769 69 69 70 70 #ifdef Q_WS_S60 71 #include < aknutils.h> // AknLayoutUtils71 #include <AknUtils.h> // AknLayoutUtils 72 72 #include <avkon.hrh> // EEikStatusPaneUidTitle 73 73 #include <akntitle.h> // CAknTitlePane 74 74 #include <akncontext.h> // CAknContextPane 75 75 #include <eikspane.h> // CEikStatusPane 76 #include < aknpopupfader.h> // MAknFadedComponent and TAknPopupFader76 #include <AknPopupFader.h> // MAknFadedComponent and TAknPopupFader 77 77 #endif 78 78 … … 123 123 int supportsPremultipliedAlpha : 1; 124 124 int avkonComponentsSupportTransparency : 1; 125 int menuBeingConstructed : 1; 125 126 QApplication::QS60MainApplicationFactory s60ApplicationFactory; // typedef'ed pointer type 126 127 static inline void updateScreenSize(); … … 155 156 class QSymbianControl : public CCoeControl, public QAbstractLongTapObserver 156 157 #ifdef Q_WS_S60 157 , public MAknFadedComponent 158 , public MAknFadedComponent, public MEikStatusPaneObserver 158 159 #endif 159 160 { … … 183 184 #ifdef Q_WS_S60 184 185 void FadeBehindPopup(bool fade){ popupFader.FadeBehindPopup( this, this, fade); } 186 void HandleStatusPaneSizeChange(); 185 187 186 188 protected: // from MAknFadedComponent … … 213 215 void translateAdvancedPointerEvent(const TAdvancedPointerEvent *event); 214 216 #endif 217 void handleClientAreaChange(); 215 218 216 219 private: -
trunk/src/gui/kernel/qt_x11_p.h
r651 r769 676 676 XWacomEraser, 677 677 678 XTabletStylus, 679 XTabletEraser, 680 678 681 NPredefinedAtoms, 679 682 -
trunk/src/gui/kernel/qtooltip.cpp
r651 r769 169 169 QTipLabel::QTipLabel(const QString &text, QWidget *w) 170 170 #ifndef QT_NO_STYLE_STYLESHEET 171 : QLabel(w, Qt::ToolTip ), styleSheetParent(0), widget(0)171 : QLabel(w, Qt::ToolTip | Qt::BypassGraphicsProxyWidget), styleSheetParent(0), widget(0) 172 172 #else 173 : QLabel(w, Qt::ToolTip ), widget(0)173 : QLabel(w, Qt::ToolTip | Qt::BypassGraphicsProxyWidget), widget(0) 174 174 #endif 175 175 { … … 369 369 370 370 #ifdef Q_WS_MAC 371 QRect screen = QApplication::desktop()->availableGeometry(getTipScreen(pos, w)); 371 // When in full screen mode, there is no Dock nor Menu so we can use 372 // the whole screen for displaying the tooltip. However when not in 373 // full screen mode we need to save space for the dock, so we use 374 // availableGeometry instead. 375 extern bool qt_mac_app_fullscreen; //qapplication_mac.mm 376 QRect screen; 377 if(qt_mac_app_fullscreen) 378 screen = QApplication::desktop()->screenGeometry(getTipScreen(pos, w)); 379 else 380 screen = QApplication::desktop()->availableGeometry(getTipScreen(pos, w)); 372 381 #else 373 382 QRect screen = QApplication::desktop()->screenGeometry(getTipScreen(pos, w)); -
trunk/src/gui/kernel/qwhatsthis.cpp
r651 r769 144 144 */ 145 145 146 extern void qDeleteInEventHandler(QObject *o);146 Q_DECL_IMPORT extern void qDeleteInEventHandler(QObject *o); 147 147 148 148 class QWhatsThat : public QWidget -
trunk/src/gui/kernel/qwidget.cpp
r677 r769 123 123 #include "private/qgesturemanager_p.h" 124 124 125 #ifdef QT_KEYPAD_NAVIGATION 126 #include "qtabwidget.h" // Needed in inTabWidget() 127 #endif // QT_KEYPAD_NAVIGATION 128 125 129 // widget/widget data creation count 126 130 //#define QWIDGET_EXTRA_DEBUG … … 197 201 , isScrolled(0) 198 202 , isMoved(0) 203 , isGLWidget(0) 199 204 , usesDoubleBufferedGLContext(0) 200 205 #if defined(Q_WS_X11) … … 207 212 #elif defined(Q_WS_MAC) 208 213 , needWindowChange(0) 209 , isGLWidget(0)210 214 , window_event(0) 211 215 , qd_hd(0) … … 1446 1450 #endif 1447 1451 1452 #ifdef Q_OS_SYMBIAN 1448 1453 if (d->extra && d->extra->topextra && d->extra->topextra->backingStore) { 1449 1454 // Okay, we are about to destroy the top-level window that owns … … 1455 1460 delete d->extra->topextra->backingStore; 1456 1461 d->extra->topextra->backingStore = 0; 1457 } else if (QWidgetBackingStore *bs = d->maybeBackingStore()) { 1462 } 1463 #endif 1464 if (QWidgetBackingStore *bs = d->maybeBackingStore()) { 1458 1465 bs->removeDirtyWidget(this); 1459 1466 if (testAttribute(Qt::WA_StaticContents)) … … 1487 1494 QWidgetPrivate::allWidgets->remove(this); 1488 1495 1489 QEvent e(QEvent::Destroy); 1490 QCoreApplication::sendEvent(this, &e); 1496 QT_TRY { 1497 QEvent e(QEvent::Destroy); 1498 QCoreApplication::sendEvent(this, &e); 1499 } QT_CATCH(const std::exception&) { 1500 // if this fails we can't do anything about it but at least we are not allowed to throw. 1501 } 1491 1502 } 1492 1503 … … 1676 1687 dirty = QRegion(); 1677 1688 } else if (QWidgetBackingStore *bs = maybeBackingStore()) { 1689 #ifdef QT_MAC_USE_COCOA 1690 Q_UNUSED(bs); 1691 void qt_mac_set_needs_display(QWidget *, QRegion); 1692 qt_mac_set_needs_display(q_func(), QRegion()); 1693 #else 1678 1694 bs->sync(); 1695 #endif 1679 1696 } 1680 1697 } … … 1684 1701 if (paintOnScreen()) 1685 1702 repaint_sys(region); 1686 else if (QWidgetBackingStore *bs = maybeBackingStore()) 1703 else if (QWidgetBackingStore *bs = maybeBackingStore()) { 1704 #ifdef QT_MAC_USE_COCOA 1705 Q_UNUSED(bs); 1706 void qt_mac_set_needs_display(QWidget *, QRegion); 1707 qt_mac_set_needs_display(q_func(), region); 1708 #else 1687 1709 bs->sync(q_func(), region); 1710 #endif 1711 } 1688 1712 } 1689 1713 … … 3368 3392 appear on screen. This also applies to windows. 3369 3393 3370 \sa pos, geometry, minimumSize, maximumSize, resizeEvent() 3394 \sa pos, geometry, minimumSize, maximumSize, resizeEvent(), adjustSize() 3371 3395 */ 3372 3396 … … 6110 6134 if (previousProxyFocus && previousProxyFocus->focusProxy()) 6111 6135 previousProxyFocus = previousProxyFocus->focusProxy(); 6136 if (previousProxyFocus == this && !topData->proxyWidget->d_func()->proxyIsGivingFocus) 6137 return; 6112 6138 } 6113 6139 } … … 7522 7548 if (!widget || widget->isWindow() || widget->testAttribute(Qt::WA_WState_Hidden)) 7523 7549 continue; 7550 #ifdef QT_MAC_USE_COCOA 7551 // Before doing anything we need to make sure that we don't leave anything in a non-consistent state. 7552 // When hiding a widget we need to make sure that no mouse_down events are active, because 7553 // the mouse_up event will never be received by a hidden widget or one of its descendants. 7554 // The solution is simple, before going through with this we check if there are any mouse_down events in 7555 // progress, if so we check if it is related to this widget or not. If so, we just reset the mouse_down and 7556 // then we continue. 7557 // In X11 and Windows we send a mouse_release event, however we don't do that here because we were already 7558 // ignoring that from before. I.e. Carbon did not send the mouse release event, so we will not send the 7559 // mouse release event. There are two ways to interpret this: 7560 // 1. If we don't send the mouse release event, the widget might get into an inconsistent state, i.e. it 7561 // might be waiting for a release event that will never arrive. 7562 // 2. If we send the mouse release event, then the widget might decide to trigger an action that is not 7563 // supposed to trigger because it is not visible. 7564 if(widget == qt_button_down) 7565 qt_button_down = 0; 7566 #endif // QT_MAC_USE_COCOA 7524 7567 if (spontaneous) 7525 7568 widget->setAttribute(Qt::WA_Mapped, false); … … 7916 7959 if(w && w->isWindow() && w->isVisible() && w->isEnabled()) { 7917 7960 LONG dwStyle = GetWindowLong(w->winId(), GWL_STYLE); 7961 LONG newStyle = dwStyle; 7918 7962 if (setStyle) 7919 dwStyle |= WS_DISABLED;7963 newStyle |= WS_DISABLED; 7920 7964 else 7921 dwStyle &= ~WS_DISABLED; 7922 SetWindowLong(w->winId(), GWL_STYLE, dwStyle); 7923 // we might need to repaint in some situations (eg. menu) 7924 w->repaint(); 7965 newStyle &= ~WS_DISABLED; 7966 if (newStyle != dwStyle) { 7967 SetWindowLong(w->winId(), GWL_STYLE, newStyle); 7968 // we might need to repaint in some situations (eg. menu) 7969 w->repaint(); 7970 } 7925 7971 } 7926 7972 } … … 8262 8308 8263 8309 #ifdef QT_SOFTKEYS_ENABLED 8264 if (isWindow() && isActiveWindow())8310 if (isWindow()) 8265 8311 QSoftKeyManager::updateSoftKeys(); 8266 8312 #endif … … 11731 11777 return targetWidget; 11732 11778 } 11779 11780 /*! 11781 \internal 11782 11783 Tells us if it there is currently a reachable widget by keypad navigation in 11784 a certain \a orientation. 11785 If no navigation is possible, occuring key events in that \a orientation may 11786 be used to interact with the value in the focussed widget, even though it 11787 currently has not the editFocus. 11788 11789 \sa QWidgetPrivate::widgetInNavigationDirection(), QWidget::hasEditFocus() 11790 */ 11791 bool QWidgetPrivate::canKeypadNavigate(Qt::Orientation orientation) 11792 { 11793 return orientation == Qt::Horizontal? 11794 (QWidgetPrivate::widgetInNavigationDirection(QWidgetPrivate::DirectionEast) 11795 || QWidgetPrivate::widgetInNavigationDirection(QWidgetPrivate::DirectionWest)) 11796 :(QWidgetPrivate::widgetInNavigationDirection(QWidgetPrivate::DirectionNorth) 11797 || QWidgetPrivate::widgetInNavigationDirection(QWidgetPrivate::DirectionSouth)); 11798 } 11799 /*! 11800 \internal 11801 11802 Checks, if the \a widget is inside a QTabWidget. If is is inside 11803 one, left/right key events will be used to switch between tabs in keypad 11804 navigation. If there is no QTabWidget, the horizontal key events can be used 11805 to 11806 interact with the value in the focussed widget, even though it currently has 11807 not the editFocus. 11808 11809 \sa QWidget::hasEditFocus() 11810 */ 11811 bool QWidgetPrivate::inTabWidget(QWidget *widget) 11812 { 11813 for (QWidget *tabWidget = widget; tabWidget; tabWidget = tabWidget->parentWidget()) 11814 if (qobject_cast<const QTabWidget*>(tabWidget)) 11815 return true; 11816 return false; 11817 } 11733 11818 #endif 11734 11819 -
trunk/src/gui/kernel/qwidget_mac.mm
r651 r769 153 153 QWidget *mac_mouse_grabber = 0; 154 154 QWidget *mac_keyboard_grabber = 0; 155 extern QPointer<QWidget> qt_button_down; //qapplication_mac.cpp 155 156 156 157 #ifndef QT_MAC_USE_COCOA … … 563 564 // below 'stays on top' windows. Add 1 to get above pure stay-on-top windows. 564 565 qt_mac_set_window_group(window, Qt::Popup, qt_mac_get_group_level(kOverlayWindowClass)+1); 566 } 567 #endif 568 569 #ifdef QT_MAC_USE_COCOA 570 void qt_mac_set_needs_display(QWidget *widget, QRegion region) 571 { 572 NSView *theNSView = qt_mac_nativeview_for(widget); 573 if (region.isEmpty()) { 574 [theNSView setNeedsDisplay:YES]; 575 return; 576 } 577 578 QVector<QRect> rects = region.rects(); 579 for (int i = 0; i<rects.count(); ++i) { 580 const QRect &rect = rects.at(i); 581 NSRect nsrect = NSMakeRect(rect.x(), rect.y(), rect.width(), rect.height()); 582 [theNSView setNeedsDisplayInRect:nsrect]; 583 } 584 565 585 } 566 586 #endif … … 848 868 QApplication::sendSpontaneousEvent(widget, &e); 849 869 } 850 extern QPointer<QWidget> qt_button_down; //qapplication_mac.cpp851 870 qt_button_down = 0; 852 871 } else if(ekind == kEventWindowCollapsed) { … … 876 895 QEvent e(QEvent::Hide); 877 896 QApplication::sendSpontaneousEvent(widget, &e); 878 extern QPointer<QWidget> qt_button_down; //qapplication_mac.cpp879 897 qt_button_down = 0; 880 898 } else if(ekind == kEventWindowToolbarSwitchMode) { … … 1250 1268 if(widget->testAttribute(Qt::WA_WState_InPaintEvent)) 1251 1269 qWarning("QWidget::repaint: Recursive repaint detected"); 1270 if (widget->isWindow() && !widget->d_func()->isOpaque 1271 && !widget->testAttribute(Qt::WA_MacBrushedMetal)) { 1272 QRect qrgnRect = qrgn.boundingRect(); 1273 CGContextClearRect(cg, CGRectMake(qrgnRect.x(), qrgnRect.y(), qrgnRect.width(), qrgnRect.height())); 1274 } 1252 1275 1253 1276 QPoint redirectionOffset(0, 0); … … 1299 1322 widget->d_func()->restoreRedirected(); 1300 1323 } 1301 1302 if (widget->isWindow() && !widget->d_func()->isOpaque1303 && !widget->testAttribute(Qt::WA_MacBrushedMetal)) {1304 QRect qrgnRect = qrgn.boundingRect();1305 CGContextClearRect(cg, CGRectMake(qrgnRect.x(), qrgnRect.y(), qrgnRect.width(), qrgnRect.height()));1306 }1307 1308 1324 1309 1325 if(!HIObjectIsOfClass((HIObjectRef)hiview, kObjectQWidget)) … … 1503 1519 qt_event_request_window_change(widget); 1504 1520 if (!HIViewIsVisible(HIViewRef(widget->winId()))) { 1505 extern QPointer<QWidget> qt_button_down; //qapplication_mac.cpp1506 1521 if (widget == qt_button_down) 1507 1522 qt_button_down = 0; … … 1512 1527 case kEventClassMouse: { 1513 1528 bool send_to_app = false; 1514 extern QPointer<QWidget> qt_button_down; //qapplication_mac.cpp1515 1529 if(qt_button_down) 1516 1530 send_to_app = true; … … 3389 3403 if((q->windowType() == Qt::Desktop)) //you can't hide the desktop! 3390 3404 return; 3391 3392 3405 QMacCocoaAutoReleasePool pool; 3393 3406 if(q->isWindow()) { … … 3511 3524 if (!QWidget::mouseGrabber()){ 3512 3525 QWidget *enterWidget = QApplication::widgetAt(QCursor::pos()); 3526 if (enterWidget && enterWidget->data->in_destructor) 3527 enterWidget = 0; 3513 3528 QApplicationPrivate::dispatchEnterLeave(enterWidget, qt_mouseover); 3514 3529 qt_mouseover = enterWidget; … … 4455 4470 } 4456 4471 4472 // ### Scroll the dirty regions as well, the following is not correct. 4473 QRegion displayRegion = r.isNull() ? dirtyOnWidget : (dirtyOnWidget & r); 4474 const QVector<QRect> &rects = dirtyOnWidget.rects(); 4475 const QVector<QRect>::const_iterator end = rects.end(); 4476 QVector<QRect>::const_iterator it = rects.begin(); 4477 while (it != end) { 4478 const QRect rect = *it; 4479 const NSRect dirtyRect = NSMakeRect(rect.x() + dx, rect.y() + dy, 4480 rect.width(), rect.height()); 4481 [view setNeedsDisplayInRect:dirtyRect]; 4482 ++it; 4483 } 4484 4457 4485 NSSize deltaSize = NSMakeSize(dx, dy); 4458 [view translateRectsNeedingDisplayInRect:scrollRect by:deltaSize];4459 4486 [view scrollRect:scrollRect by:deltaSize]; 4460 4487 [view setNeedsDisplayInRect:deltaXRect]; … … 4656 4683 return; 4657 4684 4658 if (extra->hasMask && extra->maskBits.size() != q->size()) { 4659 extra->maskBits = QImage(q->size(), QImage::Format_Mono); 4685 if (extra->hasMask) { 4686 if(extra->maskBits.size() != q->size()) { 4687 extra->maskBits = QImage(q->size(), QImage::Format_Mono); 4688 } 4660 4689 extra->maskBits.fill(QColor(Qt::color1).rgba()); 4661 4690 extra->maskBits.setNumColors(2); -
trunk/src/gui/kernel/qwidget_p.h
r705 r769 242 242 243 243 /** 244 * If this bit is set, each native widget receives the signals from the 245 * Symbian control immediately before and immediately after draw ops are 246 * sent to the window server for this control: 247 * void beginNativePaintEvent(const QRect &paintRect); 248 * void endNativePaintEvent(const QRect &paintRect); 249 */ 250 uint receiveNativePaintEvents : 1; 251 252 /** 244 253 * Defines the behaviour of QSymbianControl::Draw. 245 254 */ … … 266 275 }; 267 276 268 NativePaintMode nativePaintMode : 2; 269 270 /** 271 * If this bit is set, each native widget receives the signals from the 272 * Symbian control immediately before and immediately after draw ops are 273 * sent to the window server for this control: 274 * void beginNativePaintEvent(const QRect &paintRect); 275 * void endNativePaintEvent(const QRect &paintRect); 276 */ 277 uint receiveNativePaintEvents : 1; 277 NativePaintMode nativePaintMode; 278 278 279 279 #elif defined(Q_WS_PM) // <----------------------------------------------------- PM … … 483 483 static bool navigateToDirection(Direction direction); 484 484 static QWidget *widgetInNavigationDirection(Direction direction); 485 static bool canKeypadNavigate(Qt::Orientation orientation); 486 static bool inTabWidget(QWidget *widget); 485 487 #endif 486 488 … … 694 696 uint isScrolled : 1; 695 697 uint isMoved : 1; 698 uint isGLWidget : 1; 696 699 uint usesDoubleBufferedGLContext : 1; 697 700 … … 734 737 // This is new stuff 735 738 uint needWindowChange : 1; 736 uint isGLWidget : 1;737 739 738 740 // Each wiget keeps a list of all its child and grandchild OpenGL widgets. -
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 -
trunk/src/gui/kernel/qwidget_win.cpp
r651 r769 2053 2053 return; 2054 2054 2055 if (!QApplicationPrivate::HasTouchSupport) 2056 return; 2055 2057 QApplicationPrivate *qAppPriv = QApplicationPrivate::instance(); 2056 2058 if (!qAppPriv->SetGestureConfig) -
trunk/src/gui/kernel/qwidget_x11.cpp
r651 r769 347 347 } 348 348 349 static Bool checkForConfigureAndExpose(Display *, XEvent *e, XPointer)350 {351 return e->type == ConfigureNotify || e->type == Expose;352 }353 354 349 Q_GUI_EXPORT void qt_x11_wait_for_window_manager(QWidget* w) 355 350 { … … 364 359 return; 365 360 366 if (!(w->windowFlags() & Qt::X11BypassWindowManagerHint)) { 367 // if the window is not override-redirect, then the window manager 368 // will reparent us to the frame decoration window. 369 while (!XCheckTypedWindowEvent(X11->display, w->effectiveWinId(), ReparentNotify, &ev)) { 370 if (t.elapsed() > maximumWaitTime) 371 return; 372 qApp->syncX(); // non-busy wait 373 } 374 } 375 376 while (!XCheckTypedWindowEvent(X11->display, w->effectiveWinId(), MapNotify, &ev)) { 361 WId winid = w->internalWinId(); 362 363 // first deliver events that are already in the local queue 364 QApplication::sendPostedEvents(); 365 366 // the normal sequence is: 367 // ... ConfigureNotify ... ReparentNotify ... MapNotify ... Expose 368 // with X11BypassWindowManagerHint: 369 // ConfigureNotify ... MapNotify ... Expose 370 371 enum State { 372 Initial, Mapped 373 } state = Initial; 374 375 do { 376 if (XEventsQueued(X11->display, QueuedAlready)) { 377 XNextEvent(X11->display, &ev); 378 qApp->x11ProcessEvent(&ev); 379 380 switch (state) { 381 case Initial: 382 if (ev.type == MapNotify && ev.xany.window == winid) 383 state = Mapped; 384 break; 385 case Mapped: 386 if (ev.type == Expose && ev.xany.window == winid) 387 return; 388 break; 389 } 390 } else { 391 if (!XEventsQueued(X11->display, QueuedAfterFlush)) 392 qApp->syncX(); // non-busy wait 393 } 377 394 if (t.elapsed() > maximumWaitTime) 378 395 return; 379 qApp->syncX(); // non-busy wait 380 } 381 382 qApp->x11ProcessEvent(&ev); 383 384 // ok, seems like the window manager successfully reparented us, we'll wait 385 // for the first paint event to arrive, while handling ConfigureNotify in 386 // the arrival order 387 while(1) 388 { 389 if (XCheckIfEvent(X11->display, &ev, checkForConfigureAndExpose, 0)) { 390 qApp->x11ProcessEvent(&ev); 391 if (ev.type == Expose) 392 return; 393 } 394 if (t.elapsed() > maximumWaitTime) 395 return; 396 qApp->syncX(); // non-busy wait 397 } 396 } while(1); 398 397 } 399 398 -
trunk/src/gui/kernel/qwinnativepangesturerecognizer_win_p.h
r651 r769 55 55 56 56 #include <QGestureRecognizer> 57 #include <objbase.h> 58 59 class IInkRectangle; 60 class TabletHardwareCapabilities; 61 class TabletPropertyMetricUnit; 62 DECLARE_INTERFACE_(IInkTablet, IDispatch) 63 { 64 STDMETHOD(get_Name)(THIS_ BSTR *Name) PURE; 65 STDMETHOD(get_PlugAndPlayId)(THIS_ BSTR *Id) PURE; 66 STDMETHOD(get_MaximumInputRectangle)(THIS_ IInkRectangle **Rectangle) PURE; 67 STDMETHOD(get_HardwareCapabilities)(THIS_ TabletHardwareCapabilities *Capabilities) PURE; 68 STDMETHOD(IsPacketPropertySupported)(THIS_ BSTR packetPropertyName) PURE; 69 STDMETHOD(GetPropertyMetrics)(THIS_ BSTR propertyName, long *Minimum, long *Maximum, TabletPropertyMetricUnit *Units, float *Resolution) PURE; 70 }; 71 enum TabletDeviceKind 72 { 73 TDK_Mouse = 0, 74 TDK_Pen = 1, 75 TDK_Touch = 2 76 }; 77 DECLARE_INTERFACE_(IInkTablet2, IDispatch) 78 { 79 STDMETHOD(get_DeviceKind)(THIS_ TabletDeviceKind *Kind) PURE; 80 }; 81 DECLARE_INTERFACE_(IInkTablets, IDispatch) 82 { 83 STDMETHOD(get_Count)(THIS_ long *Count) PURE; 84 STDMETHOD(get__NewEnum)(THIS_ IUnknown **_NewEnum) PURE; 85 STDMETHOD(get_DefaultTablet)(THIS_ IInkTablet **DefaultTablet) PURE; 86 STDMETHOD(Item)(THIS_ long Index, IInkTablet **Tablet) PURE; 87 STDMETHOD(IsPacketPropertySupported)(THIS_ BSTR packetPropertyName, VARIANT_BOOL *Supported) PURE; 88 }; 57 89 58 90 QT_BEGIN_NAMESPACE
Note:
See TracChangeset
for help on using the changeset viewer.