Changeset 769 for trunk/src/gui/kernel


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

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

Location:
trunk
Files:
48 edited

Legend:

Unmodified
Added
Removed
  • trunk

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

    r651 r769  
    139139QT_BEGIN_NAMESPACE
    140140
    141 extern void qt_call_post_routines();
     141Q_DECL_IMPORT extern void qt_call_post_routines();
    142142
    143143int QApplicationPrivate::app_compile_version = 0x040000; //we don't know exactly, but it's at least 4.0.0
     
    895895    QWidgetPrivate::mapper = new QWidgetMapper;
    896896    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
    897905    if (qt_appType != QApplication::Tty)
    898906        (void) QApplication::style();  // trigger creation of application style
     
    929937    qInitDrawhelperAsm();
    930938
    931 #if !defined(Q_WS_X11) && !defined(Q_WS_QWS)
    932     // initialize the graphics system - on X11 this is initialized inside
    933     // 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 #endif
    937939#ifndef QT_NO_WHEELEVENT
    938940    QApplicationPrivate::wheel_scroll_lines = 3;
  • trunk/src/gui/kernel/qapplication_mac.mm

    r651 r769  
    21442144
    21452145            if (wheel_deltaX || wheel_deltaY) {
     2146#ifndef QT_NO_WHEELEVENT
    21462147                if (wheel_deltaX) {
    21472148                    QWheelEvent qwe(plocal, p, wheel_deltaX, buttons, modifiers, Qt::Horizontal);
     
    21662167                    }
    21672168                }
     2169#endif // QT_NO_WHEELEVENT
    21682170            } else {
    21692171#ifdef QMAC_SPEAK_TO_ME
     
    27182720}
    27192721
     2722#ifndef QT_NO_WHEELEVENT
    27202723void QApplication::setWheelScrollLines(int n)
    27212724{
     
    27272730    return QApplicationPrivate::wheel_scroll_lines;
    27282731}
     2732#endif
    27292733
    27302734void QApplication::setEffectEnabled(Qt::UIEffect effect, bool enable)
     
    28892893        QApplication::setCursorFlashTime(num);
    28902894
     2895#ifndef QT_NO_WHEELEVENT
    28912896        num = settings.value(QLatin1String("wheelScrollLines"),
    28922897                            QApplication::wheelScrollLines()).toInt();
    28932898        QApplication::setWheelScrollLines(num);
     2899#endif
    28942900
    28952901        QString colorspec = settings.value(QLatin1String("colorSpec"),
  • trunk/src/gui/kernel/qapplication_p.h

    r651 r769  
    429429    static int  mouse_double_click_time;
    430430    static int  keyboard_input_time;
     431#ifndef QT_NO_WHEELEVENT
    431432    static int  wheel_scroll_lines;
     433#endif
    432434
    433435    static bool animate_ui;
     
    533535
    534536#if defined(Q_WS_WIN)
     537    static bool HasTouchSupport;
    535538    static PtrRegisterTouchWindow RegisterTouchWindow;
    536539    static PtrGetTouchInputInfo GetTouchInputInfo;
     
    568571#endif
    569572
    570 #if defined(Q_WS_S60)
     573#if defined(Q_OS_SYMBIAN)
     574    int pressureSupported;
    571575    int maxTouchPressure;
    572576    QList<QTouchEvent::TouchPoint> appAllTouchPoints;
  • trunk/src/gui/kernel/qapplication_s60.cpp

    r651 r769  
    5353#include "qdebug.h"
    5454#include "qimage.h"
     55#include "qcombobox.h"
    5556#include "private/qkeymapper_p.h"
    5657#include "private/qfont_p.h"
     
    6465
    6566#include "apgwgnam.h" // For CApaWindowGroupName
    66 #include <MdaAudioTonePlayer.h>     // For CMdaAudioToneUtility
     67#include <mdaaudiotoneplayer.h>     // For CMdaAudioToneUtility
    6768
    6869#if defined(Q_WS_S60)
     
    7374# include <private/qs60mainapplication_p.h>
    7475# include <centralrepository.h>
     76# include "qs60mainappui.h"
    7577#endif
    7678
     
    372374    if (S60->curWin == this)
    373375        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    }
    376383    S60->appUi()->RemoveFromStack(this);
    377384    delete m_longTapDetector;
     
    401408{
    402409    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);
    403416
    404417    QRect screenGeometry = qApp->desktop()->screenGeometry(qwidget);
    405418
    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()));
    408422
    409423    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];
    412426
    413427        if (touchPoint.id() == event->PointerNumber()) {
     
    434448            touchPoint.setState(state);
    435449
    436             QPointF screenPos = QPointF(event->iPosition.iX, event->iPosition.iY);
     450            QPointF screenPos = qwidget->mapToGlobal(QPoint(event->iPosition.iX, event->iPosition.iY));
    437451            touchPoint.setScreenPos(screenPos);
    438452            touchPoint.setNormalizedPos(QPointF(screenPos.x() / screenGeometry.width(),
    439453                                                screenPos.y() / screenGeometry.height()));
    440454
    441             touchPoint.setPressure(event->Pressure() / qreal(d->maxTouchPressure));
     455            touchPoint.setPressure(pressure);
    442456        } else if (touchPoint.state() != Qt::TouchPointReleased) {
    443457            // all other active touch points should be marked as stationary
     
    451465        // all touch points released
    452466        d->appAllTouchPoints.clear();
     467    } else {
     468        d->appAllTouchPoints = points;
    453469    }
    454470
    455471    QApplicationPrivate::translateRawTouchEvent(qwidget,
    456472                                                QTouchEvent::TouchScreen,
    457                                                 d->appAllTouchPoints);
     473                                                points);
    458474}
    459475#endif
     
    533549    sendMouseEvent(receiver, type, globalPos, button, modifiers);
    534550}
     551
     552#ifdef Q_WS_S60
     553void QSymbianControl::HandleStatusPaneSizeChange()
     554{
     555    QS60MainAppUi *s60AppUi = static_cast<QS60MainAppUi *>(S60->appUi());
     556    s60AppUi->HandleStatusPaneSizeChange();
     557}
     558#endif
    535559
    536560void QSymbianControl::sendMouseEvent(
     
    598622                keyEvent.iCode);
    599623        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) {
    601627            // Normal characters keys.
    602628            keyCode = s60Keysym;
     
    626652                QPoint pos = QCursor::pos();
    627653                TPointerEvent fakeEvent;
     654                fakeEvent.iType = (TPointerEvent::TType)(-1);
    628655                TInt x = pos.x();
    629656                TInt y = pos.y();
    630657                if (type == EEventKeyUp) {
    631                     if (keyCode == Qt::Key_Select)
     658                    if (keyCode == Qt::Key_Select &&
     659                        (S60->virtualMousePressedKeys & QS60Data::Select))
    632660                        fakeEvent.iType = TPointerEvent::EButton1Up;
    633661                    S60->virtualMouseAccel = 1;
     
    678706                        // down messages for some keys. Therefore, make sure we have a clean slate
    679707                        // 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) {
    682709                            return EKeyWasConsumed;
    683710                        } else {
     
    702729                fakeEvent.iPosition = cpos;
    703730                fakeEvent.iParentPosition = epos;
    704                 HandlePointerEvent(fakeEvent);
     731                if(fakeEvent.iType != -1)
     732                    HandlePointerEvent(fakeEvent);
    705733                return EKeyWasConsumed;
    706734            }
     
    907935            if (!slowResize && tlwExtra)
    908936                tlwExtra->inTopLevelResize = false;
     937        } else {
     938            QResizeEvent *e = new QResizeEvent(newSize, oldSize);
     939            QApplication::postEvent(qwidget, e);
    909940        }
    910941    }
     
    965996#ifdef Q_WS_S60
    966997        // 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();
    9691000        TBool visible = !(qwidget->windowState() & (Qt::WindowFullScreen | Qt::WindowMinimized));
    9701001        if (statusPane)
    9711002            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        }
    9741009#endif
    9751010    } else if (QApplication::activeWindow() == qwidget->window()) {
    976         if (CCoeEnv::Static()->AppUi()->IsDisplayingMenuOrDialog()) {
     1011        if (CCoeEnv::Static()->AppUi()->IsDisplayingMenuOrDialog() || S60->menuBeingConstructed) {
    9771012            QWidget *fw = QApplication::focusWidget();
    9781013            if (fw) {
     
    9891024}
    9901025
     1026void 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
    9911047void QSymbianControl::HandleResourceChange(int resourceType)
    9921048{
    9931049    switch (resourceType) {
    9941050    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();
    10011052        if (IsFocused() && IsVisible()) {
    10021053            qwidget->d_func()->setWindowIcon_sys(true);
     
    10101061    case KEikDynamicLayoutVariantSwitch:
    10111062    {
    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();
    10181064        break;
    10191065    }
     
    11461192#endif
    11471193        S60->wsSession().SetAutoFlush(ETrue);
     1194
     1195#ifdef Q_SYMBIAN_WINDOW_SIZE_CACHE
     1196    TRAP_IGNORE(S60->wsSession().EnableWindowSizeCacheL());
     1197#endif
    11481198
    11491199    S60->updateScreenSize();
     
    12091259
    12101260    S60->avkonComponentsSupportTransparency = false;
     1261    S60->menuBeingConstructed = false;
    12111262
    12121263#ifdef Q_WS_S60
     
    12241275        }
    12251276    }
    1226 #endif   
     1277#endif
    12271278
    12281279    if (touch) {
     
    13791430void QApplicationPrivate::openPopup(QWidget *popup)
    13801431{
     1432    if (popup && qobject_cast<QComboBox *>(popup->parentWidget()))
     1433        static_cast<QSymbianControl *>(popup->effectiveWinId())->FadeBehindPopup(ETrue);
     1434
    13811435    if (!QApplicationPrivate::popupWidgets)
    13821436        QApplicationPrivate::popupWidgets = new QWidgetList;
    13831437    QApplicationPrivate::popupWidgets->append(popup);
    1384 
    13851438
    13861439    // Cancel focus widget pointer capture and long tap timer
     
    14221475void QApplicationPrivate::closePopup(QWidget *popup)
    14231476{
     1477    if (popup && qobject_cast<QComboBox *>(popup->parentWidget()))
     1478        static_cast<QSymbianControl *>(popup->effectiveWinId())->FadeBehindPopup(EFalse);
     1479
    14241480    if (!QApplicationPrivate::popupWidgets)
    14251481        return;
     
    14451501              : q_func()->focusWidget();
    14461502          if (fw) {
     1503              if(fw->window()->isModal()) // restore pointer capture for modal window
     1504                  fw->effectiveWinId()->SetPointerCapture(true);
     1505
    14471506              if (fw != q_func()->focusWidget()) {
    14481507                  fw->setFocus(Qt::PopupFocusReason);
     
    18701929{
    18711930#ifdef QT_SYMBIAN_SUPPORTS_ADVANCED_POINTER
     1931    if (HAL::Get(HALData::EPointer3DPressureSupported, pressureSupported) != KErrNone)
     1932        pressureSupported = 0;
    18721933    if (HAL::Get(HALData::EPointer3DMaxPressure, maxTouchPressure) != KErrNone)
    18731934        maxTouchPressure = KMaxTInt;
  • trunk/src/gui/kernel/qapplication_win.cpp

    r651 r769  
    116116#endif
    117117
     118#include "private/qwinnativepangesturerecognizer_win_p.h"
     119
    118120#ifndef WM_TOUCH
    119121#  define WM_TOUCH 0x0240
     
    929931    bool icon;
    930932    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) {
    932938        cname = QLatin1String("QWidgetOwnDC");
    933939        style = CS_DBLCLKS;
     
    10221028    wc.hCursor      = 0;
    10231029#ifndef Q_WS_WINCE
    1024     wc.hbrBackground = (HBRUSH)GetSysColorBrush(COLOR_WINDOW);
     1030    wc.hbrBackground = qt_widget_private(w)->isGLWidget ? 0 : (HBRUSH)GetSysColorBrush(COLOR_WINDOW);
    10251031#else
    10261032    wc.hbrBackground = 0;
     
    19021908
    19031909            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
    19041914                QString area = QString::fromWCharArray((wchar_t*)msg.lParam);
    19051915                if (area == QLatin1String("intl")) {
     1916#endif
    19061917                    QLocalePrivate::updateSystemPrivate();
    19071918                    if (!widget->testAttribute(Qt::WA_SetLocale))
     
    24372448            else
    24382449#ifndef QT_NO_MENUBAR
    2439                 QMenuBar::wceCommands(LOWORD(wParam), (HWND) lParam);
     2450                QMenuBar::wceCommands(LOWORD(wParam));
    24402451#endif
    24412452            result = true;
     
    25162527            result = false;
    25172528            break;
     2529#if !defined(Q_WS_WINCE) || defined(QT_WINCE_GESTURES)
    25182530        case WM_GESTURE: {
    25192531            GESTUREINFO gi;
     
    25482560            break;
    25492561        }
     2562#endif // !defined(Q_WS_WINCE) || defined(QT_WINCE_GESTURES)
    25502563        default:
    25512564            result = false;                        // event was not processed
     
    36173630
    36183631    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    }
    36263645    PAINTSTRUCT ps;
    36273646    d_func()->hd = BeginPaint(internalWinId(), &ps);
     
    39844003
    39854004
     4005bool QApplicationPrivate::HasTouchSupport = false;
    39864006PtrRegisterTouchWindow QApplicationPrivate::RegisterTouchWindow = 0;
    39874007PtrGetTouchInputInfo QApplicationPrivate::GetTouchInputInfo = 0;
     
    39904010void QApplicationPrivate::initializeMultitouch_sys()
    39914011{
     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
    39924044    QLibrary library(QLatin1String("user32"));
    39934045    // MinGW (g++ 3.4.5) accepts only C casts.
  • trunk/src/gui/kernel/qapplication_x11.cpp

    r651 r769  
    9797#endif
    9898
     99#ifndef QT_GUI_DOUBLE_CLICK_RADIUS
     100#define QT_GUI_DOUBLE_CLICK_RADIUS 5
     101#endif
     102
     103
    99104//#define ALIEN_DEBUG
    100105
     
    316321    "_XEMBED_INFO\0"
    317322
     323    // Wacom old. (before version 0.10)
    318324    "Wacom Stylus\0"
    319325    "Wacom Cursor\0"
    320326    "Wacom Eraser\0"
     327
     328    // Tablet
     329    "STYLUS\0"
     330    "ERASER\0"
    321331};
    322332
     
    945955    QApplication::setCursorFlashTime(num);
    946956
     957#ifndef QT_NO_WHEELEVENT
    947958    num =
    948959        settings.value(QLatin1String("wheelScrollLines"),
    949960                       QApplication::wheelScrollLines()).toInt();
    950961    QApplication::setWheelScrollLines(num);
     962#endif
    951963
    952964    QString colorspec = settings.value(QLatin1String("colorSpec"),
     
    23602372                }
    23612373#else
    2362                 if (devs->type == ATOM(XWacomStylus)) {
     2374                if (devs->type == ATOM(XWacomStylus) || devs->type == ATOM(XTabletStylus)) {
    23632375                    deviceType = QTabletEvent::Stylus;
    23642376                    if (wacomDeviceName()->isEmpty())
    23652377                        wacomDeviceName()->append(devs->name);
    23662378                    gotStylus = true;
    2367                 } else if (devs->type == ATOM(XWacomEraser)) {
     2379                } else if (devs->type == ATOM(XWacomEraser) || devs->type == ATOM(XTabletEraser)) {
    23682380                    deviceType = QTabletEvent::XFreeEraser;
    23692381                    gotEraser = true;
     
    42144226                (long)event->xbutton.time -(long)mouseButtonPressTime
    42154227                < 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) {
    42184230                type = QEvent::MouseButtonDblClick;
    42194231                mouseButtonPressTime -= 2000;        // no double-click next time
     
    44024414        if (popup && window() != popup)
    44034415            popup->close();
     4416#ifndef QT_NO_WHEELEVENT
    44044417        QWheelEvent e(pos, globalPos, delta, buttons, modifiers, orient);
    44054418        if (QApplication::sendSpontaneousEvent(widget, &e))
     4419#endif
    44064420            return true;
    44074421    }
     
    44144428        if (popup && widget != popup)
    44154429            popup->hide();
     4430#ifndef QT_NO_WHEELEVENT
    44164431        QWheelEvent e(pos, globalPos, delta, buttons, modifiers, orient);
    44174432        if (QApplication::sendSpontaneousEvent(widget, &e))
     4433#endif
    44184434            return true;
    44194435    }
     
    53145330}
    53155331
     5332#ifndef QT_NO_WHEELEVENT
    53165333void QApplication::setWheelScrollLines(int n)
    53175334{
     
    53235340    return QApplicationPrivate::wheel_scroll_lines;
    53245341}
     5342#endif
    53255343
    53265344void QApplication::setEffectEnabled(Qt::UIEffect effect, bool enable)
  • trunk/src/gui/kernel/qclipboard_mac.cpp

    r651 r769  
    389389        QStringList formats = mime_src->formats();
    390390
     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
    391403        for(int f = 0; f < formats.size(); ++f) {
    392404            QString mimeType = formats.at(f);
  • trunk/src/gui/kernel/qclipboard_s60.cpp

    r651 r769  
    165165        aStream >> mimeTypeSize;
    166166        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());
    168169        CleanupStack::PopAndDestroy(mimeTypeBuf);
    169170        // mime data
  • trunk/src/gui/kernel/qcocoamenuloader_mac.mm

    r651 r769  
    111111}
    112112
     113- (void)removeActionsFromAppMenu
     114{
     115    for (NSMenuItem *item in [appMenu itemArray])
     116        [item setTag:nil];
     117}
     118
    113119- (void)dealloc
    114120{
  • trunk/src/gui/kernel/qcocoamenuloader_mac_p.h

    r651 r769  
    7171}
    7272- (void)ensureAppMenuInMenu:(NSMenu *)menu;
     73- (void)removeActionsFromAppMenu;
    7374- (NSMenu *)applicationMenu;
    7475- (NSMenu *)menu;
  • trunk/src/gui/kernel/qcocoapanel_mac.mm

    r651 r769  
    4747#import <private/qcocoaview_mac_p.h>
    4848#import <private/qcocoawindowcustomthemeframe_mac_p.h>
     49#include <private/qapplication_p.h>
     50#include <private/qbackingstore_p.h>
     51
    4952
    5053#include <QtGui/QWidget>
  • trunk/src/gui/kernel/qcocoasharedwindowmethods_mac_p.h

    r651 r769  
    5151 NSPanel, while QCocoaWindow needs to inherit NSWindow rather than NSPanel).
    5252****************************************************************************/
     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
    5356
    5457QT_BEGIN_NAMESPACE
     
    186189}
    187190
     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  
    521521{
    522522    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        }
    527528    }
    528529    CGContextRef cg = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort];
     
    645646- (void)mouseEntered:(NSEvent *)event
    646647{
     648    if (qwidgetprivate->data.in_destructor)
     649        return;
    647650    QEvent enterEvent(QEvent::Enter);
    648651    NSPoint windowPoint = [event locationInWindow];
     
    826829    }
    827830
     831#ifndef QT_NO_WHEELEVENT
    828832    if (deltaX != 0) {
    829833        QWheelEvent qwe(qlocal, qglobal, deltaX, buttons, keyMods, Qt::Horizontal);
     
    866870        }
    867871    }
     872#endif //QT_NO_WHEELEVENT
     873
    868874    if (!wheelOK) {
    869875        return [super scrollWheel:theEvent];
     
    14021408    // setup the data
    14031409    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"));
    14051411    dragBoard.setMimeData(dragPrivate()->data);
    14061412
  • trunk/src/gui/kernel/qcocoawindow_mac_p.h

    r651 r769  
    5454#include "qmacdefines_mac.h"
    5555#import <Cocoa/Cocoa.h>
     56#include <private/qapplication_p.h>
     57#include <private/qbackingstore_p.h>
     58
    5659
    5760enum { QtMacCustomizeWindow = 1 << 21 }; // This will one day be run over by
  • trunk/src/gui/kernel/qcursor.cpp

    r651 r769  
    343343    \o B=0 and M=1 gives white.
    344344    \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.
    346347    \endlist
    347348
  • trunk/src/gui/kernel/qdesktopwidget_s60.cpp

    r651 r769  
    8989void QDesktopWidgetPrivate::init(QDesktopWidget *that)
    9090{
    91     int screenCount=0;
     91    Q_UNUSED(that);
     92//    int screenCount=0;
    9293
    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;
    97100
    98101    rects = new QVector<QRect>();
     
    101104    rects->resize(QDesktopWidgetPrivate::screenCount);
    102105    workrects->resize(QDesktopWidgetPrivate::screenCount);
    103 
    104     // ### TODO: Implement proper multi-display support
    105     rects->resize(1);
    106     rects->replace(0, that->rect());
    107     workrects->resize(1);
    108     workrects->replace(0, that->rect());
    109106}
    110107
  • trunk/src/gui/kernel/qdnd_s60.cpp

    r651 r769  
    5353#include "qt_s60_p.h"
    5454
    55 #include <COECNTRL.H>
     55#include <coecntrl.h>
    5656// pointer cursor
    5757#include <w32std.h>
  • trunk/src/gui/kernel/qdnd_x11.cpp

    r651 r769  
    618618            // to verify that it is utf16
    619619            if (data.size() > 1 && data.at(1) == 0)
    620                 return QString::fromUtf16(reinterpret_cast<const ushort *>(data.constData()),
     620                return QString::fromRawData((const QChar *)data.constData(),
    621621                                data.size() / 2).split(QLatin1Char('\n')).first().toLatin1();
    622622        }
  • trunk/src/gui/kernel/qeventdispatcher_mac.mm

    r651 r769  
    493493        case NSOtherMouseUp:     
    494494        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
    495503            result    = true;
    496504        break;
  • trunk/src/gui/kernel/qgesturemanager.cpp

    r651 r769  
    4646#include "private/qgraphicsitem_p.h"
    4747#include "private/qevent_p.h"
     48#include "private/qapplication_p.h"
    4849#include "qgesture.h"
    4950#include "qevent.h"
     
    8788#if defined(Q_OS_WIN)
    8889  #if !defined(QT_NO_NATIVE_GESTURES)
    89     registerGestureRecognizer(new QWinNativePanGestureRecognizer);
     90    if (QApplicationPrivate::HasTouchSupport)
     91        registerGestureRecognizer(new QWinNativePanGestureRecognizer);
    9092  #endif
    9193#else
  • trunk/src/gui/kernel/qgridlayout.cpp

    r651 r769  
    18531853    \fn int QGridLayout::colSpacing(int col) const
    18541854
    1855     Use columnSpacing() instead.
     1855    Use columnMinimumWidth() instead.
    18561856*/
    18571857
  • trunk/src/gui/kernel/qguifunctions_wince.cpp

    r651 r769  
    279279bool qt_wince_is_windows_mobile_65()
    280280{
    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)));
    282289}
    283290
  • trunk/src/gui/kernel/qkeymapper_p.h

    r651 r769  
    217217#elif defined(Q_WS_QWS)
    218218#elif defined(Q_OS_SYMBIAN)
    219 private:
    220     QHash<TUint, int> s60ToQtKeyMap;
    221     void fillKeyMap();
    222219public:
    223220    QString translateKeyEvent(int keySym, Qt::KeyboardModifiers modifiers);
    224221    int mapS60KeyToQt(TUint s60key);
     222    int mapS60ScanCodesToQt(TUint s60key);
     223    int mapQtToS60Key(int qtKey);
     224    int mapQtToS60ScanCodes(int qtKey);
    225225#endif
    226226};
  • trunk/src/gui/kernel/qkeymapper_s60.cpp

    r651 r769  
    4747QKeyMapperPrivate::QKeyMapperPrivate()
    4848{
    49     fillKeyMap();
    5049}
    5150
     
    7574}
    7675
    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>
     77struct KeyMapping{
     78    TKeyCode s60KeyCode;
     79    TStdScanCode s60ScanCode;
     80    Qt::Key qtKey;
     81};
     82
     83using namespace Qt;
     84
     85static 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};
    235169
    236170int QKeyMapperPrivate::mapS60KeyToQt(TUint s60key)
    237171{
    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
     182int 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
     194int 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
     206int 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}
    247217QT_END_NAMESPACE
  • trunk/src/gui/kernel/qkeymapper_x11.cpp

    r651 r769  
    361361        if (code && code < 0xfffe)
    362362            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
    363370        if (code == baseCode)
    364371            continue;
     
    449456        if (code && code < 0xfffe)
    450457            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
    451465        if (code == baseCode)
    452466            continue;
     
    10601074    XF86XK_AudioRecord,         Qt::Key_MediaRecord,
    10611075    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,
    10641078    XF86XK_Memo,                Qt::Key_Memo,
    10651079    XF86XK_ToDoList,            Qt::Key_ToDoList,
     
    11591173    XF86XK_Suspend,             Qt::Key_Suspend,
    11601174    XF86XK_Hibernate,           Qt::Key_Hibernate,
    1161     XF86XK_Launch0,             Qt::Key_Launch2,
     1175    XF86XK_Launch0,             Qt::Key_Launch2, // ### Qt 5: remap properly
    11621176    XF86XK_Launch1,             Qt::Key_Launch3,
    11631177    XF86XK_Launch2,             Qt::Key_Launch4,
  • trunk/src/gui/kernel/qmime_mac.cpp

    r651 r769  
    432432        ret = QString(str);
    433433    } 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));
    436436    } else {
    437437        qWarning("QMime::convertToMime: unhandled mimetype: %s", qPrintable(mimetype));
  • trunk/src/gui/kernel/qmime_win.cpp

    r651 r769  
    641641            QList<QUrl> urls = mimeData->urls();
    642642            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            }
    645647            result.append('\0');
    646648            result.append('\0');
     
    648650        } else if (getCf(formatetc) == CF_INETURL) {
    649651            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();
    651655            return setData(result, pmedium);
    652656        }
  • trunk/src/gui/kernel/qsoftkeymanager.cpp

    r651 r769  
    5656QSoftKeyManager *QSoftKeyManagerPrivate::self = 0;
    5757
    58 const char *QSoftKeyManager::standardSoftKeyText(StandardSoftKey standardKey)
    59 {
    60     const char *softKeyText = 0;
     58QString QSoftKeyManager::standardSoftKeyText(StandardSoftKey standardKey)
     59{
     60    QString softKeyText;
    6161    switch (standardKey) {
    6262    case OkSoftKey:
    63         softKeyText = QT_TRANSLATE_NOOP("QSoftKeyManager", "Ok");
     63        softKeyText = QSoftKeyManager::tr("Ok");
    6464        break;
    6565    case SelectSoftKey:
    66         softKeyText = QT_TRANSLATE_NOOP("QSoftKeyManager", "Select");
     66        softKeyText = QSoftKeyManager::tr("Select");
    6767        break;
    6868    case DoneSoftKey:
    69         softKeyText = QT_TRANSLATE_NOOP("QSoftKeyManager", "Done");
     69        softKeyText = QSoftKeyManager::tr("Done");
    7070        break;
    7171    case MenuSoftKey:
    72         softKeyText = QT_TRANSLATE_NOOP("QSoftKeyManager", "Options");
     72        softKeyText = QSoftKeyManager::tr("Options");
    7373        break;
    7474    case CancelSoftKey:
    75         softKeyText = QT_TRANSLATE_NOOP("QSoftKeyManager", "Cancel");
     75        softKeyText = QSoftKeyManager::tr("Cancel");
    7676        break;
    7777    default:
     
    101101QAction *QSoftKeyManager::createAction(StandardSoftKey standardKey, QWidget *actionWidget)
    102102{
    103     const char* text = standardSoftKeyText(standardKey);
    104     QAction *action = new QAction(QSoftKeyManager::tr(text), actionWidget);
     103    QAction *action = new QAction(standardSoftKeyText(standardKey), actionWidget);
    105104    QAction::SoftKeyRole softKeyRole = QAction::NoSoftKey;
    106105    switch (standardKey) {
     
    117116    }
    118117    action->setSoftKeyRole(softKeyRole);
     118    action->setVisible(false);
     119    setForceEnabledInSoftkeys(action);
    119120    return action;
    120121}
     
    170171    Q_D(QSoftKeyManager);
    171172    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, actions.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);
    176177            ret = true;
    177178        }
    178179    }
    179180    return ret;
     181}
     182
     183
     184static 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;
    180192}
    181193
     
    186198    if (!previousSource) {
    187199        // 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        }
    191222    } else {
    192223        // Softkey merging is based on four criterias
     
    212243    bool recursiveMerging = false;
    213244    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    }
    221251
    222252    d->updateSoftKeys_sys();
    223253    return true;
     254}
     255
     256void QSoftKeyManager::setForceEnabledInSoftkeys(QAction *action)
     257{
     258    action->setProperty(FORCE_ENABLED_PROPERTY, QVariant(true));
     259}
     260
     261bool 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;
    224268}
    225269
  • trunk/src/gui/kernel/qsoftkeymanager_common_p.h

    r651 r769  
    7171    QHash<QAction*, Qt::Key> keyedActions;
    7272    QMultiHash<int, QAction*> requestedSoftKeyActions;
     73    QWidget *initialSoftKeySource;
    7374
    7475};
  • trunk/src/gui/kernel/qsoftkeymanager_p.h

    r651 r769  
    6464class QSoftKeyManagerPrivate;
    6565
    66 const char MENU_ACTION_PROPERTY[] = "_q_menuaction";
     66const char MENU_ACTION_PROPERTY[] = "_q_menuAction";
     67const char FORCE_ENABLED_PROPERTY[] = "_q_forceEnabledInSoftkeys";
    6768
    6869class Q_AUTOTEST_EXPORT QSoftKeyManager : public QObject
     
    8889    static QAction *createAction(StandardSoftKey standardKey, QWidget *actionWidget);
    8990    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);
    9094
    9195protected:
     
    9599    QSoftKeyManager();
    96100    static QSoftKeyManager *instance();
    97     static const char *standardSoftKeyText(StandardSoftKey standardKey);
    98101    bool appendSoftkeys(const QWidget &source, int level);
    99102    QWidget *softkeySource(QWidget *previousSource, bool& recursiveMerging);
  • trunk/src/gui/kernel/qsoftkeymanager_s60.cpp

    r651 r769  
    6161const int RSK_POSITION = 2;
    6262
    63 QSoftKeyManagerPrivateS60::QSoftKeyManagerPrivateS60()
     63QSoftKeyManagerPrivateS60::QSoftKeyManagerPrivateS60() : cbaHasImage(4) // 4 since MSK position index is 3
    6464{
    6565    cachedCbaIconSize[0] = QSize(0,0);
     
    6767    cachedCbaIconSize[2] = QSize(0,0);
    6868    cachedCbaIconSize[3] = QSize(0,0);
    69     skipNextUpdate = false;
    7069}
    7170
    7271bool QSoftKeyManagerPrivateS60::skipCbaUpdate()
    7372{
    74     // lets not update softkeys if
     73    // Lets not update softkeys if
    7574    // 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)) {
    8093        return true;
    8194    }
     
    255268
    256269            EikSoftkeyImage::SetImage(cba, *myimage, left); // Takes myimage ownership
     270            cbaHasImage[position] = true;
    257271            ret = true;
    258272        } else {
    259273            // Restore softkey to text based
    260             EikSoftkeyImage::SetLabel(cba, left);
     274            if (cbaHasImage[position]) {
     275                EikSoftkeyImage::SetLabel(cba, left);
     276                cbaHasImage[position] = false;
     277            }
    261278        }
    262279    }
     
    274291        int command = S60_COMMAND_START + position;
    275292        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);
    277295        realSoftKeyActions.insert(command, action);
    278296        return true;
     
    297315{
    298316    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;
    310319        if (windowType != Qt::Dialog && windowType != Qt::Popup) {
    311320            QString text(QSoftKeyManager::tr("Exit"));
    312321            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            }
    314326            setNativeSoftkey(cba, RSK_POSITION, EAknSoftkeyExit, nativeText);
     327            cba.DimCommand(EAknSoftkeyExit, false);
    315328            return true;
    316329        }
     
    355368}
    356369
     370static void resetMenuBeingConstructed(TAny* /*aAny*/)
     371{
     372    S60->menuBeingConstructed = false;
     373}
     374
     375void 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
    357383bool QSoftKeyManagerPrivateS60::handleCommand(int command)
    358384{
     
    361387        QVariant property = action->property(MENU_ACTION_PROPERTY);
    362388        if (property.isValid() && property.toBool()) {
    363             QT_TRAP_THROWING(S60->menuBar()->TryDisplayMenuBarL());
     389            QT_TRAP_THROWING(tryDisplayMenuBarL());
    364390        } else if (action->menu()) {
    365391            // TODO: This is hack, in order to use exising QMenuBar implementation for Symbian
    366392            // menubar needs to have widget to which it is associated. Since we want to associate
    367             // menubar to action (which is inherited from QObejct), we create and associate QWidget
     393            // menubar to action (which is inherited from QObject), we create and associate QWidget
    368394            // to action and pass that for QMenuBar. This associates the menubar to action, and we
    369395            // can have own menubar for each action.
     
    384410            }
    385411            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;
    398421        }
    399422    }
  • trunk/src/gui/kernel/qsoftkeymanager_s60_p.h

    r651 r769  
    5454//
    5555
     56#include "qbitarray.h"
    5657#include "private/qobject_p.h"
    5758#include "private/qsoftkeymanager_common_p.h"
     
    7879
    7980private:
     81    void tryDisplayMenuBarL();
    8082    bool skipCbaUpdate();
    8183    void ensureCbaVisibilityAndResponsiviness(CEikButtonGroupContainer &cba);
     
    99101    QHash<int, QAction*> realSoftKeyActions;
    100102    QSize cachedCbaIconSize[4];
    101     bool skipNextUpdate;
     103    QBitArray cbaHasImage;
    102104};
    103105
  • trunk/src/gui/kernel/qsound.cpp

    r651 r769  
    155155    \o A built-in mixing sound server is used, accessing \c /dev/dsp
    156156    directly. Only the WAVE format is supported.
     157    \row
    157158    \o Symbian
    158159    \o CMdaAudioPlayerUtility is used. All formats that Symbian OS or devices support
  • trunk/src/gui/kernel/qsound_mac.mm

    r651 r769  
    175175    QMacSoundDelegate * const delegate = [[QMacSoundDelegate alloc] initWithQSound:qSound:this];
    176176    [nsSound setDelegate:delegate];
     177    [nsFileName release];
    177178    return nsSound;
    178179}
  • trunk/src/gui/kernel/qsound_s60.cpp

    r651 r769  
    5252
    5353#include <e32std.h>
    54 #include <MdaAudioSamplePlayer.h>
     54#include <mdaaudiosampleplayer.h>
    5555
    5656QT_BEGIN_NAMESPACE
  • trunk/src/gui/kernel/qt_cocoa_helpers_mac.mm

    r651 r769  
    144144void macWindowFade(void * /*OSWindowRef*/ window, float durationSeconds)
    145145{
     146#ifdef QT_MAC_USE_COCOA
     147    QMacCocoaAutoReleasePool pool;
     148#endif
    146149    OSWindowRef wnd = static_cast<OSWindowRef>(window);
    147150    if (wnd) {
     
    11601163    QDBeginCGContext(port, &context);
    11611164#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]);
    11631166#endif
    11641167    return context;
     1168}
     1169
     1170void 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
    11651179}
    11661180
     
    12791293#endif
    12801294
     1295QMacCocoaAutoReleasePool::QMacCocoaAutoReleasePool()
     1296{
     1297#ifndef QT_MAC_USE_COCOA
     1298    NSApplicationLoad();
     1299#endif
     1300    pool = (void*)[[NSAutoreleasePool alloc] init];
     1301}
     1302
     1303QMacCocoaAutoReleasePool::~QMacCocoaAutoReleasePool()
     1304{
     1305    [(NSAutoreleasePool*)pool release];
     1306}
     1307
    12811308QT_END_NAMESPACE
  • trunk/src/gui/kernel/qt_s60_p.h

    r651 r769  
    6969
    7070#ifdef Q_WS_S60
    71 #include <aknutils.h>               // AknLayoutUtils
     71#include <AknUtils.h>               // AknLayoutUtils
    7272#include <avkon.hrh>                // EEikStatusPaneUidTitle
    7373#include <akntitle.h>               // CAknTitlePane
    7474#include <akncontext.h>             // CAknContextPane
    7575#include <eikspane.h>               // CEikStatusPane
    76 #include <aknpopupfader.h>          // MAknFadedComponent and TAknPopupFader
     76#include <AknPopupFader.h>          // MAknFadedComponent and TAknPopupFader
    7777#endif
    7878
     
    123123    int supportsPremultipliedAlpha : 1;
    124124    int avkonComponentsSupportTransparency : 1;
     125    int menuBeingConstructed : 1;
    125126    QApplication::QS60MainApplicationFactory s60ApplicationFactory; // typedef'ed pointer type
    126127    static inline void updateScreenSize();
     
    155156class QSymbianControl : public CCoeControl, public QAbstractLongTapObserver
    156157#ifdef Q_WS_S60
    157 , public MAknFadedComponent
     158, public MAknFadedComponent, public MEikStatusPaneObserver
    158159#endif
    159160{
     
    183184#ifdef Q_WS_S60
    184185    void FadeBehindPopup(bool fade){ popupFader.FadeBehindPopup( this, this, fade); }
     186    void HandleStatusPaneSizeChange();
    185187
    186188protected: // from MAknFadedComponent
     
    213215    void translateAdvancedPointerEvent(const TAdvancedPointerEvent *event);
    214216#endif
     217    void handleClientAreaChange();
    215218
    216219private:
  • trunk/src/gui/kernel/qt_x11_p.h

    r651 r769  
    676676        XWacomEraser,
    677677
     678        XTabletStylus,
     679        XTabletEraser,
     680
    678681        NPredefinedAtoms,
    679682
  • trunk/src/gui/kernel/qtooltip.cpp

    r651 r769  
    169169QTipLabel::QTipLabel(const QString &text, QWidget *w)
    170170#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)
    172172#else
    173     : QLabel(w, Qt::ToolTip), widget(0)
     173    : QLabel(w, Qt::ToolTip | Qt::BypassGraphicsProxyWidget), widget(0)
    174174#endif
    175175{
     
    369369
    370370#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));
    372381#else
    373382    QRect screen = QApplication::desktop()->screenGeometry(getTipScreen(pos, w));
  • trunk/src/gui/kernel/qwhatsthis.cpp

    r651 r769  
    144144*/
    145145
    146 extern void qDeleteInEventHandler(QObject *o);
     146Q_DECL_IMPORT extern void qDeleteInEventHandler(QObject *o);
    147147
    148148class QWhatsThat : public QWidget
  • trunk/src/gui/kernel/qwidget.cpp

    r677 r769  
    123123#include "private/qgesturemanager_p.h"
    124124
     125#ifdef QT_KEYPAD_NAVIGATION
     126#include "qtabwidget.h" // Needed in inTabWidget()
     127#endif // QT_KEYPAD_NAVIGATION
     128
    125129// widget/widget data creation count
    126130//#define QWIDGET_EXTRA_DEBUG
     
    197201      , isScrolled(0)
    198202      , isMoved(0)
     203      , isGLWidget(0)
    199204      , usesDoubleBufferedGLContext(0)
    200205#if defined(Q_WS_X11)
     
    207212#elif defined(Q_WS_MAC)
    208213      , needWindowChange(0)
    209       , isGLWidget(0)
    210214      , window_event(0)
    211215      , qd_hd(0)
     
    14461450#endif
    14471451
     1452#ifdef Q_OS_SYMBIAN
    14481453    if (d->extra && d->extra->topextra && d->extra->topextra->backingStore) {
    14491454        // Okay, we are about to destroy the top-level window that owns
     
    14551460        delete d->extra->topextra->backingStore;
    14561461        d->extra->topextra->backingStore = 0;
    1457     } else if (QWidgetBackingStore *bs = d->maybeBackingStore()) {
     1462    }
     1463#endif
     1464    if (QWidgetBackingStore *bs = d->maybeBackingStore()) {
    14581465        bs->removeDirtyWidget(this);
    14591466        if (testAttribute(Qt::WA_StaticContents))
     
    14871494        QWidgetPrivate::allWidgets->remove(this);
    14881495
    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    }
    14911502}
    14921503
     
    16761687        dirty = QRegion();
    16771688    } 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
    16781694        bs->sync();
     1695#endif
    16791696    }
    16801697}
     
    16841701    if (paintOnScreen())
    16851702        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
    16871709        bs->sync(q_func(), region);
     1710#endif
     1711    }
    16881712}
    16891713
     
    33683392    appear on screen. This also applies to windows.
    33693393
    3370     \sa pos, geometry, minimumSize, maximumSize, resizeEvent()
     3394    \sa pos, geometry, minimumSize, maximumSize, resizeEvent(), adjustSize()
    33713395*/
    33723396
     
    61106134            if (previousProxyFocus && previousProxyFocus->focusProxy())
    61116135                previousProxyFocus = previousProxyFocus->focusProxy();
     6136            if (previousProxyFocus == this && !topData->proxyWidget->d_func()->proxyIsGivingFocus)
     6137                return;
    61126138        }
    61136139    }
     
    75227548        if (!widget || widget->isWindow() || widget->testAttribute(Qt::WA_WState_Hidden))
    75237549            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
    75247567        if (spontaneous)
    75257568            widget->setAttribute(Qt::WA_Mapped, false);
     
    79167959    if(w && w->isWindow() && w->isVisible() && w->isEnabled()) {
    79177960        LONG dwStyle = GetWindowLong(w->winId(), GWL_STYLE);
     7961        LONG newStyle = dwStyle;
    79187962        if (setStyle)
    7919             dwStyle |= WS_DISABLED;
     7963            newStyle |= WS_DISABLED;
    79207964        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        }
    79257971    }
    79267972}
     
    82628308
    82638309#ifdef QT_SOFTKEYS_ENABLED
    8264         if (isWindow() && isActiveWindow())
     8310        if (isWindow())
    82658311            QSoftKeyManager::updateSoftKeys();
    82668312#endif
     
    1173111777    return targetWidget;
    1173211778}
     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*/
     11791bool 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
     11805to
     11806    interact with the value in the focussed widget, even though it currently has
     11807    not the editFocus.
     11808
     11809    \sa QWidget::hasEditFocus()
     11810*/
     11811bool 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}
    1173311818#endif
    1173411819
  • trunk/src/gui/kernel/qwidget_mac.mm

    r651 r769  
    153153QWidget *mac_mouse_grabber = 0;
    154154QWidget *mac_keyboard_grabber = 0;
     155extern QPointer<QWidget> qt_button_down; //qapplication_mac.cpp
    155156
    156157#ifndef QT_MAC_USE_COCOA
     
    563564    // below 'stays on top' windows. Add 1 to get above pure stay-on-top windows.
    564565    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
     570void 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
    565585}
    566586#endif
     
    848868                QApplication::sendSpontaneousEvent(widget, &e);
    849869            }
    850             extern QPointer<QWidget> qt_button_down; //qapplication_mac.cpp
    851870            qt_button_down = 0;
    852871        } else if(ekind == kEventWindowCollapsed) {
     
    876895            QEvent e(QEvent::Hide);
    877896            QApplication::sendSpontaneousEvent(widget, &e);
    878             extern QPointer<QWidget> qt_button_down; //qapplication_mac.cpp
    879897            qt_button_down = 0;
    880898        } else if(ekind == kEventWindowToolbarSwitchMode) {
     
    12501268                    if(widget->testAttribute(Qt::WA_WState_InPaintEvent))
    12511269                        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                    }
    12521275
    12531276                    QPoint redirectionOffset(0, 0);
     
    12991322                            widget->d_func()->restoreRedirected();
    13001323                    }
    1301 
    1302                     if (widget->isWindow() && !widget->d_func()->isOpaque
    1303                            && !widget->testAttribute(Qt::WA_MacBrushedMetal)) {
    1304                         QRect qrgnRect = qrgn.boundingRect();
    1305                         CGContextClearRect(cg, CGRectMake(qrgnRect.x(), qrgnRect.y(), qrgnRect.width(), qrgnRect.height()));
    1306                     }
    1307 
    13081324
    13091325                    if(!HIObjectIsOfClass((HIObjectRef)hiview, kObjectQWidget))
     
    15031519                qt_event_request_window_change(widget);
    15041520                if (!HIViewIsVisible(HIViewRef(widget->winId()))) {
    1505                     extern QPointer<QWidget> qt_button_down; //qapplication_mac.cpp
    15061521                    if (widget == qt_button_down)
    15071522                        qt_button_down = 0;
     
    15121527    case kEventClassMouse: {
    15131528        bool send_to_app = false;
    1514         extern QPointer<QWidget> qt_button_down; //qapplication_mac.cpp
    15151529        if(qt_button_down)
    15161530            send_to_app = true;
     
    33893403    if((q->windowType() == Qt::Desktop)) //you can't hide the desktop!
    33903404        return;
    3391 
    33923405    QMacCocoaAutoReleasePool pool;
    33933406    if(q->isWindow()) {
     
    35113524    if (!QWidget::mouseGrabber()){
    35123525        QWidget *enterWidget = QApplication::widgetAt(QCursor::pos());
     3526        if (enterWidget && enterWidget->data->in_destructor)
     3527            enterWidget = 0;
    35133528        QApplicationPrivate::dispatchEnterLeave(enterWidget, qt_mouseover);
    35143529        qt_mouseover = enterWidget;
     
    44554470    }
    44564471
     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
    44574485    NSSize deltaSize = NSMakeSize(dx, dy);
    4458     [view translateRectsNeedingDisplayInRect:scrollRect by:deltaSize];
    44594486    [view scrollRect:scrollRect by:deltaSize];
    44604487    [view setNeedsDisplayInRect:deltaXRect];
     
    46564683        return;
    46574684
    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        }
    46604689        extra->maskBits.fill(QColor(Qt::color1).rgba());
    46614690        extra->maskBits.setNumColors(2);
  • trunk/src/gui/kernel/qwidget_p.h

    r705 r769  
    242242
    243243    /**
     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    /**
    244253     * Defines the behaviour of QSymbianControl::Draw.
    245254     */
     
    266275    };
    267276
    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;
    278278
    279279#elif defined(Q_WS_PM) // <----------------------------------------------------- PM
     
    483483    static bool navigateToDirection(Direction direction);
    484484    static QWidget *widgetInNavigationDirection(Direction direction);
     485    static bool canKeypadNavigate(Qt::Orientation orientation);
     486    static bool inTabWidget(QWidget *widget);
    485487#endif
    486488
     
    694696    uint isScrolled : 1;
    695697    uint isMoved : 1;
     698    uint isGLWidget : 1;
    696699    uint usesDoubleBufferedGLContext : 1;
    697700
     
    734737    // This is new stuff
    735738    uint needWindowChange : 1;
    736     uint isGLWidget : 1;
    737739
    738740    // Each wiget keeps a list of all its child and grandchild OpenGL widgets.
  • trunk/src/gui/kernel/qwidget_s60.cpp

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

    r651 r769  
    20532053        return;
    20542054
     2055    if (!QApplicationPrivate::HasTouchSupport)
     2056        return;
    20552057    QApplicationPrivate *qAppPriv = QApplicationPrivate::instance();
    20562058    if (!qAppPriv->SetGestureConfig)
  • trunk/src/gui/kernel/qwidget_x11.cpp

    r651 r769  
    347347}
    348348
    349 static Bool checkForConfigureAndExpose(Display *, XEvent *e, XPointer)
    350 {
    351     return e->type == ConfigureNotify || e->type == Expose;
    352 }
    353 
    354349Q_GUI_EXPORT void qt_x11_wait_for_window_manager(QWidget* w)
    355350{
     
    364359        return;
    365360
    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        }
    377394        if (t.elapsed() > maximumWaitTime)
    378395            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);
    398397}
    399398
  • trunk/src/gui/kernel/qwinnativepangesturerecognizer_win_p.h

    r651 r769  
    5555
    5656#include <QGestureRecognizer>
     57#include <objbase.h>
     58
     59class IInkRectangle;
     60class TabletHardwareCapabilities;
     61class TabletPropertyMetricUnit;
     62DECLARE_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};
     71enum TabletDeviceKind
     72{
     73        TDK_Mouse = 0,
     74        TDK_Pen   = 1,
     75        TDK_Touch = 2
     76};
     77DECLARE_INTERFACE_(IInkTablet2, IDispatch)
     78{
     79        STDMETHOD(get_DeviceKind)(THIS_ TabletDeviceKind *Kind) PURE;
     80};
     81DECLARE_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};
    5789
    5890QT_BEGIN_NAMESPACE
Note: See TracChangeset for help on using the changeset viewer.