Ignore:
Timestamp:
Feb 11, 2010, 11:19:06 PM (15 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.6.1 sources.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

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

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the QtGui module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    4949#include <private/qkeymapper_p.h>
    5050#include <private/qapplication_p.h>
     51#include <private/qmacinputcontext_p.h>
    5152
    5253QT_BEGIN_NAMESPACE
     
    161162        }
    162163    }
     164    if (qApp->testAttribute(Qt::AA_MacDontSwapCtrlAndMeta)) {
     165        Qt::KeyboardModifiers oldModifiers = ret;
     166        ret &= ~(Qt::MetaModifier | Qt::ControlModifier);
     167        if (oldModifiers & Qt::ControlModifier)
     168            ret |= Qt::MetaModifier;
     169        if (oldModifiers & Qt::MetaModifier)
     170            ret |= Qt::ControlModifier;
     171    }
    163172    return ret;
    164173}
     
    176185            ret |= qt_mac_modifier_symbols[i].mac_code;
    177186        }
     187    }
     188
     189    if (qApp->testAttribute(Qt::AA_MacDontSwapCtrlAndMeta)) {
     190        int oldModifiers = ret;
     191        ret &= ~(controlKeyBit | cmdKeyBit);
     192        if (oldModifiers & controlKeyBit)
     193            ret |= cmdKeyBit;
     194        if (oldModifiers & cmdKeyBit)
     195            ret |= controlKeyBit;
    178196    }
    179197    return ret;
     
    481499            if (outHandled) {
    482500                qt_mac_eat_unicode_key = false;
    483                 CallNextEventHandler(er, keyEvent);
     501                if (er)
     502                    CallNextEventHandler(er, keyEvent);
    484503                *outHandled = qt_mac_eat_unicode_key;
    485504            }
     
    545564QKeyMapperPrivate::~QKeyMapperPrivate()
    546565{
    547     clearMappings();
     566    deleteLayouts();
    548567}
    549568
     
    640659
    641660void
    642 QKeyMapperPrivate::clearMappings()
     661QKeyMapperPrivate::deleteLayouts()
    643662{
    644663    keyboard_mode = NullMode;
     
    649668        }
    650669    }
     670}
     671
     672void
     673QKeyMapperPrivate::clearMappings()
     674{
     675    deleteLayouts();
    651676    updateKeyboard();
    652677}
     
    693718    }
    694719
    695     if (qApp->inputContext() && qApp->inputContext()->isComposing())
     720    if (qApp->inputContext() && qApp->inputContext()->isComposing()) {
     721        if (ekind == kEventRawKeyDown) {
     722            QMacInputContext *context = qobject_cast<QMacInputContext*>(qApp->inputContext());
     723            if (context)
     724                context->setLastKeydownEvent(event);
     725        }
    696726        return false;
     727    }
    697728    //get modifiers
    698729    Qt::KeyboardModifiers modifiers;
     
    705736    /* This is actually wrong - but unfortunatly it is the best that can be
    706737       done for now because of the Control/Meta mapping problems */
    707     if (modifiers & (Qt::ControlModifier | Qt::MetaModifier))
     738    if (modifiers & (Qt::ControlModifier | Qt::MetaModifier)
     739        && !qApp->testAttribute(Qt::AA_MacDontSwapCtrlAndMeta)) {
    708740        text = QString();
     741    }
    709742
    710743
     
    722755            //with a QKeyEvent.
    723756            qt_mac_eat_unicode_key = false;
    724             CallNextEventHandler(er, event);   
     757            if (er)
     758                CallNextEventHandler(er, event);
    725759            extern bool qt_mac_menubar_is_open();   
    726760            if (qt_mac_eat_unicode_key || qt_mac_menubar_is_open()) {
Note: See TracChangeset for help on using the changeset viewer.