summaryrefslogtreecommitdiffstats
path: root/src/gui/inputmethod
diff options
context:
space:
mode:
authorNorwegian Rock Cat <qt-info@nokia.com>2009-06-23 12:42:32 (GMT)
committerNorwegian Rock Cat <qt-info@nokia.com>2009-06-23 12:44:08 (GMT)
commitf65ed7b51a573dd8429feecc19c7abe8a0a36114 (patch)
tree5ce70bc3ca67573b4a3b07c13e1a8a8be520f4bd /src/gui/inputmethod
parent3464a05a94c4e638d91b2151d6aad70f78ea3087 (diff)
downloadQt-f65ed7b51a573dd8429feecc19c7abe8a0a36114.zip
Qt-f65ed7b51a573dd8429feecc19c7abe8a0a36114.tar.gz
Qt-f65ed7b51a573dd8429feecc19c7abe8a0a36114.tar.bz2
Remove some warnings in the Cocoa build.
After discussing with some of the Objective-C people I have finally got a fair number of the warnings to disappear in both 10.5 and 10.6. I also took the opportunity to remove a bunch of other warnings. Reviewed by: Morten Sørvig
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 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
}