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

trunk: Merged in qt 4.6.1 sources.

Location:
trunk
Files:
16 edited
3 copied

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/gui/inputmethod/inputmethod.pri

    r2 r561  
    2424    SOURCES += inputmethod/qmacinputcontext_mac.cpp
    2525}
     26
     27
     28
     29
     30
    2631
  • trunk/src/gui/inputmethod/qinputcontext.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information ([email protected])
     4** All rights reserved.
     5** Contact: Nokia Corporation ([email protected])
    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
     37** @nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    7979    \ingroup i18n
    8080
    81     An input method is responsible to input complex text that cannot
     81    An input method is responsible complex text that cannot
    8282    be inputted via simple keymap. It converts a sequence of input
    8383    events (typically key events) into a text string through the input
     
    9090    information, Qt offers the QInputContext as base class. The
    9191    concept is well known as 'input context' in the input method
    92     domain. an input context is created for a text widget in response
     92    domain. n input context is created for a text widget in response
    9393    to a demand. It is ensured that an input context is prepared for
    9494    an input method before input to a text widget.
    9595
    96     Multiple input contexts that is belonging to a single input method
     96    Multiple input contexts that ng to a single input method
    9797    may concurrently coexist. Suppose multi-window text editor. Each
    9898    text widget of window A and B holds different QInputContext
     
    106106
    107107    \row \o Receiving information \o
    108         x11FilterEvent(),
    109         filterEvent(),
    110         mouseHandler()
     108x11FilterEvent(),
     109filterEvent(),
     110mouseHandler()
    111111
    112112    \row \o Sending back composed text \o
    113         sendEvent()
     113sendEvent()
    114114
    115115    \row \o State change notification \o
    116         setFocusWidget(),
    117         reset()
     116setFocusWidget(),
     117reset()
    118118
    119119    \row \o Context information \o
    120         identifierName(),
    121         language(),
    122         font(),
    123         isComposing()
     120identifierName(),
     121language(),
     122font(),
     123isComposing()
    124124
    125125    \endtable
     126
     127
    126128
    127129    \legalese
     
    155157
    156158/*!
    157     \internal
    158159    Returns the widget that has an input focus for this input
    159     context. Ordinary input methods should not call this function
    160     directly to keep platform independence and flexible configuration
    161     possibility.
     160    context.
    162161
    163162    The return value may differ from holderWidget() if the input
    164163    context is shared between several text widgets.
    165164
    166     \sa setFocusWidget(), holderWidget()
     165    \warning To ensure platform independence and support flexible
     166    configuration of widgets, ordinary input methods should not call
     167    this function directly.
     168
     169    \sa setFocusWidget()
    167170*/
    168171QWidget *QInputContext::focusWidget() const
     
    174177
    175178/*!
    176     \internal
    177     Sets the widget that has an input focus for this input
    178     context. Ordinary input methods must not call this function
     179   
     180
     181    Ordinary input methods must not call this function
    179182    directly.
    180183
     
    210213    methods, leave it untouched.
    211214
    212     \a event is currently restricted to QKeyEvent. But some input
    213     method related events such as QWheelEvent or QTabletEvent may be
    214     added in future.
     215    \a event is currently restricted to events of these types:
     216
     217    \list
     218        \i CloseSoftwareInputPanel
     219        \i KeyPress
     220        \i KeyRelease
     221        \i MouseButtonDblClick
     222        \i MouseButtonPress
     223        \i MouseButtonRelease
     224        \i MouseMove
     225        \i RequestSoftwareInputPanel
     226    \endlist
     227
     228    But some input method related events such as QWheelEvent or
     229    QTabletEvent may be added in future.
    215230
    216231    The filtering opportunity is always given to the input context as
     
    263278
    264279    QInputMethodEvent e(event);
    265     qApp->sendEvent(focus, &e);
     280    sendEvent(focus, &e);
    266281}
    267282
     
    281296    widget. The event type is QEvent::MouseButtonPress,
    282297    QEvent::MouseButtonRelease, QEvent::MouseButtonDblClick or
    283     QEvent::MouseButtonMove. The event's button and state indicate
     298    QEvent::MouseMove. The event's button and state indicate
    284299    the kind of operation that was performed.
    285300*/
     
    409424{
    410425    QWidget *focus = focusWidget();
    411     const QPalette &pal = focus ? focus->palette() : qApp->palette();
     426    const QPalette &pal = focus ? focus->palette() : palette();
    412427
    413428    QTextCharFormat fmt;
     
    416431    case QInputContext::PreeditFormat: {
    417432        fmt.setUnderlineStyle(QTextCharFormat::DashUnderline);
    418 #ifndef Q_WS_WIN
    419         int h1, s1, v1, h2, s2, v2;
    420         pal.color(QPalette::Base).getHsv(&h1, &s1, &v1);
    421         pal.color(QPalette::Background).getHsv(&h2, &s2, &v2);
    422         bg.setHsv(h1, s1, (v1 + v2) / 2);
    423         fmt.setBackground(QBrush(bg));
    424 #endif
    425433        break;
    426434    }
     
    460468#endif // Q_WS_X11
    461469
     470
     471
     472
     473
     474
     475
     476
     477
     478
     479
     480
     481
     482
     483
     484
     485
     486
     487
     488
     489
     490
     491
     492
     493
     494
     495
     496
    462497QT_END_NAMESPACE
    463498
  • trunk/src/gui/inputmethod/qinputcontext.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information ([email protected])
     4** All rights reserved.
     5** Contact: Nokia Corporation ([email protected])
    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
     37** @nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    7676class QPopupMenu;
    7777class QInputContextPrivate;
    78 
     78#ifdef Q_OS_SYMBIAN
     79class QSymbianEvent;
     80#endif
    7981
    8082class Q_GUI_EXPORT QInputContext : public QObject
     
    106108    virtual bool x11FilterEvent( QWidget *keywidget, XEvent *event );
    107109#endif // Q_WS_X11
     110
     111
     112
    108113    virtual bool filterEvent( const QEvent *event );
    109114
  • trunk/src/gui/inputmethod/qinputcontext_p.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information ([email protected])
     4** All rights reserved.
     5** Contact: Nokia Corporation ([email protected])
    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
     37** @nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    8585
    8686    QWidget *focusWidget;
    87 
    88 #if defined(Q_WS_WIN) || defined(Q_WS_QWS)
    89     static void updateImeStatus(QWidget *w, bool hasFocus);
    90 #endif
    9187};
    9288
  • trunk/src/gui/inputmethod/qinputcontextfactory.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information ([email protected])
     4** All rights reserved.
     5** Contact: Nokia Corporation ([email protected])
    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
     37** @nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    7272#include "qmacinputcontext_p.h"
    7373#endif
     74
     75
     76
    7477
    7578#include "private/qfactoryloader_p.h"
     
    8790    \brief The QInputContextFactory class creates QInputContext objects.
    8891
    89     \ingroup appearance
    9092
    9193    The input context factory creates a QInputContext object for a
     
    146148    }
    147149#endif
     150
     151
     152
     153
     154
    148155#if defined(QT_NO_LIBRARY) || defined(QT_NO_SETTINGS)
    149156    Q_UNUSED(key);
     
    183190    result << QLatin1String("mac");
    184191#endif
     192
     193
     194
    185195#if !defined(QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS)
    186196    result += loader()->keys();
     
    216226#if defined(Q_WS_MAC)
    217227    if (key == QLatin1String("mac"))
     228
     229
     230
     231
    218232        return QStringList(QString());
    219233#endif
     
    242256        return QInputContext::tr( "XIM" );
    243257#endif
     258
     259
     260
     261
    244262#if defined(QT_NO_LIBRARY) || defined(QT_NO_SETTINGS)
    245263    Q_UNUSED(key);
     
    273291        return QInputContext::tr( "Mac OS X input method" );
    274292#endif
     293
     294
     295
     296
    275297#if defined(QT_NO_LIBRARY) || defined(QT_NO_SETTINGS)
    276298    Q_UNUSED(key);
  • trunk/src/gui/inputmethod/qinputcontextfactory.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information ([email protected])
     4** All rights reserved.
     5** Contact: Nokia Corporation ([email protected])
    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
     37** @nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/src/gui/inputmethod/qinputcontextplugin.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information ([email protected])
     4** All rights reserved.
     5** Contact: Nokia Corporation ([email protected])
    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
     37** @nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/src/gui/inputmethod/qinputcontextplugin.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information ([email protected])
     4** All rights reserved.
     5** Contact: Nokia Corporation ([email protected])
    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
     37** @nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    6767QT_MODULE(Gui)
    6868
    69 #if !defined(QT_NO_IM) && !defined(QT_NO_LIBRARY)
     69#if !defined(QT_NO_IM)
    7070
    7171class QInputContext;
  • trunk/src/gui/inputmethod/qmacinputcontext_mac.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information ([email protected])
     4** All rights reserved.
     5** Contact: Nokia Corporation ([email protected])
    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
     37** @nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    4646#include <qdebug.h>
    4747#include <private/qapplication_p.h>
     48
    4849
    4950QT_BEGIN_NAMESPACE
     
    5657#endif
    5758
    58 static QTextFormat qt_mac_compose_format()
    59 {
    60     QTextCharFormat ret;
    61     ret.setFontUnderline(true);
    62     return ret;
    63 }
    64 
    6559QMacInputContext::QMacInputContext(QObject *parent)
    66     : QInputContext(parent), composing(false), recursionGuard(false), textDocument(0)
     60    : QInputContext(parent), composing(false), recursionGuard(false), textDocument(0),
     61      keydownEvent(0)
    6762{
    6863//    createTextDocument();
     
    7166QMacInputContext::~QMacInputContext()
    7267{
    73 #ifdef Q_WS_MAC32
     68#if
    7469    if(textDocument)
    7570        DeleteTSMDocument(textDocument);
     
    8075QMacInputContext::createTextDocument()
    8176{
    82 #ifdef Q_WS_MAC32
     77#if
    8378    if(!textDocument) {
    8479        InterfaceTypeList itl = { kUnicodeDocument };
     
    9792void QMacInputContext::mouseHandler(int pos, QMouseEvent *e)
    9893{
    99 #ifdef Q_WS_MAC32
     94#if
    10095    if(e->type() != QEvent::MouseButtonPress)
    10196        return;
     
    106101        reset();
    107102    // ##### handle mouse position
     103
     104
     105
    108106#endif
    109107}
    110108
    111109#if !defined QT_MAC_USE_COCOA
     110
     111
     112
     113
     114
     115
     116
    112117
    113118void QMacInputContext::reset()
     
    133138    return composing;
    134139}
    135 #endif 
     140#endif
    136141
    137142void QMacInputContext::setFocusWidget(QWidget *w)
    138143{
    139144    createTextDocument();
    140 #ifdef Q_WS_MAC32
     145#if
    141146    if(w)
    142147        ActivateTSMDocument(textDocument);
     
    148153
    149154
     155
    150156static EventTypeSpec input_events[] = {
    151157    { kEventClassTextInput, kEventTextInputUnicodeForKeyEvent },
     
    155161static EventHandlerUPP input_proc_handlerUPP = 0;
    156162static EventHandlerRef input_proc_handler = 0;
     163
    157164
    158165void
    159166QMacInputContext::initialize()
    160167{
    161 #ifdef Q_WS_MAC32
     168#if
    162169    if(!input_proc_handler) {
    163170        input_proc_handlerUPP = NewEventHandlerUPP(QMacInputContext::globalEventProcessor);
     
    172179QMacInputContext::cleanup()
    173180{
    174 #ifdef Q_WS_MAC32
     181#if
    175182    if(input_proc_handler) {
    176183        RemoveEventHandler(input_proc_handler);
     
    184191}
    185192
     193
     194
     195
     196
     197
     198
     199
     200
     201
     202
    186203OSStatus
    187204QMacInputContext::globalEventProcessor(EventHandlerCallRef, EventRef event, void *)
    188205{
    189 #ifdef Q_WS_MAC32
     206#if
    190207    QScopedLoopLevelCounter loopLevelCounter(QApplicationPrivate::instance()->threadData);
    191208
     
    201218        handled_event = false;
    202219        QWidget *widget = QApplicationPrivate::focus_widget;
    203         if(!widget || (context && widget->inputContext() != context)) {
     220        bool canCompose = widget && (!context || widget->inputContext() == context)
     221                && !(widget->inputMethodHints() & Qt::ImhDigitsOnly
     222                || widget->inputMethodHints() & Qt::ImhFormattedNumbersOnly
     223                || widget->inputMethodHints() & Qt::ImhHiddenText);
     224        if(!canCompose) {
    204225            handled_event = false;
    205226        } else if(ekind == kEventTextInputOffsetToPos) {
     
    336357            if(!chr || chr >= 128 || (text.length() > 0 && (text.length() > 1 || text.at(0) != QLatin1Char(chr))))
    337358                handled_event = !widget->testAttribute(Qt::WA_InputMethodEnabled);
     359
     360
     361
     362
     363
     364
    338365        }
    339366        break; }
     
    343370    if(!handled_event) //let the event go through
    344371        return eventNotHandledErr;
     372
     373
    345374#endif
    346375    return noErr; //we eat the event
  • trunk/src/gui/inputmethod/qmacinputcontext_p.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information ([email protected])
     4** All rights reserved.
     5** Contact: Nokia Corporation ([email protected])
    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
     37** @nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    7979    static void initialize();
    8080    static void cleanup();
     81
     82
     83
     84
    8185protected:
    8286    void mouseHandler(int pos, QMouseEvent *);
     
    8690    TSMDocumentID textDocument;
    8791    QString currentText;
     92
    8893};
    8994
  • trunk/src/gui/inputmethod/qwininputcontext_p.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information ([email protected])
     4** All rights reserved.
     5** Contact: Nokia Corporation ([email protected])
    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
     37** @nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    5656#include "QtGui/qinputcontext.h"
    5757#include "QtCore/qt_windows.h"
     58
     59
     60
     61
     62
     63
     64
     65
     66
     67
     68
     69
     70
    5871
    5972QT_BEGIN_NAMESPACE
     
    8093    bool endComposition();
    8194    bool composition(LPARAM lparam);
     95
    8296
    8397    static void TranslateMessage(const MSG *msg);
    8498    static LRESULT DefWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
    8599
     100
    86101    static void enablePopupChild(QWidget *w, bool e);
    87102    static void enable(QWidget *w, bool e);
  • trunk/src/gui/inputmethod/qwininputcontext_win.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information ([email protected])
     4** All rights reserved.
     5** Contact: Nokia Corporation ([email protected])
    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
     37** @nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    4646#include "qwidget.h"
    4747#include "qapplication.h"
    48 #include "qlibrary.h"
    4948#include "qevent.h"
    5049#include "qtextformat.h"
     50
    5151
    5252//#define Q_IME_DEBUG
    53 
    54 /* Active Input method support on Win95/98/NT */
    55 #include <objbase.h>
    56 #include <initguid.h>
    5753
    5854#ifdef Q_IME_DEBUG
     
    6056#endif
    6157
    62 #if defined(Q_OS_WINCE)
     58#if defined(Q_S_WINCE)
    6359extern void qt_wince_show_SIP(bool show);   // defined in qguifunctions_wince.cpp
    6460#endif
     
    219215    : QInputContext(parent), recursionGuard(false)
    220216{
    221     if (QSysInfo::WindowsVersion < QSysInfo::WV_2000) {
    222         // try to get the Active IMM COM object on Win95/98/NT, where english versions don't
    223         // support the regular Windows input methods.
    224         if (CoCreateInstance(CLSID_CActiveIMM, NULL, CLSCTX_INPROC_SERVER,
    225             IID_IActiveIMMApp, (LPVOID *)&aimm) != S_OK) {
    226             aimm = 0;
    227         }
    228         if (aimm && (aimm->QueryInterface(IID_IActiveIMMMessagePumpOwner, (LPVOID *)&aimmpump) != S_OK ||
    229                         aimm->Activate(true) != S_OK)) {
    230             aimm->Release();
    231             aimm = 0;
    232             if (aimmpump)
    233                 aimmpump->Release();
    234             aimmpump = 0;
    235         }
    236         if (aimmpump)
    237             aimmpump->Start();
    238     }
    239 
    240 #ifndef Q_OS_WINCE
     217#ifndef Q_WS_WINCE
    241218    QSysInfo::WinVersion ver = QSysInfo::windowsVersion();
    242219    if (ver & QSysInfo::WV_NT_based  && ver >= QSysInfo::WV_VISTA) {
     
    263240        }
    264241    } else {
    265             // figure out whether a RTL language is installed
    266         typedef BOOL(WINAPI *PtrIsValidLanguageGroup)(DWORD,DWORD);
    267         PtrIsValidLanguageGroup isValidLanguageGroup = (PtrIsValidLanguageGroup)QLibrary::resolve(QLatin1String("kernel32"), "IsValidLanguageGroup");
    268         if (isValidLanguageGroup) {
    269                 qt_use_rtl_extensions = isValidLanguageGroup(LGRPID_ARABIC, LGRPID_INSTALLED)
    270                                          || isValidLanguageGroup(LGRPID_HEBREW, LGRPID_INSTALLED);
    271         }
    272         qt_use_rtl_extensions |= IsValidLocale(MAKELCID(MAKELANGID(LANG_ARABIC, SUBLANG_DEFAULT), SORT_DEFAULT), LCID_INSTALLED)
    273                                   || IsValidLocale(MAKELCID(MAKELANGID(LANG_HEBREW, SUBLANG_DEFAULT), SORT_DEFAULT), LCID_INSTALLED)
     242        // figure out whether a RTL language is installed
     243        qt_use_rtl_extensions = IsValidLanguageGroup(LGRPID_ARABIC, LGRPID_INSTALLED)
     244                                || IsValidLanguageGroup(LGRPID_HEBREW, LGRPID_INSTALLED)
     245                                || IsValidLocale(MAKELCID(MAKELANGID(LANG_ARABIC, SUBLANG_DEFAULT), SORT_DEFAULT), LCID_INSTALLED)
     246                                || IsValidLocale(MAKELCID(MAKELANGID(LANG_HEBREW, SUBLANG_DEFAULT), SORT_DEFAULT), LCID_INSTALLED)
    274247#ifdef LANG_SYRIAC
    275                               || IsValidLocale(MAKELCID(MAKELANGID(LANG_SYRIAC, SUBLANG_DEFAULT), SORT_DEFAULT), LCID_INSTALLED)
    276 #endif
    277                                   || IsValidLocale(MAKELCID(MAKELANGID(LANG_FARSI, SUBLANG_DEFAULT), SORT_DEFAULT), LCID_INSTALLED);
     248                          || IsValidLocale(MAKELCID(MAKELANGID(LANG_SYRIAC, SUBLANG_DEFAULT), SORT_DEFAULT), LCID_INSTALLED)
     249#endif
     250                          || IsValidLocale(MAKELCID(MAKELANGID(LANG_FARSI, SUBLANG_DEFAULT), SORT_DEFAULT), LCID_INSTALLED);
    278251    }
    279252#else
     
    281254#endif
    282255
    283     WM_MSIME_MOUSE = QT_WA_INLINE(RegisterWindowMessage(L"MSIMEMouseOperation"), RegisterWindowMessageA("MSIMEMouseOperation"));
     256    WM_MSIME_MOUSE = );
    284257}
    285258
     
    338311}
    339312
    340 static LONG getCompositionString(HIMC himc, DWORD dwIndex, LPVOID lpbuf, DWORD dBufLen, bool *unicode = 0)
     313static LONG getCompositionString(HIMC himc, DWORD dwIndex, LPVOID lpbuf, DWORD dBufLen)
    341314{
    342315    LONG len = 0;
    343     if (unicode)
    344         *unicode = true;
    345316    if (aimm)
    346317        aimm->GetCompositionStringW(himc, dwIndex, dBufLen, &len, lpbuf);
    347318    else
    348     {
    349         if(QSysInfo::WindowsVersion != QSysInfo::WV_95) {
    350             len = ImmGetCompositionStringW(himc, dwIndex, lpbuf, dBufLen);
    351         }
    352 #if !defined(Q_OS_WINCE)
    353         else {
    354             len = ImmGetCompositionStringA(himc, dwIndex, lpbuf, dBufLen);
    355             if (unicode)
    356                 *unicode = false;
    357         }
    358 #endif
    359     }
     319        len = ImmGetCompositionString(himc, dwIndex, lpbuf, dBufLen);
    360320    return len;
    361321}
     
    368328static QString getString(HIMC himc, DWORD dwindex, int *selStart = 0, int *selLength = 0)
    369329{
    370     static char *buffer = 0;
    371     static int buflen = 0;
    372 
    373     int len = getCompositionString(himc, dwindex, 0, 0) + 1;
    374     if (!buffer || len > buflen) {
    375         delete [] buffer;
    376         buflen = qMin(len, 256);
    377         buffer = new char[buflen];
    378     }
    379 
    380     bool unicode = true;
    381     len = getCompositionString(himc, dwindex, buffer, buflen, &unicode);
     330    const int bufferSize = 256;
     331    wchar_t buffer[bufferSize];
     332    int len = getCompositionString(himc, dwindex, buffer, bufferSize * sizeof(wchar_t));
    382333
    383334    if (selStart) {
    384         static char *attrbuffer = 0;
    385         static int attrbuflen = 0;
    386         int attrlen = getCompositionString(himc, dwindex, 0, 0) + 1;
    387         if (!attrbuffer || attrlen> attrbuflen) {
    388             delete [] attrbuffer;
    389             attrbuflen = qMin(attrlen, 256);
    390             attrbuffer = new char[attrbuflen];
    391         }
    392         attrlen = getCompositionString(himc, GCS_COMPATTR, attrbuffer, attrbuflen);
     335        char attrbuffer[bufferSize];
     336        int attrlen = getCompositionString(himc, GCS_COMPATTR, attrbuffer, bufferSize);
    393337        *selStart = attrlen+1;
    394338        *selLength = -1;
     
    404348    if (len <= 0)
    405349        return QString();
    406     if (unicode) {
    407         return QString((QChar *)buffer, len/sizeof(QChar));
    408     }
    409     else {
    410         buffer[len] = 0;
    411         WCHAR *wc = new WCHAR[len+1];
    412         int l = MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED,
    413             buffer, len, wc, len+1);
    414         QString res = QString((QChar *)wc, l);
    415         delete [] wc;
    416         return res;
    417     }
     350
     351    return QString((QChar*)buffer, len / sizeof(QChar));
    418352}
    419353
     
    429363    if (!aimm || aimm->OnDefWindowProc(hwnd, msg, wParam, lParam, &retval) != S_OK)
    430364    {
    431         QT_WA({
    432             retval = ::DefWindowProc(hwnd, msg, wParam, lParam);
    433         } , {
    434             retval = ::DefWindowProcA(hwnd,msg, wParam, lParam);
    435         });
     365        retval = ::DefWindowProc(hwnd, msg, wParam, lParam);
    436366    }
    437367    return retval;
     
    455385    hf = f.handle();
    456386
    457     QT_WA({
    458         LOGFONT lf;
    459         if (GetObject(hf, sizeof(lf), &lf))
    460             if (aimm)
    461                 aimm->SetCompositionFontW(imc, &lf);
    462             else
    463                 ImmSetCompositionFont(imc, &lf);
    464     } , {
    465         LOGFONTA lf;
    466         if (GetObjectA(hf, sizeof(lf), &lf))
    467             if (aimm)
    468                 aimm->SetCompositionFontA(imc, &lf);
    469             else
    470                 ImmSetCompositionFontA(imc, &lf);
    471     });
     387    LOGFONT lf;
     388    if (GetObject(hf, sizeof(lf), &lf)) {
     389        if (aimm)
     390            aimm->SetCompositionFontW(imc, &lf);
     391        else
     392            ImmSetCompositionFont(imc, &lf);
     393    }
    472394
    473395    QRect r = w->inputMethodQuery(Qt::ImMicroFocus).toRect();
     
    540462
    541463    if (!fw)
    542         fw = qApp->focusWidget();
     464        fw = focusWidget();
    543465
    544466    if (fw) {
     
    638560        return true;
    639561
    640     QWidget *fw = qApp->focusWidget();
     562    QWidget *fw = focusWidget();
    641563    if (fw) {
    642564        Q_ASSERT(fw->testAttribute(Qt::WA_WState_Created));
     
    739661        if (defaultContext)
    740662            ImmAssociateContext(w->effectiveWinId(), defaultContext);
    741 #ifdef Q_OS_WINCE
     663#ifdef Q_S_WINCE
    742664        if (qApp->autoSipEnabled())
    743665            qt_wince_show_SIP(true);
     
    748670        if (!defaultContext)
    749671            defaultContext = oldimc;
    750 #ifdef Q_OS_WINCE
     672#ifdef Q_S_WINCE
    751673        if (qApp->autoSipEnabled())
    752674            qt_wince_show_SIP(false);
     
    756678
    757679
    758 void QInputContextPrivate::updateImeStatus(QWidget *w, bool hasFocus)
     680void Q::updateImeStatus(QWidget *w, bool hasFocus)
    759681{
    760682    if (!w)
    761683        return;
    762     bool e = w->testAttribute(Qt::WA_InputMethodEnabled) && w->isEnabled();
     684    // It's always the proxy that carries the hints.
     685    QWidget *focusProxyWidget = w->focusProxy();
     686    if (!focusProxyWidget)
     687        focusProxyWidget = w;
     688    bool e = w->testAttribute(Qt::WA_InputMethodEnabled) && w->isEnabled()
     689            && !(focusProxyWidget->inputMethodHints() & (Qt::ImhExclusiveInputMask | Qt::ImhHiddenText));
    763690    bool hasIme = e && hasFocus;
    764691#ifdef Q_IME_DEBUG
     
    825752void QWinInputContext::setFocusWidget(QWidget *w)
    826753{
     754
     755
     756
     757
     758
     759
     760
     761
     762
    827763    QInputContext::setFocusWidget(w);
    828764    update();
     
    861797}
    862798
     799
     800
     801
     802
     803
     804
     805
     806
     807
     808
     809
     810
     811
     812
     813
     814
     815
     816
     817
     818
     819
     820
     821
     822
     823
     824
     825
     826
     827
     828
     829
     830
     831
     832
     833
     834
     835
     836
     837
     838
     839
     840
     841
     842
     843
     844
     845
     846
    863847QT_END_NAMESPACE
  • trunk/src/gui/inputmethod/qwsinputcontext_p.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information ([email protected])
     4** All rights reserved.
     5** Contact: Nokia Corporation ([email protected])
    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
     37** @nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    8888    static bool translateIMQueryEvent(QWidget *w, const QWSIMQueryEvent *e);
    8989    static bool translateIMInitEvent(const QWSIMInitEvent *e);
     90
    9091};
    9192
  • trunk/src/gui/inputmethod/qximinputcontext_p.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information ([email protected])
     4** All rights reserved.
     5** Contact: Nokia Corporation ([email protected])
    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
     37** @nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/src/gui/inputmethod/qximinputcontext_x11.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information ([email protected])
     4** All rights reserved.
     5** Contact: Nokia Corporation ([email protected])
    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
     37** @nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    5454****************************************************************************/
    5555
     56
    5657#include "qdebug.h"
    5758#include "qximinputcontext_p.h"
     
    439440                // requiring the user to manually switch focus.
    440441                if (focusWidget->testAttribute(Qt::WA_InputMethodEnabled)
    441                     && focusWidget->testAttribute(Qt::WA_WState_Created))
     442                    && focusWidget->testAttribute(Qt::WA_WState_Created)
     443                    && focusWidget->isEnabled())
    442444                    setFocusWidget(focusWidget);
    443445            }
     
    611613    QInputContext::setFocusWidget(w);
    612614
    613     if (!w)
     615    if (!w)
    614616        return;
    615617
Note: See TracChangeset for help on using the changeset viewer.