summaryrefslogtreecommitdiffstats
path: root/src/gui/inputmethod/qmacinputcontext_mac.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/inputmethod/qmacinputcontext_mac.cpp')
-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 9ccbe7a..e92c0d3 100644
--- a/src/gui/inputmethod/qmacinputcontext_mac.cpp
+++ b/src/gui/inputmethod/qmacinputcontext_mac.cpp
@@ -55,13 +55,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)
{
@@ -70,7 +63,7 @@ QMacInputContext::QMacInputContext(QObject *parent)
QMacInputContext::~QMacInputContext()
{
-#ifdef Q_WS_MAC32
+#ifndef QT_MAC_USE_COCOA
if(textDocument)
DeleteTSMDocument(textDocument);
#endif
@@ -79,7 +72,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));
@@ -96,7 +89,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;
@@ -105,11 +98,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)
@@ -132,12 +135,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
@@ -147,6 +150,7 @@ void QMacInputContext::setFocusWidget(QWidget *w)
}
+#ifndef QT_MAC_USE_COCOA
static EventTypeSpec input_events[] = {
{ kEventClassTextInput, kEventTextInputUnicodeForKeyEvent },
{ kEventClassTextInput, kEventTextInputOffsetToPos },
@@ -154,11 +158,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,
@@ -171,7 +176,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;
@@ -186,7 +191,7 @@ QMacInputContext::cleanup()
OSStatus
QMacInputContext::globalEventProcessor(EventHandlerCallRef, EventRef event, void *)
{
-#ifdef Q_WS_MAC32
+#ifndef QT_MAC_USE_COCOA
QScopedLoopLevelCounter loopLevelCounter(QApplicationPrivate::instance()->threadData);
SRefCon refcon = 0;
@@ -342,6 +347,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
}