summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJing Bai <jing.bai@digia.com>2013-01-15 18:04:10 (GMT)
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-01-21 10:15:20 (GMT)
commit8c2284e811d6a1e5d1d5f0703f127e66800baf78 (patch)
tree54636ac29412d8ceaacacdab831065808a468e00 /src
parent32426500bc9126de7322ce666e1fae4c0848731f (diff)
downloadQt-8c2284e811d6a1e5d1d5f0703f127e66800baf78.zip
Qt-8c2284e811d6a1e5d1d5f0703f127e66800baf78.tar.gz
Qt-8c2284e811d6a1e5d1d5f0703f127e66800baf78.tar.bz2
To support QT_NO_IM on Linux/Windows/Mac
Fix compilation issue when QT_NO_IM is defined. Also fixed references in tests. But fixing plugins/examples seem not necessary at this point. Task-number: QTBUG-26109 Change-Id: I2067051951616012117efa6716640cbf198fdb2a Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
Diffstat (limited to 'src')
-rw-r--r--src/corelib/global/qfeatures.h8
-rw-r--r--src/gui/inputmethod/qinputcontext.h1
-rw-r--r--src/gui/inputmethod/qmacinputcontext_mac.cpp5
-rw-r--r--src/gui/inputmethod/qmacinputcontext_p.h5
-rw-r--r--src/gui/inputmethod/qwininputcontext_p.h4
-rw-r--r--src/gui/inputmethod/qwininputcontext_win.cpp4
-rw-r--r--src/gui/inputmethod/qximinputcontext_p.h4
-rw-r--r--src/gui/kernel/qapplication.h2
-rw-r--r--src/gui/kernel/qapplication_mac.mm5
-rw-r--r--src/gui/kernel/qapplication_win.cpp19
-rw-r--r--src/gui/kernel/qapplication_x11.cpp5
-rw-r--r--src/gui/kernel/qcocoaview_mac.mm6
-rw-r--r--src/gui/kernel/qkeymapper_mac.cpp4
-rw-r--r--src/gui/kernel/qwidget.cpp12
-rw-r--r--src/gui/kernel/qwidget.h7
-rw-r--r--src/gui/kernel/qwidget_p.h2
-rw-r--r--src/gui/kernel/qwidget_win.cpp2
-rw-r--r--src/gui/kernel/qwidget_x11.cpp7
-rw-r--r--src/gui/text/qtextcontrol.cpp3
-rw-r--r--src/scripttools/debugging/qscriptdebugger.cpp2
20 files changed, 79 insertions, 28 deletions
diff --git a/src/corelib/global/qfeatures.h b/src/corelib/global/qfeatures.h
index 7424535..1642947 100644
--- a/src/corelib/global/qfeatures.h
+++ b/src/corelib/global/qfeatures.h
@@ -888,3 +888,11 @@
#define QT_NO_PRINTPREVIEWDIALOG
#endif
+//Input Method
+#if defined(QT_NO_IM)
+#define QT_NO_XIM
+#endif
+
+#if defined(QT_NO_IM)
+#define QT_NO_QWS_INPUTMETHODS
+#endif
diff --git a/src/gui/inputmethod/qinputcontext.h b/src/gui/inputmethod/qinputcontext.h
index 47d7200..147b8ba 100644
--- a/src/gui/inputmethod/qinputcontext.h
+++ b/src/gui/inputmethod/qinputcontext.h
@@ -58,6 +58,7 @@
#include <QtCore/qobject.h>
#include <QtCore/qglobal.h>
+#include <QtCore/qconfig.h>
#include <QtGui/qevent.h>
#include <QtCore/qstring.h>
#include <QtCore/qlist.h>
diff --git a/src/gui/inputmethod/qmacinputcontext_mac.cpp b/src/gui/inputmethod/qmacinputcontext_mac.cpp
index 270258f..7cd1be1 100644
--- a/src/gui/inputmethod/qmacinputcontext_mac.cpp
+++ b/src/gui/inputmethod/qmacinputcontext_mac.cpp
@@ -38,7 +38,9 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-
+#include <qconfig.h>
+#include <qglobal.h>
+#ifndef QT_NO_IM
#include <qvarlengtharray.h>
#include <qwidget.h>
#include <private/qmacinputcontext_p.h>
@@ -378,3 +380,4 @@ QMacInputContext::globalEventProcessor(EventHandlerCallRef, EventRef event, void
}
QT_END_NAMESPACE
+#endif // QT_NO_IM
diff --git a/src/gui/inputmethod/qmacinputcontext_p.h b/src/gui/inputmethod/qmacinputcontext_p.h
index 00e5a49..e818652 100644
--- a/src/gui/inputmethod/qmacinputcontext_p.h
+++ b/src/gui/inputmethod/qmacinputcontext_p.h
@@ -41,7 +41,8 @@
#ifndef QMACINPUTCONTEXT_P_H
#define QMACINPUTCONTEXT_P_H
-
+#include <qconfig.h>
+#ifndef QT_NO_IM
//
// W A R N I N G
// -------------
@@ -94,5 +95,5 @@ private:
};
QT_END_NAMESPACE
-
+#endif // QT_NO_IM
#endif // QMACINPUTCONTEXT_P_H
diff --git a/src/gui/inputmethod/qwininputcontext_p.h b/src/gui/inputmethod/qwininputcontext_p.h
index ed9b110..ffb2862 100644
--- a/src/gui/inputmethod/qwininputcontext_p.h
+++ b/src/gui/inputmethod/qwininputcontext_p.h
@@ -52,6 +52,8 @@
//
// We mean it.
//
+#include <qconfig.h>
+#ifndef QT_NO_IM
#include "QtGui/qinputcontext.h"
#include "QtCore/qt_windows.h"
@@ -107,5 +109,5 @@ private:
};
QT_END_NAMESPACE
-
+#endif // QT_NO_IM
#endif // QWININPUTCONTEXT_P_H
diff --git a/src/gui/inputmethod/qwininputcontext_win.cpp b/src/gui/inputmethod/qwininputcontext_win.cpp
index 8338f02..21a159b 100644
--- a/src/gui/inputmethod/qwininputcontext_win.cpp
+++ b/src/gui/inputmethod/qwininputcontext_win.cpp
@@ -41,6 +41,7 @@
#include "qwininputcontext_p.h"
#include "qinputcontext_p.h"
+#ifndef QT_NO_IM
#include "qfont.h"
#include "qwidget.h"
@@ -181,7 +182,7 @@ static IActiveIMMApp *aimm = 0;
static IActiveIMMMessagePumpOwner *aimmpump = 0;
static QString *imeComposition = 0;
static int imePosition = -1;
-bool qt_use_rtl_extensions = false;
+extern bool qt_use_rtl_extensions;
static bool haveCaret = false;
#ifndef LGRPID_INSTALLED
@@ -845,3 +846,4 @@ int QWinInputContext::reconvertString(RECONVERTSTRING *reconv)
}
QT_END_NAMESPACE
+#endif // QT_NO_IM
diff --git a/src/gui/inputmethod/qximinputcontext_p.h b/src/gui/inputmethod/qximinputcontext_p.h
index 8f36c3c..ba7d6bc 100644
--- a/src/gui/inputmethod/qximinputcontext_p.h
+++ b/src/gui/inputmethod/qximinputcontext_p.h
@@ -66,8 +66,8 @@
//
// We mean it.
//
-
-#if !defined(Q_NO_IM)
+#include <qconfig.h>
+#ifndef QT_NO_IM
#include "QtCore/qglobal.h"
#include "QtGui/qinputcontext.h"
diff --git a/src/gui/kernel/qapplication.h b/src/gui/kernel/qapplication.h
index 3de72dd..1c8334b 100644
--- a/src/gui/kernel/qapplication.h
+++ b/src/gui/kernel/qapplication.h
@@ -74,7 +74,9 @@ class QDesktopWidget;
class QStyle;
class QEventLoop;
class QIcon;
+#ifndef QT_NO_IM
class QInputContext;
+#endif
template <typename T> class QList;
class QLocale;
#if defined(Q_WS_QWS)
diff --git a/src/gui/kernel/qapplication_mac.mm b/src/gui/kernel/qapplication_mac.mm
index 41eb038..5a256ff 100644
--- a/src/gui/kernel/qapplication_mac.mm
+++ b/src/gui/kernel/qapplication_mac.mm
@@ -1207,9 +1207,10 @@ void qt_init(QApplicationPrivate *priv, int)
#ifndef QT_NO_ACCESSIBILITY
QAccessible::initialize();
#endif
+#ifndef QT_NO_IM
QMacInputContext::initialize();
QApplicationPrivate::inputContext = new QMacInputContext;
-
+#endif
if (QApplication::desktopSettingsAware())
qt_mac_update_os_settings();
#ifndef QT_MAC_USE_COCOA
@@ -1325,7 +1326,9 @@ void qt_cleanup()
#ifndef QT_NO_ACCESSIBILITY
QAccessible::cleanup();
#endif
+#ifndef QT_NO_IM
QMacInputContext::cleanup();
+#endif
QCursorData::cleanup();
QFont::cleanup();
QColormap::cleanup();
diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp
index 3935000..bbb1fca 100644
--- a/src/gui/kernel/qapplication_win.cpp
+++ b/src/gui/kernel/qapplication_win.cpp
@@ -261,6 +261,9 @@ static PACKET localPacketBuf[QT_TABLET_NPACKETQSIZE]; // our own tablet packet
HCTX qt_tablet_context; // the hardware context for the tablet (like a window handle)
bool qt_tablet_tilt_support;
+// flags for extensions for special Languages, currently only for RTL languages
+bool qt_use_rtl_extensions = false;
+
#ifndef QT_NO_TABLETEVENT
static void tabletInit(const quint64 uniqueId, const UINT csr_type, HCTX hTab);
static void tabletUpdateCursor(QTabletDeviceData &tdd, const UINT currentCursor);
@@ -845,7 +848,10 @@ void qt_init(QApplicationPrivate *priv, int)
#ifndef QT_NO_TABLETEVENT
initWinTabFunctions();
#endif // QT_NO_TABLETEVENT
+
+#ifndef QT_NO_IM
QApplicationPrivate::inputContext = new QWinInputContext(0);
+#endif
// Read the initial cleartype settings...
qt_win_read_cleartype_settings();
@@ -917,8 +923,10 @@ void qt_cleanup()
displayDC = 0;
}
+#ifndef QT_NO_IM
delete QApplicationPrivate::inputContext;
QApplicationPrivate::inputContext = 0;
+#endif
#ifndef Q_WS_WINCE
// Deinitialize OLE/COM
@@ -1476,8 +1484,11 @@ extern "C" LRESULT QT_WIN_CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wPa
long res = 0;
if (!qApp) // unstable app state
+#ifndef QT_NO_IM
RETURN(QWinInputContext::DefWindowProc(hwnd,message,wParam,lParam))
-
+#else
+ return res;
+#endif // QT_NO_IM
QScopedLoopLevelCounter loopLevelCounter(QThreadData::get2(qApp->thread()));
#if 0
@@ -2308,6 +2319,7 @@ extern "C" LRESULT QT_WIN_CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wPa
#endif
#endif
+#ifndef QT_NO_IM
case WM_IME_STARTCOMPOSITION:
case WM_IME_ENDCOMPOSITION:
case WM_IME_COMPOSITION: {
@@ -2343,6 +2355,7 @@ extern "C" LRESULT QT_WIN_CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wPa
}
break;
}
+#endif // QT_NO_IM
#ifndef Q_WS_WINCE
case WM_CHANGECBCHAIN:
case WM_DRAWCLIPBOARD:
@@ -2677,7 +2690,11 @@ extern "C" LRESULT QT_WIN_CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wPa
RETURN(false);
do_default:
+#ifndef QT_NO_IM
RETURN(QWinInputContext::DefWindowProc(hwnd,message,wParam,lParam))
+#else
+ RETURN(TRUE);
+#endif
}
diff --git a/src/gui/kernel/qapplication_x11.cpp b/src/gui/kernel/qapplication_x11.cpp
index 32cc342..377c2d6 100644
--- a/src/gui/kernel/qapplication_x11.cpp
+++ b/src/gui/kernel/qapplication_x11.cpp
@@ -1047,6 +1047,7 @@ bool QApplicationPrivate::x11_apply_settings()
qt_use_rtl_extensions =
settings.value(QLatin1String("useRtlExtensions"), false).toBool();
+#ifndef QT_NO_IM
#ifndef QT_NO_XIM
if (qt_xim_preferred_style == 0) {
QString ximInputStyle = settings.value(QLatin1String("XIMInputStyle"),
@@ -1060,7 +1061,7 @@ bool QApplicationPrivate::x11_apply_settings()
else if (ximInputStyle == QLatin1String("root"))
qt_xim_preferred_style = XIMPreeditNothing | XIMStatusNothing;
}
-#endif
+#endif // QT_NO_XIM
QStringList inputMethods = QInputContextFactory::keys();
if (inputMethods.size() > 2 && inputMethods.contains(QLatin1String("imsw-multi"))) {
X11->default_im = QLatin1String("imsw-multi");
@@ -1068,7 +1069,7 @@ bool QApplicationPrivate::x11_apply_settings()
X11->default_im = settings.value(QLatin1String("DefaultInputMethod"),
QLatin1String("xim")).toString();
}
-
+#endif //QT_NO_IM
settings.endGroup(); // Qt
return true;
diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm
index 6532f9a..e3f0f98 100644
--- a/src/gui/kernel/qcocoaview_mac.mm
+++ b/src/gui/kernel/qcocoaview_mac.mm
@@ -38,7 +38,7 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-
+#include <qconfig.h>
#import <private/qcocoaview_mac_p.h>
#ifdef QT_MAC_USE_COCOA
@@ -1027,8 +1027,10 @@ static int qCocoaViewCount = 0;
QWidget *widgetToGetKey = 0;
if (!composing || qApp->focusWidget())
widgetToGetKey = qt_mac_getTargetForKeyEvent(qwidget);
+#ifndef QT_NO_IM
else if (QMacInputContext *mic = qobject_cast<QMacInputContext *>(qApp->inputContext()))
widgetToGetKey = mic->lastFocusWidget();
+#endif
if (widgetToGetKey)
qt_sendSpontaneousEvent(widgetToGetKey, &e);
composing = false;
@@ -1221,6 +1223,7 @@ static int qCocoaViewCount = 0;
@end
QT_BEGIN_NAMESPACE
+#ifndef QT_NO_IM
void QMacInputContext::reset()
{
QWidget *w = QInputContext::focusWidget();
@@ -1249,6 +1252,7 @@ bool QMacInputContext::isComposing() const
}
return false;
}
+#endif // QT_NO_IM
extern bool qt_mac_in_drag;
void * /*NSImage */qt_mac_create_nsimage(const QPixmap &pm);
diff --git a/src/gui/kernel/qkeymapper_mac.cpp b/src/gui/kernel/qkeymapper_mac.cpp
index ed57d75..d09aded 100644
--- a/src/gui/kernel/qkeymapper_mac.cpp
+++ b/src/gui/kernel/qkeymapper_mac.cpp
@@ -739,7 +739,7 @@ bool QKeyMapperPrivate::translateKeyEvent(QWidget *widget, EventHandlerCallRef e
qt_mac_send_modifiers_changed(modifiers, widget);
return true;
}
-
+#ifndef QT_NO_IM
QInputContext *currentContext = qApp->inputContext();
if (currentContext && currentContext->isComposing()) {
if (ekind == kEventRawKeyDown) {
@@ -756,7 +756,7 @@ bool QKeyMapperPrivate::translateKeyEvent(QWidget *widget, EventHandlerCallRef e
if (context)
context->setLastKeydownEvent(0);
}
-
+#endif
//get modifiers
Qt::KeyboardModifiers modifiers;
int qtKey;
diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp
index 0ef1f76..b770758 100644
--- a/src/gui/kernel/qwidget.cpp
+++ b/src/gui/kernel/qwidget.cpp
@@ -424,28 +424,23 @@ void QWidgetPrivate::scrollChildren(int dx, int dy)
}
}
+#ifndef QT_NO_IM
QInputContext *QWidgetPrivate::assignedInputContext() const
{
-#ifndef QT_NO_IM
const QWidget *widget = q_func();
while (widget) {
if (QInputContext *qic = widget->d_func()->ic)
return qic;
widget = widget->parentWidget();
}
-#endif
return 0;
}
QInputContext *QWidgetPrivate::inputContext() const
{
-#ifndef QT_NO_IM
if (QInputContext *qic = assignedInputContext())
return qic;
return qApp->inputContext();
-#else
- return 0;
-#endif
}
/*!
@@ -480,7 +475,7 @@ void QWidget::setInputContext(QInputContext *context)
Q_D(QWidget);
if (!testAttribute(Qt::WA_InputMethodEnabled))
return;
-#ifndef QT_NO_IM
+
if (context == d->ic)
return;
if (d->ic)
@@ -488,9 +483,8 @@ void QWidget::setInputContext(QInputContext *context)
d->ic = context;
if (d->ic)
d->ic->setParent(this);
-#endif
}
-
+#endif // QT_NO_IM
/*!
\obsolete
diff --git a/src/gui/kernel/qwidget.h b/src/gui/kernel/qwidget.h
index 037a1b5..f56d83b 100644
--- a/src/gui/kernel/qwidget.h
+++ b/src/gui/kernel/qwidget.h
@@ -42,6 +42,7 @@
#ifndef QWIDGET_H
#define QWIDGET_H
+#include <QtCore/qconfig.h>
#include <QtGui/qwindowdefs.h>
#include <QtCore/qobject.h>
#include <QtCore/qmargins.h>
@@ -95,7 +96,9 @@ class QDragLeaveEvent;
class QDropEvent;
class QShowEvent;
class QHideEvent;
+#ifndef QT_NO_IM
class QInputContext;
+#endif
class QIcon;
class QWindowSurface;
class QPlatformWindow;
@@ -617,10 +620,10 @@ public:
QPaintEngine *paintEngine() const;
void ensurePolished() const;
-
+#ifndef QT_NO_IM
QInputContext *inputContext();
void setInputContext(QInputContext *);
-
+#endif
bool isAncestorOf(const QWidget *child) const;
#ifdef QT_KEYPAD_NAVIGATION
diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h
index 732443d..4c97859 100644
--- a/src/gui/kernel/qwidget_p.h
+++ b/src/gui/kernel/qwidget_p.h
@@ -577,8 +577,10 @@ public:
// sub-classes that their internals are about to be released.
virtual void aboutToDestroy() {}
+#ifndef QT_NO_IM
QInputContext *assignedInputContext() const;
QInputContext *inputContext() const;
+#endif
inline QWidget *effectiveFocusWidget() {
QWidget *w = q_func();
while (w->focusProxy())
diff --git a/src/gui/kernel/qwidget_win.cpp b/src/gui/kernel/qwidget_win.cpp
index 9223a5d..1e8b030 100644
--- a/src/gui/kernel/qwidget_win.cpp
+++ b/src/gui/kernel/qwidget_win.cpp
@@ -513,8 +513,10 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO
QT_NC_WIDGET_CREATE
#endif
+#ifndef QT_NO_IM
if (q->hasFocus() && q->testAttribute(Qt::WA_InputMethodEnabled))
q->inputContext()->setFocusWidget(q);
+#endif
if (destroyw) {
DestroyWindow(destroyw);
diff --git a/src/gui/kernel/qwidget_x11.cpp b/src/gui/kernel/qwidget_x11.cpp
index 915dd28..aeec89d 100644
--- a/src/gui/kernel/qwidget_x11.cpp
+++ b/src/gui/kernel/qwidget_x11.cpp
@@ -910,13 +910,13 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO
if (extra && !extra->mask.isEmpty() && q->internalWinId())
XShapeCombineRegion(X11->display, q->internalWinId(), ShapeBounding, 0, 0,
extra->mask.handle(), ShapeSet);
-
+#ifndef QT_NO_IM
if (q->hasFocus() && q->testAttribute(Qt::WA_InputMethodEnabled)) {
QInputContext *inputContext = q->inputContext();
if (inputContext)
inputContext->setFocusWidget(q);
}
-
+#endif
if (destroyw) {
qt_XDestroyWindow(q, dpy, destroyw);
if (QTLWExtra *topData = maybeTopData()) {
@@ -1106,7 +1106,7 @@ void QWidget::destroy(bool destroyWindow, bool destroySubWindows)
extern void qPRCleanup(QWidget *widget); // from qapplication_x11.cpp
if (testAttribute(Qt::WA_WState_Reparented))
qPRCleanup(this);
-
+#ifndef QT_NO_IM
if(d->ic) {
delete d->ic;
} else {
@@ -1116,6 +1116,7 @@ void QWidget::destroy(bool destroyWindow, bool destroySubWindows)
if (qic)
qic->widgetDestroyed(this);
}
+#endif
}
}
diff --git a/src/gui/text/qtextcontrol.cpp b/src/gui/text/qtextcontrol.cpp
index 94f7e10..2fee68a 100644
--- a/src/gui/text/qtextcontrol.cpp
+++ b/src/gui/text/qtextcontrol.cpp
@@ -50,6 +50,7 @@
#include <qdebug.h>
#include <qmime.h>
#include <qdrag.h>
+#include <qconfig.h>
#include <qclipboard.h>
#include <qmenu.h>
#include <qstyle.h>
@@ -3049,6 +3050,7 @@ void QTextControlPrivate::_q_copyLink()
#endif
}
+#ifndef QT_NO_IM
QInputContext *QTextControlPrivate::inputContext()
{
QInputContext *ctx = contextWidget->inputContext();
@@ -3056,6 +3058,7 @@ QInputContext *QTextControlPrivate::inputContext()
ctx = contextWidget->parentWidget()->inputContext();
return ctx;
}
+#endif
int QTextControl::hitTest(const QPointF &point, Qt::HitTestAccuracy accuracy) const
{
diff --git a/src/scripttools/debugging/qscriptdebugger.cpp b/src/scripttools/debugging/qscriptdebugger.cpp
index c1a84a9..995900f 100644
--- a/src/scripttools/debugging/qscriptdebugger.cpp
+++ b/src/scripttools/debugging/qscriptdebugger.cpp
@@ -881,6 +881,7 @@ void QScriptDebuggerPrivate::_q_goToLine()
QScriptDebuggerCodeViewInterface *view = codeWidget->currentView();
if (!view)
return;
+#ifndef QT_NO_INPUTDIALOG
bool ok = false;
int lineNumber = QInputDialog::getInteger(0, QScriptDebugger::tr("Go to Line"),
QScriptDebugger::tr("Line:"),
@@ -888,6 +889,7 @@ void QScriptDebuggerPrivate::_q_goToLine()
1, INT_MAX, 1, &ok);
if (ok)
view->gotoLine(lineNumber);
+#endif
}
class QScriptDebuggerShowLineJob : public QScriptDebuggerCommandSchedulerJob