summaryrefslogtreecommitdiffstats
path: root/src/gui/inputmethod
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2009-06-23 13:12:29 (GMT)
committerSimon Hausmann <simon.hausmann@nokia.com>2009-06-23 13:12:29 (GMT)
commitd9cd51f412cf84ec9cd929e5d35c995b8904b49d (patch)
tree96a346dca9eb703127bccea469aa5cd679e958ef /src/gui/inputmethod
parent0ba6a795f786dc19486551fed2344f394b144a08 (diff)
parent5138c39116a03e36005a03f47f718fced6cc6d4e (diff)
downloadQt-d9cd51f412cf84ec9cd929e5d35c995b8904b49d.zip
Qt-d9cd51f412cf84ec9cd929e5d35c995b8904b49d.tar.gz
Qt-d9cd51f412cf84ec9cd929e5d35c995b8904b49d.tar.bz2
Merge branch '4.5' of scm.dev.nokia.troll.no:qt/qt
Conflicts: src/3rdparty/webkit/VERSION src/3rdparty/webkit/WebCore/ChangeLog src/3rdparty/webkit/WebKit/qt/ChangeLog tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
Diffstat (limited to 'src/gui/inputmethod')
-rw-r--r--src/gui/inputmethod/qmacinputcontext_mac.cpp37
1 files changed, 22 insertions, 15 deletions
diff --git a/src/gui/inputmethod/qmacinputcontext_mac.cpp b/src/gui/inputmethod/qmacinputcontext_mac.cpp
index 9fce64c..2e9ee08 100644
--- a/src/gui/inputmethod/qmacinputcontext_mac.cpp
+++ b/src/gui/inputmethod/qmacinputcontext_mac.cpp
@@ -56,13 +56,6 @@ extern bool qt_sendSpontaneousEvent(QObject*, QEvent*);
# define typeByteCount typeSInt32
#endif
-static QTextFormat qt_mac_compose_format()
-{
- QTextCharFormat ret;
- ret.setFontUnderline(true);
- return ret;
-}
-
QMacInputContext::QMacInputContext(QObject *parent)
: QInputContext(parent), composing(false), recursionGuard(false), textDocument(0),
keydownEvent(0)
@@ -72,7 +65,7 @@ QMacInputContext::QMacInputContext(QObject *parent)
QMacInputContext::~QMacInputContext()
{
-#ifdef Q_WS_MAC32
+#ifndef QT_MAC_USE_COCOA
if(textDocument)
DeleteTSMDocument(textDocument);
#endif
@@ -81,7 +74,7 @@ QMacInputContext::~QMacInputContext()
void
QMacInputContext::createTextDocument()
{
-#ifdef Q_WS_MAC32
+#ifndef QT_MAC_USE_COCOA
if(!textDocument) {
InterfaceTypeList itl = { kUnicodeDocument };
NewTSMDocument(1, itl, &textDocument, SRefCon(this));
@@ -98,7 +91,7 @@ QString QMacInputContext::language()
void QMacInputContext::mouseHandler(int pos, QMouseEvent *e)
{
-#ifdef Q_WS_MAC32
+#ifndef QT_MAC_USE_COCOA
if(e->type() != QEvent::MouseButtonPress)
return;
@@ -107,11 +100,21 @@ void QMacInputContext::mouseHandler(int pos, QMouseEvent *e)
if (pos < 0 || pos > currentText.length())
reset();
// ##### handle mouse position
+#else
+ Q_UNUSED(pos);
+ Q_UNUSED(e);
#endif
}
#if !defined QT_MAC_USE_COCOA
+static QTextFormat qt_mac_compose_format()
+{
+ QTextCharFormat ret;
+ ret.setFontUnderline(true);
+ return ret;
+}
+
void QMacInputContext::reset()
{
if (recursionGuard)
@@ -134,12 +137,12 @@ bool QMacInputContext::isComposing() const
{
return composing;
}
-#endif
+#endif
void QMacInputContext::setFocusWidget(QWidget *w)
{
createTextDocument();
-#ifdef Q_WS_MAC32
+#ifndef QT_MAC_USE_COCOA
if(w)
ActivateTSMDocument(textDocument);
else
@@ -149,6 +152,7 @@ void QMacInputContext::setFocusWidget(QWidget *w)
}
+#ifndef QT_MAC_USE_COCOA
static EventTypeSpec input_events[] = {
{ kEventClassTextInput, kEventTextInputUnicodeForKeyEvent },
{ kEventClassTextInput, kEventTextInputOffsetToPos },
@@ -156,11 +160,12 @@ static EventTypeSpec input_events[] = {
};
static EventHandlerUPP input_proc_handlerUPP = 0;
static EventHandlerRef input_proc_handler = 0;
+#endif
void
QMacInputContext::initialize()
{
-#ifdef Q_WS_MAC32
+#ifndef QT_MAC_USE_COCOA
if(!input_proc_handler) {
input_proc_handlerUPP = NewEventHandlerUPP(QMacInputContext::globalEventProcessor);
InstallEventHandler(GetApplicationEventTarget(), input_proc_handlerUPP,
@@ -173,7 +178,7 @@ QMacInputContext::initialize()
void
QMacInputContext::cleanup()
{
-#ifdef Q_WS_MAC32
+#ifndef QT_MAC_USE_COCOA
if(input_proc_handler) {
RemoveEventHandler(input_proc_handler);
input_proc_handler = 0;
@@ -198,7 +203,7 @@ void QMacInputContext::setLastKeydownEvent(EventRef event)
OSStatus
QMacInputContext::globalEventProcessor(EventHandlerCallRef, EventRef event, void *)
{
-#ifdef Q_WS_MAC32
+#ifndef QT_MAC_USE_COCOA
QScopedLoopLevelCounter loopLevelCounter(QApplicationPrivate::instance()->threadData);
SRefCon refcon = 0;
@@ -360,6 +365,8 @@ QMacInputContext::globalEventProcessor(EventHandlerCallRef, EventRef event, void
}
if(!handled_event) //let the event go through
return eventNotHandledErr;
+#else
+ Q_UNUSED(event);
#endif
return noErr; //we eat the event
}