Skip to content

Instantly share code, notes, and snippets.

@mnogu
Created February 24, 2010 10:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mnogu/313301 to your computer and use it in GitHub Desktop.
Save mnogu/313301 to your computer and use it in GitHub Desktop.
Subject: [PATCH 01/26] don't use TRUE and FALSE macros
---
qt4/candwin/qt4.cpp | 2 +-
qt4/immodule/quiminputcontext.cpp | 14 +++++++-------
qt4/immodule/subwindow.cpp | 2 +-
3 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/qt4/candwin/qt4.cpp b/qt4/candwin/qt4.cpp
index d69af9a..f51b6fa 100644
--- a/qt4/candwin/qt4.cpp
+++ b/qt4/candwin/qt4.cpp
@@ -188,7 +188,7 @@ void CandidateWindow::selectCand( const QStringList &list )
qDebug( "uim-candwin-qt4: selectCand()" );
#endif
const int index = list[ 1 ].toInt();
- needHilite = (list[ 2 ].toInt() == 1) ? TRUE : FALSE;
+ needHilite = (list[ 2 ].toInt() == 1);
setIndex( index );
updateLabel();
diff --git a/qt4/immodule/quiminputcontext.cpp b/qt4/immodule/quiminputcontext.cpp
index 7f68857..3f1a804 100644
--- a/qt4/immodule/quiminputcontext.cpp
+++ b/qt4/immodule/quiminputcontext.cpp
@@ -187,7 +187,7 @@ bool QUimInputContext::x11FilterEvent( QWidget *keywidget, XEvent *event )
#if UIM_QT_USE_JAPANESE_KANA_KEYBOARD_HACK
return uim_x_kana_input_hack_filter_event( m_uc, event );
#else
- return FALSE;
+ return false;
#endif
}
#endif // Q_WS_X11
@@ -200,7 +200,7 @@ bool QUimInputContext::filterEvent( const QEvent *event )
if ( type != QEvent::KeyPress &&
type != QEvent::KeyRelease )
- return FALSE;
+ return false;
QKeyEvent *keyevent = ( QKeyEvent * ) event;
int qkey = keyevent->key();
@@ -329,7 +329,7 @@ bool QUimInputContext::filterEvent( const QEvent *event )
return mCompose->handle_qkey( keyevent );
#else
if ( notFiltered )
- return FALSE;
+ return false;
#endif
}
else if ( type == QEvent::KeyRelease )
@@ -340,11 +340,11 @@ bool QUimInputContext::filterEvent( const QEvent *event )
return mCompose->handle_qkey( keyevent );
#else
if ( notFiltered )
- return FALSE;
+ return false;
#endif
}
- return TRUE;
+ return true;
}
void QUimInputContext::setFocusWidget( QWidget *w )
@@ -456,7 +456,7 @@ void QUimInputContext::reset()
{
qDebug( "QUimInputContext::reset()" );
- candwinIsActive = FALSE;
+ candwinIsActive = false;
cwin->hide();
uim_reset_context( m_uc );
#ifdef Q_WS_X11
@@ -764,7 +764,7 @@ QList<QInputMethodEvent::Attribute> QUimInputContext::getPreeditAttrs()
#endif
}
if ( uimAttr & UPreeditAttr_UnderLine ) {
- segFmt.setFontUnderline( TRUE );
+ segFmt.setFontUnderline( true );
}
QInputMethodEvent::Attribute segAttr( QInputMethodEvent::TextFormat,
segPos, segStrLen, segFmt );
diff --git a/qt4/immodule/subwindow.cpp b/qt4/immodule/subwindow.cpp
index 429093c..5aba76f 100644
--- a/qt4/immodule/subwindow.cpp
+++ b/qt4/immodule/subwindow.cpp
@@ -82,7 +82,7 @@ void SubWindow::hookPopup( const QString &title, const QString contents )
m_titleLabel->setText( title );
m_contentsEdit->setText( contents );
- m_hookTimer->start( TIMER_INTERVAL, TRUE );
+ m_hookTimer->start( TIMER_INTERVAL, true );
}
void SubWindow::popup()
--
1.6.4.2
Subject: [PATCH 02/26] quote with single quotation marks for efficiency
---
qt4/immodule/plugin.cpp | 4 ++--
qt4/immodule/qhelpermanager.cpp | 12 ++++++------
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/qt4/immodule/plugin.cpp b/qt4/immodule/plugin.cpp
index 3c89591..7bd80c8 100644
--- a/qt4/immodule/plugin.cpp
+++ b/qt4/immodule/plugin.cpp
@@ -96,7 +96,7 @@ QStringList UimInputContextPlugin::languages( const QString & key )
QString UimInputContextPlugin::displayName( const QString & key )
{
- return QString( key ) + " (" + languages( key ) [ 0 ] + ")";
+ return QString( key ) + " (" + languages( key ) [ 0 ] + ')';
}
QString UimInputContextPlugin::description( const QString & key )
@@ -183,7 +183,7 @@ QStringList UimInputContextPlugin::createLanguageList( const QString &key ) cons
if ( key == QString( "uim-" ) + name )
{
// ":" separated languages for future extension
- QStringList langs = QString( lang ).split( ":" );
+ QStringList langs = QString( lang ).split( ':' );
return langs;
}
}
diff --git a/qt4/immodule/qhelpermanager.cpp b/qt4/immodule/qhelpermanager.cpp
index 3337070..30e83c7 100644
--- a/qt4/immodule/qhelpermanager.cpp
+++ b/qt4/immodule/qhelpermanager.cpp
@@ -104,7 +104,7 @@ void QUimHelperManager::parseHelperStr( const QString &str )
uim_prop_label_update( focusedInputContext->uimContext() );
else if ( str.startsWith( "prop_activate" ) )
{
- QStringList list = str.split( "\n" );
+ QStringList list = str.split( '\n' );
uim_prop_activate( focusedInputContext->uimContext(),
list[ 1 ].toUtf8() );
}
@@ -114,13 +114,13 @@ void QUimHelperManager::parseHelperStr( const QString &str )
}
else if ( str.startsWith( "commit_string" ) )
{
- QStringList lines = str.split( "\n" );
+ QStringList lines = str.split( '\n' );
if ( !lines.isEmpty() && !lines[ 1 ].isEmpty() ) {
QString commit_str = QString::null;
if ( lines[ 1 ].startsWith( "charset" ) ) {
/* get charset */
- QString charset = lines[ 1 ].split( "=" ) [ 1 ];
+ QString charset = lines[ 1 ].split( '=' ) [ 1 ];
/* convert to unicode */
QTextCodec *codec = QTextCodec::codecForName( charset );
@@ -152,7 +152,7 @@ void QUimHelperManager::parseHelperStr( const QString &str )
else if ( str.startsWith( "prop_update_custom" ) )
{
// for custom api
- QStringList list = str.split( "\n" );
+ QStringList list = str.split( '\n' );
if ( !list.isEmpty() && !list[ 0 ].isEmpty() &&
!list[ 1 ].isEmpty() && !list[ 2 ].isEmpty() )
{
@@ -178,9 +178,9 @@ void QUimHelperManager::parseHelperStr( const QString &str )
void QUimHelperManager::parseHelperStrImChange( const QString &str )
{
- QStringList list = str.split( "\n" );
+ QStringList list = str.split( '\n' );
QString im_name = list[ 1 ];
- QString im_name_sym = "'" + im_name;
+ QString im_name_sym = '\'' + im_name;
if ( str.startsWith( "im_change_this_text_area_only" ) )
{
--
1.6.4.2
Subject: [PATCH 03/26] declare 'explicit'
---
qt4/candwin/qt4.h | 4 ++--
qt4/immodule/candidatewindow.h | 4 ++--
qt4/immodule/qhelpermanager.h | 2 +-
qt4/immodule/qtextutil.h | 2 +-
qt4/immodule/quiminputcontext.h | 2 +-
qt4/immodule/quiminputcontext_with_slave.h | 2 +-
qt4/immodule/subwindow.h | 2 +-
7 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/qt4/candwin/qt4.h b/qt4/candwin/qt4.h
index 2a42f90..5d394ad 100644
--- a/qt4/candwin/qt4.h
+++ b/qt4/candwin/qt4.h
@@ -55,7 +55,7 @@ class CandidateWindow : public Q3VBox
{
Q_OBJECT
public:
- CandidateWindow( QWidget *parent = 0, const char * name = 0 );
+ explicit CandidateWindow( QWidget *parent = 0, const char * name = 0 );
~CandidateWindow();
void activateCand( const QStringList &list );
@@ -101,7 +101,7 @@ class CandidateListView : public Q3ListView
Q_OBJECT
public:
- CandidateListView( QWidget *parent, const char *name = 0, Qt::WFlags f = 0 ) : Q3ListView( parent, name, f ) {}
+ explicit CandidateListView( QWidget *parent, const char *name = 0, Qt::WFlags f = 0 ) : Q3ListView( parent, name, f ) {}
~CandidateListView() {}
diff --git a/qt4/immodule/candidatewindow.h b/qt4/immodule/candidatewindow.h
index f155b2d..a5eb507 100644
--- a/qt4/immodule/candidatewindow.h
+++ b/qt4/immodule/candidatewindow.h
@@ -52,7 +52,7 @@ class CandidateWindow : public Q3VBox
Q_OBJECT
public:
- CandidateWindow( QWidget *parent, const char * name = 0 );
+ explicit CandidateWindow( QWidget *parent, const char * name = 0 );
~CandidateWindow();
void activateCandwin( int dLimit );
@@ -111,7 +111,7 @@ class CandidateListView : public Q3ListView
Q_OBJECT
public:
- CandidateListView( QWidget *parent, const char *name = 0, Qt::WFlags f = 0 ) : Q3ListView( parent, name, f ) {}
+ explicit CandidateListView( QWidget *parent, const char *name = 0, Qt::WFlags f = 0 ) : Q3ListView( parent, name, f ) {}
~CandidateListView() {}
int itemIndex( const Q3ListViewItem *item ) const
diff --git a/qt4/immodule/qhelpermanager.h b/qt4/immodule/qhelpermanager.h
index 934a4f5..cf92670 100644
--- a/qt4/immodule/qhelpermanager.h
+++ b/qt4/immodule/qhelpermanager.h
@@ -43,7 +43,7 @@ class QUimHelperManager : public QObject
Q_OBJECT
public:
- QUimHelperManager( QObject * parent = 0 );
+ explicit QUimHelperManager( QObject * parent = 0 );
~QUimHelperManager();
void checkHelperConnection();
diff --git a/qt4/immodule/qtextutil.h b/qt4/immodule/qtextutil.h
index a807665..3cfca48 100644
--- a/qt4/immodule/qtextutil.h
+++ b/qt4/immodule/qtextutil.h
@@ -45,7 +45,7 @@ class QUimTextUtil : QObject
Q_OBJECT
public:
- QUimTextUtil( QObject *parent = 0 );
+ explicit QUimTextUtil( QObject *parent = 0 );
~QUimTextUtil();
static int acquire_text_cb( void *ptr, enum UTextArea text_id,
diff --git a/qt4/immodule/quiminputcontext.h b/qt4/immodule/quiminputcontext.h
index b886af0..e6c5501 100644
--- a/qt4/immodule/quiminputcontext.h
+++ b/qt4/immodule/quiminputcontext.h
@@ -72,7 +72,7 @@ class QUimInputContext : public QInputContext
{
Q_OBJECT
public:
- QUimInputContext( const char *imname = 0, const char *lang = 0 );
+ explicit QUimInputContext( const char *imname = 0, const char *lang = 0 );
~QUimInputContext();
virtual QString identifierName();
diff --git a/qt4/immodule/quiminputcontext_with_slave.h b/qt4/immodule/quiminputcontext_with_slave.h
index 610549d..1b73a93 100644
--- a/qt4/immodule/quiminputcontext_with_slave.h
+++ b/qt4/immodule/quiminputcontext_with_slave.h
@@ -45,7 +45,7 @@ class QUimInputContextWithSlave : public QUimInputContext
{
Q_OBJECT
public:
- QUimInputContextWithSlave( const char *imname = 0, const char *lang = 0 );
+ explicit QUimInputContextWithSlave( const char *imname = 0, const char *lang = 0 );
~QUimInputContextWithSlave();
virtual void setFocus();
diff --git a/qt4/immodule/subwindow.h b/qt4/immodule/subwindow.h
index 0de84a9..1561dbf 100644
--- a/qt4/immodule/subwindow.h
+++ b/qt4/immodule/subwindow.h
@@ -44,7 +44,7 @@ class SubWindow : public Q3VBox
Q_OBJECT
public:
- SubWindow( QWidget *parent = 0, const char *name = 0 );
+ explicit SubWindow( QWidget *parent = 0, const char *name = 0 );
~SubWindow();
void layoutWindow( int x, int y );
--
1.6.4.2
Subject: [PATCH 04/26] include own header first
---
qt4/candwin/qt4.cpp | 3 ++-
qt4/immodule/candidatewindow.cpp | 2 +-
qt4/immodule/qhelpermanager.cpp | 2 +-
qt4/immodule/qtextutil.cpp | 2 +-
qt4/immodule/quiminfomanager.cpp | 2 +-
qt4/immodule/quiminputcontext.cpp | 2 +-
qt4/immodule/quiminputcontext_compose.cpp | 2 +-
qt4/immodule/quiminputcontext_compose.h | 7 +++++++
qt4/immodule/subwindow.cpp | 3 +--
9 files changed, 16 insertions(+), 9 deletions(-)
diff --git a/qt4/candwin/qt4.cpp b/qt4/candwin/qt4.cpp
index f51b6fa..ce5b758 100644
--- a/qt4/candwin/qt4.cpp
+++ b/qt4/candwin/qt4.cpp
@@ -30,6 +30,8 @@
SUCH DAMAGE.
*/
+#include "qt4.h"
+
#include <config.h>
#include <qapplication.h>
@@ -50,7 +52,6 @@
#include "qtgettext.h"
-#include "qt4.h"
static const int NR_CANDIDATES = 10;
static const int MIN_CAND_WIDTH = 80;
diff --git a/qt4/immodule/candidatewindow.cpp b/qt4/immodule/candidatewindow.cpp
index 2295aba..f6d19af 100644
--- a/qt4/immodule/candidatewindow.cpp
+++ b/qt4/immodule/candidatewindow.cpp
@@ -30,6 +30,7 @@ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
*/
+#include "candidatewindow.h"
//#include <config.h>
@@ -43,7 +44,6 @@ SUCH DAMAGE.
#include "uim/uim.h"
#include "debug.h"
-#include "candidatewindow.h"
#include "subwindow.h"
#include "quiminputcontext.h"
diff --git a/qt4/immodule/qhelpermanager.cpp b/qt4/immodule/qhelpermanager.cpp
index 30e83c7..6911b4e 100644
--- a/qt4/immodule/qhelpermanager.cpp
+++ b/qt4/immodule/qhelpermanager.cpp
@@ -30,6 +30,7 @@ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
*/
+#include "qhelpermanager.h"
//#include <config.h>
@@ -44,7 +45,6 @@ SUCH DAMAGE.
#include "uim/uim-helper.h"
#include "uim/uim-im-switcher.h"
-#include "qhelpermanager.h"
#include "quiminputcontext.h"
#include "quiminfomanager.h"
#include "plugin.h"
diff --git a/qt4/immodule/qtextutil.cpp b/qt4/immodule/qtextutil.cpp
index ecee194..0d2a948 100644
--- a/qt4/immodule/qtextutil.cpp
+++ b/qt4/immodule/qtextutil.cpp
@@ -32,6 +32,7 @@ SUCH DAMAGE.
*/
// FIXME: Support Qt4 TextEdit
+#include "qtextutil.h"
//#include <config.h>
@@ -46,7 +47,6 @@ SUCH DAMAGE.
#include "uim/uim.h"
-#include "qtextutil.h"
#include "quiminputcontext.h"
diff --git a/qt4/immodule/quiminfomanager.cpp b/qt4/immodule/quiminfomanager.cpp
index e96f854..8d1419d 100644
--- a/qt4/immodule/quiminfomanager.cpp
+++ b/qt4/immodule/quiminfomanager.cpp
@@ -30,6 +30,7 @@ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
*/
+#include "quiminfomanager.h"
//#include <config.h>
@@ -37,7 +38,6 @@ SUCH DAMAGE.
#include "uim/uim.h"
-#include "quiminfomanager.h"
QUimInfoManager::QUimInfoManager()
diff --git a/qt4/immodule/quiminputcontext.cpp b/qt4/immodule/quiminputcontext.cpp
index 3f1a804..797519d 100644
--- a/qt4/immodule/quiminputcontext.cpp
+++ b/qt4/immodule/quiminputcontext.cpp
@@ -31,6 +31,7 @@
SUCH DAMAGE.
*/
+#include "quiminputcontext.h"
#include <qnamespace.h>
#include <qevent.h>
@@ -46,7 +47,6 @@
#include <string.h>
#include "debug.h"
-#include "quiminputcontext.h"
#include "quiminputcontext_compose.h"
#include "plugin.h"
#include "candidatewindow.h"
diff --git a/qt4/immodule/quiminputcontext_compose.cpp b/qt4/immodule/quiminputcontext_compose.cpp
index 9c58872..5d96d51 100644
--- a/qt4/immodule/quiminputcontext_compose.cpp
+++ b/qt4/immodule/quiminputcontext_compose.cpp
@@ -29,6 +29,7 @@
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
*/
+#include "quiminputcontext_compose.h"
#include <config.h>
@@ -46,7 +47,6 @@
#include "uim/uim.h"
#include "quiminputcontext.h"
-#include "quiminputcontext_compose.h"
#include <qtextcodec.h>
diff --git a/qt4/immodule/quiminputcontext_compose.h b/qt4/immodule/quiminputcontext_compose.h
index 04513da..5fdc185 100644
--- a/qt4/immodule/quiminputcontext_compose.h
+++ b/qt4/immodule/quiminputcontext_compose.h
@@ -35,8 +35,15 @@
#define UIM_QT4_IMMODULE_QUIMINPUTCONTEXT_COMPOSE_H
#include <X11/X.h>
+#undef CursorShape
+#undef FocusIn
+#undef FocusOut
+#undef FontChange
#undef KeyPress
#undef KeyRelease
+#undef None
+
+class QKeyEvent;
typedef struct _DefTree {
struct _DefTree *next; /* another Key definition */
diff --git a/qt4/immodule/subwindow.cpp b/qt4/immodule/subwindow.cpp
index 5aba76f..2085e63 100644
--- a/qt4/immodule/subwindow.cpp
+++ b/qt4/immodule/subwindow.cpp
@@ -30,6 +30,7 @@ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
*/
+#include "subwindow.h"
//#include <config.h>
@@ -41,8 +42,6 @@ SUCH DAMAGE.
#include <qrect.h>
#include <qpoint.h>
-#include "subwindow.h"
-
const Qt::WFlags subwindowFlag = ( Qt::Window
| Qt::WindowStaysOnTopHint
| Qt::FramelessWindowHint
--
1.6.4.2
Subject: [PATCH 05/26] add an include guard
---
qt4/immodule/plugin.h | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/qt4/immodule/plugin.h b/qt4/immodule/plugin.h
index 7369b07..9fb51c7 100644
--- a/qt4/immodule/plugin.h
+++ b/qt4/immodule/plugin.h
@@ -31,6 +31,8 @@
SUCH DAMAGE.
*/
+#ifndef UIM_QT4_IMMODULE_PLUGIN_H
+#define UIM_QT4_IMMODULE_PLUGIN_H
#include <qinputcontextplugin.h>
#include <qstringlist.h>
@@ -63,3 +65,4 @@ protected:
bool uimReady;
};
+#endif /* Not def: UIM_QT4_IMMODULE_PLUGIN_H */
--
1.6.4.2
Subject: [PATCH 06/26] don't use QString::null
---
qt4/candwin/qt4.cpp | 2 +-
qt4/immodule/candidatewindow.cpp | 2 +-
qt4/immodule/plugin.cpp | 2 +-
qt4/immodule/qhelpermanager.cpp | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/qt4/candwin/qt4.cpp b/qt4/candwin/qt4.cpp
index ce5b758..6e71656 100644
--- a/qt4/candwin/qt4.cpp
+++ b/qt4/candwin/qt4.cpp
@@ -561,7 +561,7 @@ void CandidateWindow::setIndex( int index )
void CandidateWindow::updateLabel()
{
- QString indexString = QString::null;
+ QString indexString;
if ( candidateIndex >= 0 && needHilite )
indexString = QString::number( candidateIndex + 1 ) + " / " + QString::number( nrCandidates );
else
diff --git a/qt4/immodule/candidatewindow.cpp b/qt4/immodule/candidatewindow.cpp
index f6d19af..58b0345 100644
--- a/qt4/immodule/candidatewindow.cpp
+++ b/qt4/immodule/candidatewindow.cpp
@@ -428,7 +428,7 @@ void CandidateWindow::layoutWindow( int x, int y, int /* w */, int h )
void CandidateWindow::updateLabel()
{
- QString indexString = QString::null;
+ QString indexString;
if ( candidateIndex >= 0 )
indexString = QString::number( candidateIndex + 1 ) + " / " + QString::number( nrCandidates );
else
diff --git a/qt4/immodule/plugin.cpp b/qt4/immodule/plugin.cpp
index 7bd80c8..b48fa7d 100644
--- a/qt4/immodule/plugin.cpp
+++ b/qt4/immodule/plugin.cpp
@@ -72,7 +72,7 @@ QStringList UimInputContextPlugin::keys() const
QInputContext *UimInputContextPlugin::create( const QString & key )
{
- QString imname = QString::null;
+ QString imname;
#if UIM_QT_LIST_SUBIM_AS_QTIM
if ( key.startsWith( "uim-" ) )
diff --git a/qt4/immodule/qhelpermanager.cpp b/qt4/immodule/qhelpermanager.cpp
index 6911b4e..5f04de5 100644
--- a/qt4/immodule/qhelpermanager.cpp
+++ b/qt4/immodule/qhelpermanager.cpp
@@ -116,7 +116,7 @@ void QUimHelperManager::parseHelperStr( const QString &str )
{
QStringList lines = str.split( '\n' );
if ( !lines.isEmpty() && !lines[ 1 ].isEmpty() ) {
- QString commit_str = QString::null;
+ QString commit_str;
if ( lines[ 1 ].startsWith( "charset" ) ) {
/* get charset */
--
1.6.4.2
Subject: [PATCH 07/26] don't use QMIN and QMAX
---
qt4/immodule/subwindow.cpp | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/qt4/immodule/subwindow.cpp b/qt4/immodule/subwindow.cpp
index 2085e63..6e46a1f 100644
--- a/qt4/immodule/subwindow.cpp
+++ b/qt4/immodule/subwindow.cpp
@@ -116,10 +116,10 @@ QPoint SubWindow::forceInside( const QRect &enclosure, const QRect &prisoner )
{
int new_x, new_y;
- new_x = QMIN( enclosure.right(), prisoner.right() ) - prisoner.width() + 1;
- new_x = QMAX( enclosure.left(), new_x );
- new_y = QMIN( enclosure.bottom(), prisoner.bottom() ) - prisoner.height() + 1;
- new_y = QMAX( enclosure.top(), new_y );
+ new_x = qMin( enclosure.right(), prisoner.right() ) - prisoner.width() + 1;
+ new_x = qMax( enclosure.left(), new_x );
+ new_y = qMin( enclosure.bottom(), prisoner.bottom() ) - prisoner.height() + 1;
+ new_y = qMax( enclosure.top(), new_y );
return QPoint( new_x, new_y );
}
--
1.6.4.2
Subject: [PATCH 08/26] fix typos
---
qt4/candwin/qt4.cpp | 8 ++++----
qt4/candwin/qt4.h | 2 +-
qt4/immodule/candidatewindow.cpp | 4 ++--
qt4/immodule/candidatewindow.h | 2 +-
4 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/qt4/candwin/qt4.cpp b/qt4/candwin/qt4.cpp
index 6e71656..a9e5c2c 100644
--- a/qt4/candwin/qt4.cpp
+++ b/qt4/candwin/qt4.cpp
@@ -189,7 +189,7 @@ void CandidateWindow::selectCand( const QStringList &list )
qDebug( "uim-candwin-qt4: selectCand()" );
#endif
const int index = list[ 1 ].toInt();
- needHilite = (list[ 2 ].toInt() == 1);
+ needHighlight = (list[ 2 ].toInt() == 1);
setIndex( index );
updateLabel();
@@ -265,7 +265,7 @@ void CandidateWindow::setNrCandidates( const QStringList &list )
candidateIndex = -1;
nrCandidates = list[ 1 ].toInt();
displayLimit = list[ 2 ].toInt();
- needHilite = false;
+ needHighlight = false;
isActive = true;
// setup dummy stores
@@ -542,7 +542,7 @@ void CandidateWindow::setIndex( int index )
setPage( newpage );
// select item
- if ( candidateIndex >= 0 && needHilite )
+ if ( candidateIndex >= 0 && needHighlight )
{
int pos = index;
if ( displayLimit )
@@ -562,7 +562,7 @@ void CandidateWindow::setIndex( int index )
void CandidateWindow::updateLabel()
{
QString indexString;
- if ( candidateIndex >= 0 && needHilite )
+ if ( candidateIndex >= 0 && needHighlight )
indexString = QString::number( candidateIndex + 1 ) + " / " + QString::number( nrCandidates );
else
indexString = "- / " + QString::number( nrCandidates );
diff --git a/qt4/candwin/qt4.h b/qt4/candwin/qt4.h
index 5d394ad..6bb5232 100644
--- a/qt4/candwin/qt4.h
+++ b/qt4/candwin/qt4.h
@@ -93,7 +93,7 @@ protected:
int pageIndex;
bool isActive;
- bool needHilite;
+ bool needHighlight;
};
class CandidateListView : public Q3ListView
diff --git a/qt4/immodule/candidatewindow.cpp b/qt4/immodule/candidatewindow.cpp
index 58b0345..a40fa9f 100644
--- a/qt4/immodule/candidatewindow.cpp
+++ b/qt4/immodule/candidatewindow.cpp
@@ -108,7 +108,7 @@ CandidateWindow::~CandidateWindow()
{
if ( !stores.isEmpty() )
{
- // clear stored candidate datas
+ // clear stored candidate data
for ( int i = 0; i < stores.size(); i++ )
uim_candidate_free( stores[ i ] );
stores.clear();
@@ -150,7 +150,7 @@ void CandidateWindow::clearCandidates()
displayLimit = 0;
nrCandidates = 0;
- // clear stored candidate datas
+ // clear stored candidate data
for ( int i = 0; i < stores.size(); i++ )
{
if ( stores[ i ] )
diff --git a/qt4/immodule/candidatewindow.h b/qt4/immodule/candidatewindow.h
index a5eb507..c7a54c6 100644
--- a/qt4/immodule/candidatewindow.h
+++ b/qt4/immodule/candidatewindow.h
@@ -88,7 +88,7 @@ protected slots:
protected:
void updateLabel();
- // Moving and Resizing affects the positon of Subwindow
+ // Moving and Resizing affects the position of Subwindow
virtual void moveEvent( QMoveEvent * );
virtual void resizeEvent( QResizeEvent * );
--
1.6.4.2
Subject: [PATCH 09/26] use QLatin1String
---
qt4/candwin/qt4.cpp | 12 ++++++++----
qt4/immodule/plugin.cpp | 2 +-
qt4/immodule/qhelpermanager.cpp | 26 +++++++++++++-------------
3 files changed, 22 insertions(+), 18 deletions(-)
diff --git a/qt4/candwin/qt4.cpp b/qt4/candwin/qt4.cpp
index a9e5c2c..8aef41f 100644
--- a/qt4/candwin/qt4.cpp
+++ b/qt4/candwin/qt4.cpp
@@ -125,14 +125,16 @@ void CandidateWindow::activateCand( const QStringList &list )
// get charset and create codec
QTextCodec *codec = NULL;
- if ( !list[ 1 ].isEmpty() && list[ 1 ].startsWith( "charset" ) )
+ if ( !list[ 1 ].isEmpty()
+ && list[ 1 ].startsWith( QLatin1String( "charset" ) ) )
{
const QStringList l = QStringList::split( "=", list[ 1 ] );
codec = QTextCodec::codecForName( l[ 1 ] );
}
// get display_limit
- if ( !list[ 2 ].isEmpty() && list[ 2 ].startsWith( "display_limit" ) )
+ if ( !list[ 2 ].isEmpty()
+ && list[ 2 ].startsWith( QLatin1String( "display_limit" ) ) )
{
const QStringList l = QStringList::split( "=", list[ 2 ] );
displayLimit = l[ 1 ].toInt();
@@ -287,14 +289,16 @@ void CandidateWindow::setPageCandidates( const QStringList &list )
// get charset and create codec
QTextCodec *codec = NULL;
- if ( !list[ 1 ].isEmpty() && list[ 1 ].startsWith( "charset" ) )
+ if ( !list[ 1 ].isEmpty()
+ && list[ 1 ].startsWith( QLatin1String( "charset" ) ) )
{
const QStringList l = QStringList::split( "=", list[ 1 ] );
codec = QTextCodec::codecForName( l[ 1 ] );
}
// get page
- if ( !list[ 2 ].isEmpty() && list[ 2 ].startsWith( "page" ) )
+ if ( !list[ 2 ].isEmpty()
+ && list[ 2 ].startsWith( QLatin1String( "page" ) ) )
{
const QStringList l = QStringList::split( "=", list[ 2 ] );
page = l[ 1 ].toInt();
diff --git a/qt4/immodule/plugin.cpp b/qt4/immodule/plugin.cpp
index b48fa7d..013a758 100644
--- a/qt4/immodule/plugin.cpp
+++ b/qt4/immodule/plugin.cpp
@@ -75,7 +75,7 @@ QInputContext *UimInputContextPlugin::create( const QString & key )
QString imname;
#if UIM_QT_LIST_SUBIM_AS_QTIM
- if ( key.startsWith( "uim-" ) )
+ if ( key.startsWith( QLatin1String ( "uim-" ) ) )
imname = key.mid( 4 );
else
#endif
diff --git a/qt4/immodule/qhelpermanager.cpp b/qt4/immodule/qhelpermanager.cpp
index 5f04de5..f034d9d 100644
--- a/qt4/immodule/qhelpermanager.cpp
+++ b/qt4/immodule/qhelpermanager.cpp
@@ -98,27 +98,27 @@ void QUimHelperManager::parseHelperStr( const QString &str )
{
if ( focusedInputContext && !disableFocusedContext )
{
- if ( str.startsWith( "prop_list_get" ) )
+ if ( str.startsWith( QLatin1String( "prop_list_get" ) ) )
uim_prop_list_update( focusedInputContext->uimContext() );
- else if ( str.startsWith( "prop_label_get" ) )
+ else if ( str.startsWith( QLatin1String( "prop_label_get" ) ) )
uim_prop_label_update( focusedInputContext->uimContext() );
- else if ( str.startsWith( "prop_activate" ) )
+ else if ( str.startsWith( QLatin1String( "prop_activate" ) ) )
{
QStringList list = str.split( '\n' );
uim_prop_activate( focusedInputContext->uimContext(),
list[ 1 ].toUtf8() );
}
- else if ( str.startsWith( "im_list_get" ) )
+ else if ( str.startsWith( QLatin1String( "im_list_get" ) ) )
{
sendImList();
}
- else if ( str.startsWith( "commit_string" ) )
+ else if ( str.startsWith( QLatin1String( "commit_string" ) ) )
{
QStringList lines = str.split( '\n' );
if ( !lines.isEmpty() && !lines[ 1 ].isEmpty() ) {
QString commit_str;
- if ( lines[ 1 ].startsWith( "charset" ) ) {
+ if ( lines[ 1 ].startsWith( QLatin1String( "charset" ) ) ) {
/* get charset */
QString charset = lines[ 1 ].split( '=' ) [ 1 ];
@@ -133,7 +133,7 @@ void QUimHelperManager::parseHelperStr( const QString &str )
focusedInputContext->commitString( commit_str );
}
}
- else if ( str.startsWith( "focus_in" ) )
+ else if ( str.startsWith( QLatin1String( "focus_in" ) ) )
{
// We shouldn't do "focusedInputContext = NULL" here, because some
// window manager has some focus related bugs.
@@ -144,12 +144,12 @@ void QUimHelperManager::parseHelperStr( const QString &str )
/**
* This part should be processed even if not focused
*/
- if ( str.startsWith( "im_change" ) )
+ if ( str.startsWith( QLatin1String( "im_change" ) ) )
{
// for IM switcher
parseHelperStrImChange( str );
}
- else if ( str.startsWith( "prop_update_custom" ) )
+ else if ( str.startsWith( QLatin1String( "prop_update_custom" ) ) )
{
// for custom api
QStringList list = str.split( '\n' );
@@ -166,7 +166,7 @@ void QUimHelperManager::parseHelperStr( const QString &str )
}
}
}
- else if ( str.startsWith( "custom_reload_notify" ) )
+ else if ( str.startsWith( QLatin1String( "custom_reload_notify" ) ) )
{
uim_prop_reload_configs();
@@ -182,7 +182,7 @@ void QUimHelperManager::parseHelperStrImChange( const QString &str )
QString im_name = list[ 1 ];
QString im_name_sym = '\'' + im_name;
- if ( str.startsWith( "im_change_this_text_area_only" ) )
+ if ( str.startsWith( QLatin1String( "im_change_this_text_area_only" ) ) )
{
if ( focusedInputContext )
{
@@ -192,7 +192,7 @@ void QUimHelperManager::parseHelperStrImChange( const QString &str )
focusedInputContext->readIMConf();
}
}
- else if ( str.startsWith( "im_change_whole_desktop" ) )
+ else if ( str.startsWith( QLatin1String( "im_change_whole_desktop" ) ) )
{
QList<QUimInputContext *>::iterator it;
for ( it = contextList.begin(); it != contextList.end(); ++it )
@@ -204,7 +204,7 @@ void QUimHelperManager::parseHelperStrImChange( const QString &str )
im_name_sym.toUtf8() );
}
}
- else if ( str.startsWith( "im_change_this_application_only" ) )
+ else if ( str.startsWith( QLatin1String( "im_change_this_application_only" ) ) )
{
if ( focusedInputContext )
{
--
1.6.4.2
Subject: [PATCH 10/26] replace a tab with four spaces
---
qt4/candwin/qt4.cpp | 28 +-
qt4/immodule/candidatewindow.cpp | 14 +-
qt4/immodule/plugin.cpp | 8 +-
qt4/immodule/qhelpermanager.cpp | 14 +-
qt4/immodule/qtextutil.h | 4 +-
qt4/immodule/quiminputcontext.cpp | 130 ++--
qt4/immodule/quiminputcontext_compose.cpp | 1122 ++++++++++++++--------------
qt4/immodule/quiminputcontext_compose.h | 10 +-
8 files changed, 665 insertions(+), 665 deletions(-)
diff --git a/qt4/candwin/qt4.cpp b/qt4/candwin/qt4.cpp
index 8aef41f..730b7f5 100644
--- a/qt4/candwin/qt4.cpp
+++ b/qt4/candwin/qt4.cpp
@@ -159,11 +159,11 @@ void CandidateWindow::activateCand( const QStringList &list )
d.label = headString;
- // XXX Current prime (0.4.6) may return candidate string
- // containing "\t", and we can't handle annotation in another
- // window yet.
- l.pop_front();
- QString candString = l.join( "\t" );
+ // XXX Current prime (0.4.6) may return candidate string
+ // containing "\t", and we can't handle annotation in another
+ // window yet.
+ l.pop_front();
+ QString candString = l.join( "\t" );
if ( codec )
d.str = codec->toUnicode( candString );
@@ -272,8 +272,8 @@ void CandidateWindow::setNrCandidates( const QStringList &list )
// setup dummy stores
for ( int i = 0; i < nrCandidates; i++ ) {
- CandData d;
- stores.append( d );
+ CandData d;
+ stores.append( d );
}
}
void CandidateWindow::setPageCandidates( const QStringList &list )
@@ -324,11 +324,11 @@ void CandidateWindow::setPageCandidates( const QStringList &list )
d.label = headString;
- // XXX Current prime (0.4.6) may return candidate string
- // containing "\t", and we can't handle annotation in another
- // window yet.
- l.pop_front();
- QString candString = l.join( "\t" );
+ // XXX Current prime (0.4.6) may return candidate string
+ // containing "\t", and we can't handle annotation in another
+ // window yet.
+ l.pop_front();
+ QString candString = l.join( "\t" );
if ( codec )
d.str = codec->toUnicode( candString );
@@ -363,8 +363,8 @@ void CandidateWindow::slotStdinActivated( int fd )
if ( n == -1 )
return ;
buf[ n ] = '\0';
- read_buf = (char *)realloc( read_buf, strlen( read_buf ) + n + 1 );
- strcat( read_buf, buf );
+ read_buf = (char *)realloc( read_buf, strlen( read_buf ) + n + 1 );
+ strcat( read_buf, buf );
}
QStringList msgList = QStringList::split( "\n\n", QString( read_buf ) );
diff --git a/qt4/immodule/candidatewindow.cpp b/qt4/immodule/candidatewindow.cpp
index a40fa9f..ead9b14 100644
--- a/qt4/immodule/candidatewindow.cpp
+++ b/qt4/immodule/candidatewindow.cpp
@@ -153,8 +153,8 @@ void CandidateWindow::clearCandidates()
// clear stored candidate data
for ( int i = 0; i < stores.size(); i++ )
{
- if ( stores[ i ] )
- uim_candidate_free( stores[ i ] );
+ if ( stores[ i ] )
+ uim_candidate_free( stores[ i ] );
}
stores.clear();
}
@@ -204,8 +204,8 @@ void CandidateWindow::setNrCandidates( int nrCands, int dLimit )
// setup dummy candidate
for ( int i = 0; i < nrCandidates; i++ )
{
- uim_candidate d = NULL;
- stores.append( d );
+ uim_candidate d = NULL;
+ stores.append( d );
}
if ( !subWin )
@@ -226,12 +226,12 @@ void CandidateWindow::setPageCandidates( int page, const Q3ValueList<uim_candida
start = page * displayLimit;
if ( displayLimit && ( nrCandidates - start ) > displayLimit )
- pageNr = displayLimit;
+ pageNr = displayLimit;
else
- pageNr = nrCandidates - start;
+ pageNr = nrCandidates - start;
for ( i = 0; i < pageNr; i++ )
- stores[ start + i ] = candidates[ i ];
+ stores[ start + i ] = candidates[ i ];
}
#endif /* UIM_QT_USE_NEW_PAGE_HANDLING */
diff --git a/qt4/immodule/plugin.cpp b/qt4/immodule/plugin.cpp
index 013a758..9f94b44 100644
--- a/qt4/immodule/plugin.cpp
+++ b/qt4/immodule/plugin.cpp
@@ -76,7 +76,7 @@ QInputContext *UimInputContextPlugin::create( const QString & key )
#if UIM_QT_LIST_SUBIM_AS_QTIM
if ( key.startsWith( QLatin1String ( "uim-" ) ) )
- imname = key.mid( 4 );
+ imname = key.mid( 4 );
else
#endif
if ( key == "uim" )
@@ -84,7 +84,7 @@ QInputContext *UimInputContextPlugin::create( const QString & key )
QStringList langs = createLanguageList( key );
QUimInputContext *uic = new QUimInputContext( imname.toUtf8(),
- langs[ 0 ].toUtf8() );
+ langs[ 0 ].toUtf8() );
return uic;
}
@@ -116,7 +116,7 @@ void UimInputContextPlugin::uimInit()
if (!infoManager)
infoManager = new QUimInfoManager();
#if UIM_QT_USE_JAPANESE_KANA_KEYBOARD_HACK
- uim_x_kana_input_hack_init( QX11Info::display() );
+ uim_x_kana_input_hack_init( QX11Info::display() );
#endif
uimReady = true;
}
@@ -167,7 +167,7 @@ QStringList UimInputContextPlugin::createImList() const
QStringList UimInputContextPlugin::createLanguageList( const QString &key ) const
{
if ( key == "uim" )
- return QStringList() << "ja" << "ko" << "zh" << "*";
+ return QStringList() << "ja" << "ko" << "zh" << "*";
#if UIM_QT_LIST_SUBIM_AS_QTIM
uim_context tmp_uc = uim_create_context( NULL, "UTF-8",
diff --git a/qt4/immodule/qhelpermanager.cpp b/qt4/immodule/qhelpermanager.cpp
index f034d9d..b59f1c0 100644
--- a/qt4/immodule/qhelpermanager.cpp
+++ b/qt4/immodule/qhelpermanager.cpp
@@ -106,7 +106,7 @@ void QUimHelperManager::parseHelperStr( const QString &str )
{
QStringList list = str.split( '\n' );
uim_prop_activate( focusedInputContext->uimContext(),
- list[ 1 ].toUtf8() );
+ list[ 1 ].toUtf8() );
}
else if ( str.startsWith( QLatin1String( "im_list_get" ) ) )
{
@@ -160,8 +160,8 @@ void QUimHelperManager::parseHelperStr( const QString &str )
for ( it = contextList.begin(); it != contextList.end(); ++it )
{
uim_prop_update_custom( ( *it )->uimContext(),
- list[ 1 ].toUtf8(),
- list[ 2 ].toUtf8() );
+ list[ 1 ].toUtf8(),
+ list[ 2 ].toUtf8() );
break; /* all custom variables are global */
}
}
@@ -172,7 +172,7 @@ void QUimHelperManager::parseHelperStr( const QString &str )
QUimInfoManager *infoManager =
UimInputContextPlugin::getQUimInfoManager();
- infoManager->initUimInfo();
+ infoManager->initUimInfo();
}
}
@@ -187,7 +187,7 @@ void QUimHelperManager::parseHelperStrImChange( const QString &str )
if ( focusedInputContext )
{
uim_switch_im( focusedInputContext->uimContext(),
- im_name.toUtf8() );
+ im_name.toUtf8() );
uim_prop_list_update( focusedInputContext->uimContext() );
focusedInputContext->readIMConf();
}
@@ -200,8 +200,8 @@ void QUimHelperManager::parseHelperStrImChange( const QString &str )
uim_switch_im( ( *it )->uimContext(), im_name.toUtf8() );
( *it )->readIMConf();
uim_prop_update_custom( ( *it )->uimContext(),
- "custom-preserved-default-im-name",
- im_name_sym.toUtf8() );
+ "custom-preserved-default-im-name",
+ im_name_sym.toUtf8() );
}
}
else if ( str.startsWith( QLatin1String( "im_change_this_application_only" ) ) )
diff --git a/qt4/immodule/qtextutil.h b/qt4/immodule/qtextutil.h
index 3cfca48..eb6d801 100644
--- a/qt4/immodule/qtextutil.h
+++ b/qt4/immodule/qtextutil.h
@@ -72,11 +72,11 @@ private:
char **former, char **latter );
int acquireSelectionTextInQLineEdit( enum UTextOrigin origin,
int former_req_len,
- int latter_req_len,
+ int latter_req_len,
char **former, char **latter );
int acquireSelectionTextInQTextEdit( enum UTextOrigin origin,
int former_req_len,
- int latter_req_len,
+ int latter_req_len,
char **former, char **latter );
int acquireClipboardText( enum UTextOrigin origin,
diff --git a/qt4/immodule/quiminputcontext.cpp b/qt4/immodule/quiminputcontext.cpp
index 797519d..6bb3c3d 100644
--- a/qt4/immodule/quiminputcontext.cpp
+++ b/qt4/immodule/quiminputcontext.cpp
@@ -257,7 +257,7 @@ bool QUimInputContext::filterEvent( const QEvent *event )
key = qkey - Qt::Key_F1 + UKey_F1;
}
else if ( qkey >= Qt::Key_Dead_Grave && qkey <= Qt::Key_Dead_Horn )
- {
+ {
key = qkey - Qt::Key_Dead_Grave + UKey_Dead_Grave;
}
else if ( qkey >= Qt::Key_Kanji && qkey <= Qt::Key_Eisu_toggle )
@@ -300,8 +300,8 @@ bool QUimInputContext::filterEvent( const QEvent *event )
break;
case Qt::Key_Control: key = UKey_Control_key;
if ( type == QEvent::KeyPress )
- modifier &= ~UMod_Control;
- break;
+ modifier &= ~UMod_Control;
+ break;
case Qt::Key_Alt: key = UKey_Alt_key;
if ( type == QEvent::KeyPress )
modifier &= ~UMod_Alt;
@@ -354,9 +354,9 @@ void QUimInputContext::setFocusWidget( QWidget *w )
QInputContext::setFocusWidget( w );
if ( w )
- setFocus();
+ setFocus();
else
- unsetFocus();
+ unsetFocus();
}
// Qt4 does not have QInputContext::setFocus()
@@ -473,9 +473,9 @@ void QUimInputContext::update()
qDebug( "QUimInputContext::update() w = %p", w );
if ( w ) {
- QRect mf = w->inputMethodQuery( Qt::ImMicroFocus ).toRect();
- QPoint p = w->mapToGlobal( mf.topLeft() );
- setMicroFocus( p.x(), p.y(), mf.width(), mf.height() );
+ QRect mf = w->inputMethodQuery( Qt::ImMicroFocus ).toRect();
+ QPoint p = w->mapToGlobal( mf.topLeft() );
+ setMicroFocus( p.x(), p.y(), mf.width(), mf.height() );
}
}
@@ -606,21 +606,21 @@ void QUimInputContext::updatePreedit()
QString newString = getPreeditString();
if ( !isComposing() ) {
- if ( newString.isEmpty() )
- return;
+ if ( newString.isEmpty() )
+ return;
- // Start conversion
- m_isComposing = true;
+ // Start conversion
+ m_isComposing = true;
}
if ( !newString.isEmpty() ) {
QInputMethodEvent e( newString, getPreeditAttrs() );
sendEvent( e );
- // Qt4.3.1 does not call back update() here
- update();
+ // Qt4.3.1 does not call back update() here
+ update();
} else {
- // Complete conversion implicitly since the preedit is empty
- commitString( "" );
+ // Complete conversion implicitly since the preedit is empty
+ commitString( "" );
}
}
@@ -628,7 +628,7 @@ void QUimInputContext::saveContext()
{
// just send IMEnd and keep preedit string
if ( isComposing() )
- commitString( "" );
+ commitString( "" );
}
void QUimInputContext::restoreContext()
@@ -731,46 +731,46 @@ QList<QInputMethodEvent::Attribute> QUimInputContext::getPreeditAttrs()
const QList<PreeditSegment *>::ConstIterator end = psegs.end();
int segPos = 0;
for ( ; seg != end; ++seg ) {
- int uimAttr = ( *seg )->attr;
- int segStrLen = ( *seg )->str.length();
- QTextCharFormat segFmt;
+ int uimAttr = ( *seg )->attr;
+ int segStrLen = ( *seg )->str.length();
+ QTextCharFormat segFmt;
if ( uimAttr & UPreeditAttr_Cursor ) {
- // Transparent cursor is required to set microfocus even
- // if the caret is invisible to user.
- //
- // FIXME: Segment string may be outframed if the cursor is
- // located near the right frame.
- int visibility = ( segStrLen ) ? HIDE_CARET : SHOW_CARET;
- QInputMethodEvent::Attribute cursor( QInputMethodEvent::Cursor,
- segPos, visibility, DUMMY );
- attrs << cursor;
- } else if ( uimAttr & UPreeditAttr_Separator ) {
- if ( !segStrLen )
- segStrLen = QString( DEFAULT_SEPARATOR_STR ).length();
- }
-
- if ( segStrLen ) {
- if ( uimAttr & UPreeditAttr_Reverse ) {
+ // Transparent cursor is required to set microfocus even
+ // if the caret is invisible to user.
+ //
+ // FIXME: Segment string may be outframed if the cursor is
+ // located near the right frame.
+ int visibility = ( segStrLen ) ? HIDE_CARET : SHOW_CARET;
+ QInputMethodEvent::Attribute cursor( QInputMethodEvent::Cursor,
+ segPos, visibility, DUMMY );
+ attrs << cursor;
+ } else if ( uimAttr & UPreeditAttr_Separator ) {
+ if ( !segStrLen )
+ segStrLen = QString( DEFAULT_SEPARATOR_STR ).length();
+ }
+
+ if ( segStrLen ) {
+ if ( uimAttr & UPreeditAttr_Reverse ) {
#if 0
- // FIXME: fmt.foreground() is white (expecting black)
- QTextFormat fmt = standardFormat( PreeditFormat );
- segFmt.setForeground( fmt.background() );
- segFmt.setBackground( fmt.foreground() );
+ // FIXME: fmt.foreground() is white (expecting black)
+ QTextFormat fmt = standardFormat( PreeditFormat );
+ segFmt.setForeground( fmt.background() );
+ segFmt.setBackground( fmt.foreground() );
#else
- // FIXME: Retrieve customized colors from the text widget
- segFmt.setForeground( Qt::white );
- segFmt.setBackground( Qt::black );
+ // FIXME: Retrieve customized colors from the text widget
+ segFmt.setForeground( Qt::white );
+ segFmt.setBackground( Qt::black );
#endif
- }
- if ( uimAttr & UPreeditAttr_UnderLine ) {
- segFmt.setFontUnderline( true );
- }
- QInputMethodEvent::Attribute segAttr( QInputMethodEvent::TextFormat,
- segPos, segStrLen, segFmt );
- attrs << segAttr;
- segPos += segStrLen;
- }
+ }
+ if ( uimAttr & UPreeditAttr_UnderLine ) {
+ segFmt.setFontUnderline( true );
+ }
+ QInputMethodEvent::Attribute segAttr( QInputMethodEvent::TextFormat,
+ segPos, segStrLen, segFmt );
+ attrs << segAttr;
+ segPos += segStrLen;
+ }
}
return attrs;
@@ -783,10 +783,10 @@ void QUimInputContext::prepare_page_candidates( int page )
list.clear();
if ( page < 0 )
- return;
+ return;
if ( pageFilled[ page ] )
- return;
+ return;
// set page candidates
uim_candidate cand;
@@ -797,14 +797,14 @@ void QUimInputContext::prepare_page_candidates( int page )
start = page * displayLimit;
if ( displayLimit && ( nrCandidates - start ) > displayLimit )
- pageNr = displayLimit;
+ pageNr = displayLimit;
else
- pageNr = nrCandidates - start;
+ pageNr = nrCandidates - start;
for ( int i = start; i < ( pageNr + start ); i++ )
{
- cand = uim_get_candidate( m_uc, i, displayLimit ? i % displayLimit : i );
- list.append( cand );
+ cand = uim_get_candidate( m_uc, i, displayLimit ? i % displayLimit : i );
+ list.append( cand );
}
pageFilled[ page ] = true;
cwin->setPageCandidates( page, list );
@@ -832,7 +832,7 @@ void QUimInputContext::candidateActivate( int nr, int displayLimit )
nrPages = displayLimit ? ( nr - 1 ) / displayLimit + 1 : 1;
pageFilled.clear();
for ( int i = 0; i < nrPages; i++ )
- pageFilled.append( false );
+ pageFilled.append( false );
cwin->setNrCandidates( nr, displayLimit );
@@ -850,12 +850,12 @@ void QUimInputContext::candidateSelect( int index )
int new_page;
if ( index >= cwin->nrCandidates )
- index = 0;
+ index = 0;
if ( index >= 0 && cwin->displayLimit )
- new_page = index / cwin->displayLimit;
+ new_page = index / cwin->displayLimit;
else
- new_page = cwin->pageIndex;
+ new_page = cwin->pageIndex;
prepare_page_candidates( new_page );
#endif /* UIM_QT_USE_NEW_PAGE_HANDLING */
@@ -869,11 +869,11 @@ void QUimInputContext::candidateShiftPage( bool forward )
index = forward ? cwin->pageIndex + 1 : cwin->pageIndex - 1;
if ( index < 0 )
- new_page = nrPages - 1;
+ new_page = nrPages - 1;
else if ( index >= nrPages )
- new_page = 0;
+ new_page = 0;
else
- new_page = index;
+ new_page = index;
prepare_page_candidates( new_page );
#endif /* UIM_QT_USE_NEW_PAGE_HANDLING */
diff --git a/qt4/immodule/quiminputcontext_compose.cpp b/qt4/immodule/quiminputcontext_compose.cpp
index 5d96d51..1d05fea 100644
--- a/qt4/immodule/quiminputcontext_compose.cpp
+++ b/qt4/immodule/quiminputcontext_compose.cpp
@@ -54,13 +54,13 @@
#include <X11/Xlib.h>
#include <X11/Xutil.h>
-#define COMPOSE_FILE "Compose"
-#define COMPOSE_DIR_FILE "X11/locale/compose.dir"
-#define XLOCALE_DIR "X11/locale"
-#define FALLBACK_XLIB_DIR "/usr/X11R6/lib"
+#define COMPOSE_FILE "Compose"
+#define COMPOSE_DIR_FILE "X11/locale/compose.dir"
+#define XLOCALE_DIR "X11/locale"
+#define FALLBACK_XLIB_DIR "/usr/X11R6/lib"
-#define XLC_BUFSIZE 256
-#define iscomment(ch) ((ch) == '#' || (ch) == '\0')
+#define XLC_BUFSIZE 256
+#define iscomment(ch) ((ch) == '#' || (ch) == '\0')
static int parse_line(char *line, char **argv, int argsize);
static unsigned int KeySymToUcs4(KeySym keysym);
@@ -88,31 +88,31 @@ bool Compose::handle_qkey(QKeyEvent *event)
xstate = 0;
if (qstate & Qt::ShiftButton)
- xstate |= ShiftMask;
+ xstate |= ShiftMask;
if (qstate & Qt::ControlButton)
- xstate |= ControlMask;
+ xstate |= ControlMask;
if (qstate & Qt::AltButton)
- xstate |= Mod1Mask; // XXX
+ xstate |= Mod1Mask; // XXX
if (qstate & Qt::MetaButton)
- xstate |= Mod1Mask; // XXX
+ xstate |= Mod1Mask; // XXX
if (qkey >= 0x20 && qkey <= 0xff) {
if (isascii(qkey) && isprint(qkey)) {
- int ascii = event->ascii();
- if (isalpha(ascii))
- xkeysym = ascii;
- else
- if ((qstate & Qt::ControlButton) &&
- (ascii >= 0x01 && ascii <= 0x1a))
- if (qstate & Qt::ShiftButton)
- xkeysym = ascii + 0x40;
- else
- xkeysym = ascii + 0x60;
- else
- xkeysym = qkey;
- } else {
+ int ascii = event->ascii();
+ if (isalpha(ascii))
+ xkeysym = ascii;
+ else
+ if ((qstate & Qt::ControlButton) &&
+ (ascii >= 0x01 && ascii <= 0x1a))
+ if (qstate & Qt::ShiftButton)
+ xkeysym = ascii + 0x40;
+ else
+ xkeysym = ascii + 0x60;
+ else
+ xkeysym = qkey;
+ } else {
xkeysym = qkey;
- }
+ }
} else if (qkey >= Qt::Key_Dead_Grave && qkey <= Qt::Key_Dead_Horn) {
xkeysym = qkey + 0xec00 - 0x01000000;
} else {
@@ -227,36 +227,36 @@ bool Compose::handleKey(KeySym xkeysym, int xkeystate, bool is_push)
DefTree *p;
if ((is_push == false) || m_top == NULL)
- return false;
+ return false;
if (IsModifierKey(xkeysym))
- return false;
+ return false;
for (p = m_context; p ; p = p->next) {
- if (((xkeystate & p->modifier_mask) == p->modifier) &&
- (xkeysym == p->keysym)) {
- break;
- }
+ if (((xkeystate & p->modifier_mask) == p->modifier) &&
+ (xkeysym == p->keysym)) {
+ break;
+ }
}
if (p) { // Matched
- if (p->succession) { // Intermediate
- m_context = p->succession;
- return true;
- } else { // Terminate (reached to leaf)
- m_composed = p;
- // commit string here
- m_ic->commitString(QString::fromUtf8(m_composed->utf8));
- // initialize internal state for next key sequence
- m_context = m_top;
- return true;
- }
+ if (p->succession) { // Intermediate
+ m_context = p->succession;
+ return true;
+ } else { // Terminate (reached to leaf)
+ m_composed = p;
+ // commit string here
+ m_ic->commitString(QString::fromUtf8(m_composed->utf8));
+ // initialize internal state for next key sequence
+ m_context = m_top;
+ return true;
+ }
} else { // Unmatched
- if (m_context == m_top)
- return false;
- // Error (Sequence Unmatch occurred)
- m_context = m_top;
- return true;
+ if (m_context == m_top)
+ return false;
+ // Error (Sequence Unmatch occurred)
+ m_context = m_top;
+ return true;
}
}
@@ -272,19 +272,19 @@ nextch(FILE *fp, int *lastch)
int c;
if (*lastch != 0) {
- c = *lastch;
- *lastch = 0;
+ c = *lastch;
+ *lastch = 0;
} else {
- c = getc(fp);
- if (c == '\\') {
- c = getc(fp);
- if (c == '\n') {
- c = getc(fp);
- } else {
- ungetc(c, fp);
- c = '\\';
- }
- }
+ c = getc(fp);
+ if (c == '\\') {
+ c = getc(fp);
+ if (c == '\n') {
+ c = getc(fp);
+ } else {
+ ungetc(c, fp);
+ c = '\\';
+ }
+ }
}
return(c);
}
@@ -328,155 +328,155 @@ nexttoken(FILE *fp, char **tokenbuf, int *lastch, size_t *buflen)
}
switch (c) {
case EOF:
- token = ENDOFFILE;
- break;
+ token = ENDOFFILE;
+ break;
case '\n':
- token = ENDOFLINE;
- break;
+ token = ENDOFLINE;
+ break;
case '<':
- token = LESS;
- break;
+ token = LESS;
+ break;
case '>':
- token = GREATER;
- break;
+ token = GREATER;
+ break;
case ':':
- token = COLON;
- break;
+ token = COLON;
+ break;
case '!':
- token = EXCLAM;
- break;
+ token = EXCLAM;
+ break;
case '~':
- token = TILDE;
- break;
+ token = TILDE;
+ break;
case '"':
- p = *tokenbuf;
- while ((c = nextch(fp, lastch)) != '"') {
- if (len >= *buflen - 1) {
- *buflen += BUFSIZ;
- *tokenbuf = (char *)realloc(*tokenbuf, *buflen);
- p = *tokenbuf + len;
- }
- if (c == '\n' || c == EOF) {
- putbackch(c, lastch);
- token = ERROR;
- goto string_error;
- } else if (c == '\\') {
- c = nextch(fp, lastch);
- switch (c) {
- case '\\':
- case '"':
- *p++ = c;
- len++;
- break;
- case 'n':
- *p++ = '\n';
- len++;
- break;
- case 'r':
- *p++ = '\r';
- len++;
- break;
- case 't':
- *p++ = '\t';
- len++;
- break;
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- i = c - '0';
- c = nextch(fp, lastch);
- for (j = 0; j < 2 && c >= '0' && c <= '7'; j++) {
- i <<= 3;
- i += c - '0';
- c = nextch(fp, lastch);
- }
- putbackch(c, lastch);
- *p++ = (char)i;
- len++;
- break;
- case 'X':
- case 'x':
- i = 0;
- for (j = 0; j < 2; j++) {
- c = nextch(fp, lastch);
- i <<= 4;
- if (c >= '0' && c <= '9') {
- i += c - '0';
- } else if (c >= 'A' && c <= 'F') {
- i += c - 'A' + 10;
- } else if (c >= 'a' && c <= 'f') {
- i += c - 'a' + 10;
- } else {
- putbackch(c, lastch);
- i >>= 4;
- break;
- }
- }
- if (j == 0) {
- token = ERROR;
- goto string_error;
- }
- *p++ = (char)i;
- len++;
- break;
- case EOF:
- putbackch(c, lastch);
- token = ERROR;
- goto string_error;
- default:
- *p++ = c;
- len++;
- break;
- }
- } else {
- *p++ = c;
- len++;
- }
- }
- *p = '\0';
- token = STRING;
- break;
+ p = *tokenbuf;
+ while ((c = nextch(fp, lastch)) != '"') {
+ if (len >= *buflen - 1) {
+ *buflen += BUFSIZ;
+ *tokenbuf = (char *)realloc(*tokenbuf, *buflen);
+ p = *tokenbuf + len;
+ }
+ if (c == '\n' || c == EOF) {
+ putbackch(c, lastch);
+ token = ERROR;
+ goto string_error;
+ } else if (c == '\\') {
+ c = nextch(fp, lastch);
+ switch (c) {
+ case '\\':
+ case '"':
+ *p++ = c;
+ len++;
+ break;
+ case 'n':
+ *p++ = '\n';
+ len++;
+ break;
+ case 'r':
+ *p++ = '\r';
+ len++;
+ break;
+ case 't':
+ *p++ = '\t';
+ len++;
+ break;
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ i = c - '0';
+ c = nextch(fp, lastch);
+ for (j = 0; j < 2 && c >= '0' && c <= '7'; j++) {
+ i <<= 3;
+ i += c - '0';
+ c = nextch(fp, lastch);
+ }
+ putbackch(c, lastch);
+ *p++ = (char)i;
+ len++;
+ break;
+ case 'X':
+ case 'x':
+ i = 0;
+ for (j = 0; j < 2; j++) {
+ c = nextch(fp, lastch);
+ i <<= 4;
+ if (c >= '0' && c <= '9') {
+ i += c - '0';
+ } else if (c >= 'A' && c <= 'F') {
+ i += c - 'A' + 10;
+ } else if (c >= 'a' && c <= 'f') {
+ i += c - 'a' + 10;
+ } else {
+ putbackch(c, lastch);
+ i >>= 4;
+ break;
+ }
+ }
+ if (j == 0) {
+ token = ERROR;
+ goto string_error;
+ }
+ *p++ = (char)i;
+ len++;
+ break;
+ case EOF:
+ putbackch(c, lastch);
+ token = ERROR;
+ goto string_error;
+ default:
+ *p++ = c;
+ len++;
+ break;
+ }
+ } else {
+ *p++ = c;
+ len++;
+ }
+ }
+ *p = '\0';
+ token = STRING;
+ break;
case '#':
- while ((c = nextch(fp, lastch)) != '\n' && c != EOF) {
- }
- if (c == '\n') {
- token = ENDOFLINE;
- } else {
- token = ENDOFFILE;
- }
- break;
+ while ((c = nextch(fp, lastch)) != '\n' && c != EOF) {
+ }
+ if (c == '\n') {
+ token = ENDOFLINE;
+ } else {
+ token = ENDOFFILE;
+ }
+ break;
default:
- if (isalnum(c) || c == '_' || c == '-') {
- if (len >= *buflen - 1) {
- *buflen += BUFSIZ;
- *tokenbuf = (char *)realloc(*tokenbuf, *buflen);
- }
- p = *tokenbuf;
- *p++ = c;
- len++;
- c = nextch(fp, lastch);
- while (isalnum(c) || c == '_' || c == '-') {
- if (len >= *buflen - 1) {
- *buflen += BUFSIZ;
- *tokenbuf = (char *)realloc(*tokenbuf, *buflen);
- p = *tokenbuf + len;
- }
- *p++ = c;
- len++;
- c = nextch(fp, lastch);
- }
- *p = '\0';
- putbackch(c, lastch);
- token = KEY;
- } else {
- token = ERROR;
- }
- break;
+ if (isalnum(c) || c == '_' || c == '-') {
+ if (len >= *buflen - 1) {
+ *buflen += BUFSIZ;
+ *tokenbuf = (char *)realloc(*tokenbuf, *buflen);
+ }
+ p = *tokenbuf;
+ *p++ = c;
+ len++;
+ c = nextch(fp, lastch);
+ while (isalnum(c) || c == '_' || c == '-') {
+ if (len >= *buflen - 1) {
+ *buflen += BUFSIZ;
+ *tokenbuf = (char *)realloc(*tokenbuf, *buflen);
+ p = *tokenbuf + len;
+ }
+ *p++ = c;
+ len++;
+ c = nextch(fp, lastch);
+ }
+ *p = '\0';
+ putbackch(c, lastch);
+ token = KEY;
+ } else {
+ token = ERROR;
+ }
+ break;
}
string_error:
return(token);
@@ -488,27 +488,27 @@ modmask(char *name)
long mask;
struct _modtbl {
- const char *name;
- long mask;
+ const char *name;
+ long mask;
};
struct _modtbl *p;
static struct _modtbl tbl[] = {
- { "Ctrl", ControlMask },
- { "Lock", LockMask },
- { "Caps", LockMask },
- { "Shift", ShiftMask },
- { "Alt", Mod1Mask },
- { "Meta", Mod1Mask },
- { NULL, 0 }};
+ { "Ctrl", ControlMask },
+ { "Lock", LockMask },
+ { "Caps", LockMask },
+ { "Shift", ShiftMask },
+ { "Alt", Mod1Mask },
+ { "Meta", Mod1Mask },
+ { NULL, 0 }};
p = tbl;
mask = 0;
for (p = tbl; p->name != NULL; p++) {
- if (strcmp(name, p->name) == 0) {
- mask = p->mask;
- break;
- }
+ if (strcmp(name, p->name) == 0) {
+ mask = p->mask;
+ break;
+ }
}
return(mask);
}
@@ -521,58 +521,58 @@ QUimInputContext::TransFileName(char *name)
int l = 0;
while (*i) {
- if (*i == '%') {
- i++;
- switch (*i) {
- case '%':
- l++;
- break;
- case 'H':
- home = getenv("HOME");
- if (home)
- l += strlen(home);
- break;
- case 'L':
- lcCompose = get_compose_filename();
- if (lcCompose)
- l += strlen(lcCompose);
- break;
- }
- } else {
- l++;
- }
- i++;
+ if (*i == '%') {
+ i++;
+ switch (*i) {
+ case '%':
+ l++;
+ break;
+ case 'H':
+ home = getenv("HOME");
+ if (home)
+ l += strlen(home);
+ break;
+ case 'L':
+ lcCompose = get_compose_filename();
+ if (lcCompose)
+ l += strlen(lcCompose);
+ break;
+ }
+ } else {
+ l++;
+ }
+ i++;
}
j = ret = (char *)malloc(l + 1);
if (ret == NULL)
- return ret;
+ return ret;
i = name;
while (*i) {
- if (*i == '%') {
- i++;
- switch (*i) {
- case '%':
- *j++ = '%';
- break;
- case 'H':
- if (home) {
- strcpy(j, home);
- j += strlen(home);
- }
- break;
- case 'L':
- if (lcCompose) {
- strcpy(j, lcCompose);
- j += strlen(lcCompose);
- free(lcCompose);
- }
- break;
- }
- i++;
- } else {
- *j++ = *i++;
- }
+ if (*i == '%') {
+ i++;
+ switch (*i) {
+ case '%':
+ *j++ = '%';
+ break;
+ case 'H':
+ if (home) {
+ strcpy(j, home);
+ j += strlen(home);
+ }
+ break;
+ case 'L':
+ if (lcCompose) {
+ strcpy(j, lcCompose);
+ j += strlen(lcCompose);
+ free(lcCompose);
+ }
+ break;
+ }
+ i++;
+ } else {
+ *j++ = *i++;
+ }
}
*j = '\0';
return ret;
@@ -600,7 +600,7 @@ QUimInputContext::get_encoding()
p = setlocale(LC_CTYPE, NULL);
if (p)
- p = strchr(p, '.');
+ p = strchr(p, '.');
return p ? p + 1 : "UTF-8";
#endif
@@ -638,7 +638,7 @@ QUimInputContext::get_mb_string(char *buf, unsigned int ks)
QString qs = QString(QChar(ks));
mb = (const char *)qs.local8Bit();
if (!mb)
- return 0;
+ return 0;
len = strlen(mb);
strlcpy(buf, mb, MB_LEN_MAX + 1);
@@ -668,9 +668,9 @@ QUimInputContext::parse_compose_line(FILE *fp, char **tokenbuf, size_t *buflen)
char *rhs_string_utf8;
struct DefBuffer {
- unsigned modifier_mask;
- unsigned modifier;
- KeySym keysym;
+ unsigned modifier_mask;
+ unsigned modifier;
+ KeySym keysym;
};
struct DefBuffer buf[SEQUENCE_MAX];
@@ -679,181 +679,181 @@ QUimInputContext::parse_compose_line(FILE *fp, char **tokenbuf, size_t *buflen)
QString qs;
do {
- token = nexttoken(fp, tokenbuf, &lastch, buflen);
+ token = nexttoken(fp, tokenbuf, &lastch, buflen);
} while (token == ENDOFLINE);
if (token == ENDOFFILE) {
- return(-1);
+ return(-1);
}
n = 0;
do {
- if ((token == KEY) && (strcmp("include", *tokenbuf) == 0)) {
- char *filename;
- FILE *infp;
- token = nexttoken(fp, tokenbuf, &lastch, buflen);
- if (token != KEY && token != STRING)
- goto error;
-
- if ((filename = TransFileName(*tokenbuf)) == NULL)
- goto error;
- infp = fopen(filename, "r");
- free(filename);
- if (infp == NULL)
- goto error;
- ParseComposeStringFile(infp);
- fclose(infp);
- return 0;
- } else if ((token == KEY) && (strcmp("None", *tokenbuf) == 0)) {
- modifier = 0;
- modifier_mask = AllMask;
- token = nexttoken(fp, tokenbuf, &lastch, buflen);
- } else {
- modifier_mask = modifier = 0;
- exclam = False;
- if (token == EXCLAM) {
- exclam = True;
- token = nexttoken(fp, tokenbuf, &lastch, buflen);
- }
- while (token == TILDE || token == KEY) {
- tilde = False;
- if (token == TILDE) {
- tilde = True;
- token = nexttoken(fp, tokenbuf, &lastch, buflen);
- if (token != KEY)
- goto error;
- }
- tmp = modmask(*tokenbuf);
- if (!tmp) {
- goto error;
- }
- modifier_mask |= tmp;
- if (tilde) {
- modifier &= ~tmp;
- } else {
- modifier |= tmp;
- }
- token = nexttoken(fp, tokenbuf, &lastch, buflen);
- }
- if (exclam) {
- modifier_mask = AllMask;
-
- }
- }
-
- if (token != LESS) {
- goto error;
- }
-
- token = nexttoken(fp, tokenbuf, &lastch, buflen);
- if (token != KEY) {
- goto error;
- }
-
- token = nexttoken(fp, tokenbuf, &lastch, buflen);
- if (token != GREATER) {
- goto error;
- }
-
- keysym = XStringToKeysym(*tokenbuf);
- if (keysym == NoSymbol) {
- goto error;
- }
-
- buf[n].keysym = keysym;
- buf[n].modifier = modifier;
- buf[n].modifier_mask = modifier_mask;
- n++;
- if (n >= SEQUENCE_MAX)
- goto error;
- token = nexttoken(fp, tokenbuf, &lastch, buflen);
+ if ((token == KEY) && (strcmp("include", *tokenbuf) == 0)) {
+ char *filename;
+ FILE *infp;
+ token = nexttoken(fp, tokenbuf, &lastch, buflen);
+ if (token != KEY && token != STRING)
+ goto error;
+
+ if ((filename = TransFileName(*tokenbuf)) == NULL)
+ goto error;
+ infp = fopen(filename, "r");
+ free(filename);
+ if (infp == NULL)
+ goto error;
+ ParseComposeStringFile(infp);
+ fclose(infp);
+ return 0;
+ } else if ((token == KEY) && (strcmp("None", *tokenbuf) == 0)) {
+ modifier = 0;
+ modifier_mask = AllMask;
+ token = nexttoken(fp, tokenbuf, &lastch, buflen);
+ } else {
+ modifier_mask = modifier = 0;
+ exclam = False;
+ if (token == EXCLAM) {
+ exclam = True;
+ token = nexttoken(fp, tokenbuf, &lastch, buflen);
+ }
+ while (token == TILDE || token == KEY) {
+ tilde = False;
+ if (token == TILDE) {
+ tilde = True;
+ token = nexttoken(fp, tokenbuf, &lastch, buflen);
+ if (token != KEY)
+ goto error;
+ }
+ tmp = modmask(*tokenbuf);
+ if (!tmp) {
+ goto error;
+ }
+ modifier_mask |= tmp;
+ if (tilde) {
+ modifier &= ~tmp;
+ } else {
+ modifier |= tmp;
+ }
+ token = nexttoken(fp, tokenbuf, &lastch, buflen);
+ }
+ if (exclam) {
+ modifier_mask = AllMask;
+
+ }
+ }
+
+ if (token != LESS) {
+ goto error;
+ }
+
+ token = nexttoken(fp, tokenbuf, &lastch, buflen);
+ if (token != KEY) {
+ goto error;
+ }
+
+ token = nexttoken(fp, tokenbuf, &lastch, buflen);
+ if (token != GREATER) {
+ goto error;
+ }
+
+ keysym = XStringToKeysym(*tokenbuf);
+ if (keysym == NoSymbol) {
+ goto error;
+ }
+
+ buf[n].keysym = keysym;
+ buf[n].modifier = modifier;
+ buf[n].modifier_mask = modifier_mask;
+ n++;
+ if (n >= SEQUENCE_MAX)
+ goto error;
+ token = nexttoken(fp, tokenbuf, &lastch, buflen);
} while (token != COLON);
token = nexttoken(fp, tokenbuf, &lastch, buflen);
if (token == STRING) {
- if ((rhs_string_mb = (char *)malloc(strlen(*tokenbuf) + 1)) == NULL)
- goto error;
- strcpy(rhs_string_mb, *tokenbuf);
- token = nexttoken(fp, tokenbuf, &lastch, buflen);
- if (token == KEY) {
- rhs_keysym = XStringToKeysym(*tokenbuf);
- if (rhs_keysym == NoSymbol) {
- free(rhs_string_mb);
- goto error;
- }
- token = nexttoken(fp, tokenbuf, &lastch, buflen);
- }
- if (token != ENDOFLINE && token != ENDOFFILE) {
- free(rhs_string_mb);
- goto error;
- }
+ if ((rhs_string_mb = (char *)malloc(strlen(*tokenbuf) + 1)) == NULL)
+ goto error;
+ strcpy(rhs_string_mb, *tokenbuf);
+ token = nexttoken(fp, tokenbuf, &lastch, buflen);
+ if (token == KEY) {
+ rhs_keysym = XStringToKeysym(*tokenbuf);
+ if (rhs_keysym == NoSymbol) {
+ free(rhs_string_mb);
+ goto error;
+ }
+ token = nexttoken(fp, tokenbuf, &lastch, buflen);
+ }
+ if (token != ENDOFLINE && token != ENDOFFILE) {
+ free(rhs_string_mb);
+ goto error;
+ }
} else if (token == KEY) {
- rhs_keysym = XStringToKeysym(*tokenbuf);
- if (rhs_keysym == NoSymbol) {
- goto error;
- }
- token = nexttoken(fp, tokenbuf, &lastch, buflen);
- if (token != ENDOFLINE && token != ENDOFFILE) {
- goto error;
- }
-
- l = get_mb_string(local_mb_buf, rhs_keysym);
- if (l == 0) {
- rhs_string_mb = (char *)malloc(1);
- } else {
- rhs_string_mb = (char *)malloc(l + 1);
- }
- if (rhs_string_mb == NULL) {
- goto error;
- }
- memcpy(rhs_string_mb, local_mb_buf, l);
- rhs_string_mb[l] = '\0';
+ rhs_keysym = XStringToKeysym(*tokenbuf);
+ if (rhs_keysym == NoSymbol) {
+ goto error;
+ }
+ token = nexttoken(fp, tokenbuf, &lastch, buflen);
+ if (token != ENDOFLINE && token != ENDOFFILE) {
+ goto error;
+ }
+
+ l = get_mb_string(local_mb_buf, rhs_keysym);
+ if (l == 0) {
+ rhs_string_mb = (char *)malloc(1);
+ } else {
+ rhs_string_mb = (char *)malloc(l + 1);
+ }
+ if (rhs_string_mb == NULL) {
+ goto error;
+ }
+ memcpy(rhs_string_mb, local_mb_buf, l);
+ rhs_string_mb[l] = '\0';
} else {
- goto error;
+ goto error;
}
qs = codec->toUnicode(rhs_string_mb);
rhs_string_utf8 = strdup((const char *)qs.utf8());
for (i = 0; i < n; i++) {
- for (p = *top; p; p = p->next) {
- if (buf[i].keysym == p->keysym &&
- buf[i].modifier == p->modifier &&
- buf[i].modifier_mask == p->modifier_mask) {
- break;
- }
- }
- if (p) {
- top = &p->succession;
- } else {
- if ((p = (DefTree*)malloc(sizeof(DefTree))) == NULL) {
- free(rhs_string_mb);
- goto error;
- }
- p->keysym = buf[i].keysym;
- p->modifier = buf[i].modifier;
- p->modifier_mask = buf[i].modifier_mask;
- p->succession = NULL;
- p->next = *top;
- p->mb = NULL;
- p->utf8 = NULL;
- p->ks = NoSymbol;
- *top = p;
- top = &p->succession;
- }
+ for (p = *top; p; p = p->next) {
+ if (buf[i].keysym == p->keysym &&
+ buf[i].modifier == p->modifier &&
+ buf[i].modifier_mask == p->modifier_mask) {
+ break;
+ }
+ }
+ if (p) {
+ top = &p->succession;
+ } else {
+ if ((p = (DefTree*)malloc(sizeof(DefTree))) == NULL) {
+ free(rhs_string_mb);
+ goto error;
+ }
+ p->keysym = buf[i].keysym;
+ p->modifier = buf[i].modifier;
+ p->modifier_mask = buf[i].modifier_mask;
+ p->succession = NULL;
+ p->next = *top;
+ p->mb = NULL;
+ p->utf8 = NULL;
+ p->ks = NoSymbol;
+ *top = p;
+ top = &p->succession;
+ }
}
if (p->mb != NULL)
- free(p->mb);
+ free(p->mb);
p->mb = rhs_string_mb;
if (p->utf8 != NULL)
- free(p->utf8);
+ free(p->utf8);
p->utf8 = rhs_string_utf8;
p->ks = rhs_keysym;
return n;
error:
while (token != ENDOFLINE && token != ENDOFFILE) {
- token = nexttoken(fp, tokenbuf, &lastch, buflen);
+ token = nexttoken(fp, tokenbuf, &lastch, buflen);
}
return 0;
}
@@ -881,15 +881,15 @@ QUimInputContext::ParseComposeStringFile(FILE *fp)
size_t buflen = BUFSIZ;
if (fstat(fileno(fp), &st) != -1 && S_ISREG(st.st_mode) &&
- st.st_size > 0) {
-
- tbp = (char *)malloc(buflen);
- p[0] = tbp;
- if (tbp != NULL) {
- while (parse_compose_line(fp, p, &buflen) >= 0) {
- }
- free(p[0]);
- }
+ st.st_size > 0) {
+
+ tbp = (char *)malloc(buflen);
+ p[0] = tbp;
+ if (tbp != NULL) {
+ while (parse_compose_line(fp, p, &buflen) >= 0) {
+ }
+ free(p[0]);
+ }
}
}
@@ -903,44 +903,44 @@ void QUimInputContext::create_compose_tree()
name = getenv("XCOMPOSEFILE");
if (name == NULL) {
- char *home = getenv("HOME");
- if (home != NULL) {
- int hl = strlen(home);
- tmpname = name = (char *)malloc(hl + 10 + 1);
- if (name != NULL) {
- strcpy(name, home);
- strcpy(name + hl, "/.XCompose");
- fp = fopen(name, "r");
- if (fp == NULL) {
- free(name);
- name = tmpname = NULL;
- }
- }
- }
+ char *home = getenv("HOME");
+ if (home != NULL) {
+ int hl = strlen(home);
+ tmpname = name = (char *)malloc(hl + 10 + 1);
+ if (name != NULL) {
+ strcpy(name, home);
+ strcpy(name + hl, "/.XCompose");
+ fp = fopen(name, "r");
+ if (fp == NULL) {
+ free(name);
+ name = tmpname = NULL;
+ }
+ }
+ }
}
if (name == NULL) {
- tmpname = name = get_compose_filename();
+ tmpname = name = get_compose_filename();
}
if (name == NULL)
- return;
+ return;
if (fp == NULL) {
- fp = fopen(name, "r");
+ fp = fopen(name, "r");
}
if (tmpname != NULL) {
- free(tmpname);
+ free(tmpname);
}
if (fp == NULL)
- return;
+ return;
lang_region = get_lang_region();
encoding = get_encoding();
if (lang_region == NULL || encoding == NULL) {
- fprintf(stderr, "Warning: locale name is NULL\n");
- fclose(fp);
- free(lang_region);
- return;
+ fprintf(stderr, "Warning: locale name is NULL\n");
+ fclose(fp);
+ free(lang_region);
+ return;
}
ParseComposeStringFile(fp);
@@ -963,87 +963,87 @@ char *QUimInputContext::get_compose_filename()
encoding = get_encoding();
if (lang_region == NULL || encoding == NULL) {
- free(lang_region);
- return NULL;
+ free(lang_region);
+ return NULL;
}
locale = (char *)malloc(strlen(lang_region) + strlen(encoding) + 2);
if (locale == NULL) {
- free(lang_region);
- return NULL;
+ free(lang_region);
+ return NULL;
}
sprintf(locale, "%s.%s", lang_region, encoding);
free(lang_region);
compose_dir_file = (char *)malloc(strlen(XLIB_DIR) + strlen(COMPOSE_DIR_FILE) + 2);
if (compose_dir_file == NULL) {
- free(locale);
- return NULL;
+ free(locale);
+ return NULL;
}
sprintf(compose_dir_file, "%s/%s", XLIB_DIR, COMPOSE_DIR_FILE);
fp = fopen(compose_dir_file, "r");
if (fp == NULL) {
- /* retry with fallback file */
- if (strcmp(FALLBACK_XLIB_DIR, XLIB_DIR)) {
- compose_dir_file = (char *)realloc(compose_dir_file,
- strlen(FALLBACK_XLIB_DIR) +
- strlen(COMPOSE_DIR_FILE) + 2);
- if (compose_dir_file == NULL) {
- free(locale);
- return NULL;
- }
- sprintf(compose_dir_file, "%s/%s",
- FALLBACK_XLIB_DIR, COMPOSE_DIR_FILE);
- fp = fopen(compose_dir_file, "r");
- if (fp == NULL) {
- free(locale);
- free(compose_dir_file);
- return NULL;
- }
- xlib_dir = FALLBACK_XLIB_DIR;
- } else {
- free(locale);
- free(compose_dir_file);
- return NULL;
- }
+ /* retry with fallback file */
+ if (strcmp(FALLBACK_XLIB_DIR, XLIB_DIR)) {
+ compose_dir_file = (char *)realloc(compose_dir_file,
+ strlen(FALLBACK_XLIB_DIR) +
+ strlen(COMPOSE_DIR_FILE) + 2);
+ if (compose_dir_file == NULL) {
+ free(locale);
+ return NULL;
+ }
+ sprintf(compose_dir_file, "%s/%s",
+ FALLBACK_XLIB_DIR, COMPOSE_DIR_FILE);
+ fp = fopen(compose_dir_file, "r");
+ if (fp == NULL) {
+ free(locale);
+ free(compose_dir_file);
+ return NULL;
+ }
+ xlib_dir = FALLBACK_XLIB_DIR;
+ } else {
+ free(locale);
+ free(compose_dir_file);
+ return NULL;
+ }
}
while (fgets(buf, XLC_BUFSIZE, fp) != NULL) {
- char *p = buf;
- int n;
- char *args[2], *from, *to;
- // isspace for tab doesn't seem to work with Qt4...
- while ((unsigned char)isspace(*p) || *p == '\t') {
- ++p;
- }
- if (iscomment(*p)) {
- continue;
- }
- n = parse_line(p, args, 2);
- if (n != 2) {
- continue;
- }
- from = args[1], to = args[0];
- if (!strcmp(from, locale)) {
- name = (char *)malloc(strlen(to) + 1);
- if (name != NULL) {
- strcpy(name, to);
- }
- break;
- }
+ char *p = buf;
+ int n;
+ char *args[2], *from, *to;
+ // isspace for tab doesn't seem to work with Qt4...
+ while ((unsigned char)isspace(*p) || *p == '\t') {
+ ++p;
+ }
+ if (iscomment(*p)) {
+ continue;
+ }
+ n = parse_line(p, args, 2);
+ if (n != 2) {
+ continue;
+ }
+ from = args[1], to = args[0];
+ if (!strcmp(from, locale)) {
+ name = (char *)malloc(strlen(to) + 1);
+ if (name != NULL) {
+ strcpy(name, to);
+ }
+ break;
+ }
}
fclose(fp);
free(locale);
free(compose_dir_file);
if (name == NULL)
- return NULL;
+ return NULL;
filename = (char *)malloc(strlen(xlib_dir) + strlen(XLOCALE_DIR) +
- strlen(name) + 3);
+ strlen(name) + 3);
if (filename == NULL)
- return NULL;
+ return NULL;
sprintf(filename, "%s/%s/%s", xlib_dir, XLOCALE_DIR, name);
free(name);
@@ -1057,28 +1057,28 @@ parse_line(char *line, char **argv, int argsize)
char *p = line;
while (argc < argsize) {
- // isspace for tab doesn't seem to work with Qt4...
- while ((unsigned char)isspace(*p) || *p == '\t') {
- ++p;
- }
- if (*p == '\0') {
- break;
- }
- argv[argc++] = p;
- while (*p != ':' && *p != '\n' && *p != '\0') {
- ++p;
- }
- if (*p == '\0') {
- break;
- }
- *p++ = '\0';
+ // isspace for tab doesn't seem to work with Qt4...
+ while ((unsigned char)isspace(*p) || *p == '\t') {
+ ++p;
+ }
+ if (*p == '\0') {
+ break;
+ }
+ argv[argc++] = p;
+ while (*p != ':' && *p != '\n' && *p != '\0') {
+ ++p;
+ }
+ if (*p == '\0') {
+ break;
+ }
+ *p++ = '\0';
}
return argc;
}
static unsigned short const keysym_to_unicode_1a1_1ff[] = {
- 0x0104, 0x02d8, 0x0141, 0x0000, 0x013d, 0x015a, 0x0000, /* 0x01a0-0x01a7 */
+ 0x0104, 0x02d8, 0x0141, 0x0000, 0x013d, 0x015a, 0x0000, /* 0x01a0-0x01a7 */
0x0000, 0x0160, 0x015e, 0x0164, 0x0179, 0x0000, 0x017d, 0x017b, /* 0x01a8-0x01af */
0x0000, 0x0105, 0x02db, 0x0142, 0x0000, 0x013e, 0x015b, 0x02c7, /* 0x01b0-0x01b7 */
0x0000, 0x0161, 0x015f, 0x0165, 0x017a, 0x02dd, 0x017e, 0x017c, /* 0x01b8-0x01bf */
@@ -1093,7 +1093,7 @@ static unsigned short const keysym_to_unicode_1a1_1ff[] = {
};
static unsigned short const keysym_to_unicode_2a1_2fe[] = {
- 0x0126, 0x0000, 0x0000, 0x0000, 0x0000, 0x0124, 0x0000, /* 0x02a0-0x02a7 */
+ 0x0126, 0x0000, 0x0000, 0x0000, 0x0000, 0x0124, 0x0000, /* 0x02a0-0x02a7 */
0x0000, 0x0130, 0x0000, 0x011e, 0x0134, 0x0000, 0x0000, 0x0000, /* 0x02a8-0x02af */
0x0000, 0x0127, 0x0000, 0x0000, 0x0000, 0x0000, 0x0125, 0x0000, /* 0x02b0-0x02b7 */
0x0000, 0x0131, 0x0000, 0x011f, 0x0135, 0x0000, 0x0000, 0x0000, /* 0x02b8-0x02bf */
@@ -1104,11 +1104,11 @@ static unsigned short const keysym_to_unicode_2a1_2fe[] = {
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x010b, 0x0109, 0x0000, /* 0x02e0-0x02e7 */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x02e8-0x02ef */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0121, 0x0000, 0x0000, /* 0x02f0-0x02f7 */
- 0x011d, 0x0000, 0x0000, 0x0000, 0x0000, 0x016d, 0x015d /* 0x02f8-0x02ff */
+ 0x011d, 0x0000, 0x0000, 0x0000, 0x0000, 0x016d, 0x015d /* 0x02f8-0x02ff */
};
static unsigned short const keysym_to_unicode_3a2_3fe[] = {
- 0x0138, 0x0156, 0x0000, 0x0128, 0x013b, 0x0000, /* 0x03a0-0x03a7 */
+ 0x0138, 0x0156, 0x0000, 0x0128, 0x013b, 0x0000, /* 0x03a0-0x03a7 */
0x0000, 0x0000, 0x0112, 0x0122, 0x0166, 0x0000, 0x0000, 0x0000, /* 0x03a8-0x03af */
0x0000, 0x0000, 0x0000, 0x0157, 0x0000, 0x0129, 0x013c, 0x0000, /* 0x03b0-0x03b7 */
0x0000, 0x0000, 0x0113, 0x0123, 0x0167, 0x014a, 0x0000, 0x014b, /* 0x03b8-0x03bf */
@@ -1119,11 +1119,11 @@ static unsigned short const keysym_to_unicode_3a2_3fe[] = {
0x0101, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x012f, /* 0x03e0-0x03e7 */
0x0000, 0x0000, 0x0000, 0x0000, 0x0117, 0x0000, 0x0000, 0x012b, /* 0x03e8-0x03ef */
0x0000, 0x0146, 0x014d, 0x0137, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x03f0-0x03f7 */
- 0x0000, 0x0173, 0x0000, 0x0000, 0x0000, 0x0169, 0x016b /* 0x03f8-0x03ff */
+ 0x0000, 0x0173, 0x0000, 0x0000, 0x0000, 0x0169, 0x016b /* 0x03f8-0x03ff */
};
static unsigned short const keysym_to_unicode_4a1_4df[] = {
- 0x3002, 0x3008, 0x3009, 0x3001, 0x30fb, 0x30f2, 0x30a1, /* 0x04a0-0x04a7 */
+ 0x3002, 0x3008, 0x3009, 0x3001, 0x30fb, 0x30f2, 0x30a1, /* 0x04a0-0x04a7 */
0x30a3, 0x30a5, 0x30a7, 0x30a9, 0x30e3, 0x30e5, 0x30e7, 0x30c3, /* 0x04a8-0x04af */
0x30fc, 0x30a2, 0x30a4, 0x30a6, 0x30a8, 0x30aa, 0x30ab, 0x30ad, /* 0x04b0-0x04b7 */
0x30af, 0x30b1, 0x30b3, 0x30b5, 0x30b7, 0x30b9, 0x30bb, 0x30bd, /* 0x04b8-0x04bf */
@@ -1137,7 +1137,7 @@ static unsigned short const keysym_to_unicode_590_5fe[] = {
0x06f0, 0x06f1, 0x06f2, 0x06f3, 0x06f4, 0x06f5, 0x06f6, 0x06f7, /* 0x0590-0x0597 */
0x06f8, 0x06f9, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x0598-0x059f */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x066a, 0x0670, 0x0679, /* 0x05a0-0x05a7 */
-
+
0x067e, 0x0686, 0x0688, 0x0691, 0x060c, 0x0000, 0x06d4, 0x0000, /* 0x05ac-0x05af */
0x0660, 0x0661, 0x0662, 0x0663, 0x0664, 0x0665, 0x0666, 0x0667, /* 0x05b0-0x05b7 */
0x0668, 0x0669, 0x0000, 0x061b, 0x0000, 0x0000, 0x0000, 0x061f, /* 0x05b8-0x05bf */
@@ -1148,7 +1148,7 @@ static unsigned short const keysym_to_unicode_590_5fe[] = {
0x0640, 0x0641, 0x0642, 0x0643, 0x0644, 0x0645, 0x0646, 0x0647, /* 0x05e0-0x05e7 */
0x0648, 0x0649, 0x064a, 0x064b, 0x064c, 0x064d, 0x064e, 0x064f, /* 0x05e8-0x05ef */
0x0650, 0x0651, 0x0652, 0x0653, 0x0654, 0x0655, 0x0698, 0x06a4, /* 0x05f0-0x05f7 */
- 0x06a9, 0x06af, 0x06ba, 0x06be, 0x06cc, 0x06d2, 0x06c1 /* 0x05f8-0x05fe */
+ 0x06a9, 0x06af, 0x06ba, 0x06be, 0x06cc, 0x06d2, 0x06c1 /* 0x05f8-0x05fe */
};
static unsigned short keysym_to_unicode_680_6ff[] = {
@@ -1171,7 +1171,7 @@ static unsigned short keysym_to_unicode_680_6ff[] = {
};
static unsigned short const keysym_to_unicode_7a1_7f9[] = {
- 0x0386, 0x0388, 0x0389, 0x038a, 0x03aa, 0x0000, 0x038c, /* 0x07a0-0x07a7 */
+ 0x0386, 0x0388, 0x0389, 0x038a, 0x03aa, 0x0000, 0x038c, /* 0x07a0-0x07a7 */
0x038e, 0x03ab, 0x0000, 0x038f, 0x0000, 0x0000, 0x0385, 0x2015, /* 0x07a8-0x07af */
0x0000, 0x03ac, 0x03ad, 0x03ae, 0x03af, 0x03ca, 0x0390, 0x03cc, /* 0x07b0-0x07b7 */
0x03cd, 0x03cb, 0x03b0, 0x03ce, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x07b8-0x07bf */
@@ -1182,11 +1182,11 @@ static unsigned short const keysym_to_unicode_7a1_7f9[] = {
0x0000, 0x03b1, 0x03b2, 0x03b3, 0x03b4, 0x03b5, 0x03b6, 0x03b7, /* 0x07e0-0x07e7 */
0x03b8, 0x03b9, 0x03ba, 0x03bb, 0x03bc, 0x03bd, 0x03be, 0x03bf, /* 0x07e8-0x07ef */
0x03c0, 0x03c1, 0x03c3, 0x03c2, 0x03c4, 0x03c5, 0x03c6, 0x03c7, /* 0x07f0-0x07f7 */
- 0x03c8, 0x03c9 /* 0x07f8-0x07ff */
+ 0x03c8, 0x03c9 /* 0x07f8-0x07ff */
};
static unsigned short const keysym_to_unicode_8a4_8fe[] = {
- 0x2320, 0x2321, 0x0000, 0x231c, /* 0x08a0-0x08a7 */
+ 0x2320, 0x2321, 0x0000, 0x231c, /* 0x08a0-0x08a7 */
0x231d, 0x231e, 0x231f, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x08a8-0x08af */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x08b0-0x08b7 */
0x0000, 0x0000, 0x0000, 0x0000, 0x2264, 0x2260, 0x2265, 0x222b, /* 0x08b8-0x08bf */
@@ -1197,19 +1197,19 @@ static unsigned short const keysym_to_unicode_8a4_8fe[] = {
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x08e0-0x08e7 */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x08e8-0x08ef */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0192, 0x0000, /* 0x08f0-0x08f7 */
- 0x0000, 0x0000, 0x0000, 0x2190, 0x2191, 0x2192, 0x2193 /* 0x08f8-0x08ff */
+ 0x0000, 0x0000, 0x0000, 0x2190, 0x2191, 0x2192, 0x2193 /* 0x08f8-0x08ff */
};
static unsigned short const keysym_to_unicode_9df_9f8[] = {
- 0x2422, /* 0x09d8-0x09df */
+ 0x2422, /* 0x09d8-0x09df */
0x2666, 0x25a6, 0x2409, 0x240c, 0x240d, 0x240a, 0x0000, 0x0000, /* 0x09e0-0x09e7 */
0x240a, 0x240b, 0x2518, 0x2510, 0x250c, 0x2514, 0x253c, 0x2500, /* 0x09e8-0x09ef */
0x0000, 0x0000, 0x0000, 0x0000, 0x251c, 0x2524, 0x2534, 0x252c, /* 0x09f0-0x09f7 */
- 0x2502 /* 0x09f8-0x09ff */
+ 0x2502 /* 0x09f8-0x09ff */
};
static unsigned short const keysym_to_unicode_aa1_afe[] = {
- 0x2003, 0x2002, 0x2004, 0x2005, 0x2007, 0x2008, 0x2009, /* 0x0aa0-0x0aa7 */
+ 0x2003, 0x2002, 0x2004, 0x2005, 0x2007, 0x2008, 0x2009, /* 0x0aa0-0x0aa7 */
0x200a, 0x2014, 0x2013, 0x0000, 0x0000, 0x0000, 0x2026, 0x2025, /* 0x0aa8-0x0aaf */
0x2153, 0x2154, 0x2155, 0x2156, 0x2157, 0x2158, 0x2159, 0x215a, /* 0x0ab0-0x0ab7 */
0x2105, 0x0000, 0x0000, 0x2012, 0x2039, 0x2024, 0x203a, 0x0000, /* 0x0ab8-0x0abf */
@@ -1220,21 +1220,21 @@ static unsigned short const keysym_to_unicode_aa1_afe[] = {
0x25e6, 0x25ab, 0x25ae, 0x25b5, 0x25bf, 0x2606, 0x2022, 0x25aa, /* 0x0ae0-0x0ae7 */
0x25b4, 0x25be, 0x261a, 0x261b, 0x2663, 0x2666, 0x2665, 0x0000, /* 0x0ae8-0x0aef */
0x2720, 0x2020, 0x2021, 0x2713, 0x2612, 0x266f, 0x266d, 0x2642, /* 0x0af0-0x0af7 */
- 0x2640, 0x2121, 0x2315, 0x2117, 0x2038, 0x201a, 0x201e /* 0x0af8-0x0aff */
+ 0x2640, 0x2121, 0x2315, 0x2117, 0x2038, 0x201a, 0x201e /* 0x0af8-0x0aff */
};
/* none of the APL keysyms match the Unicode characters */
static unsigned short const keysym_to_unicode_cdf_cfa[] = {
- 0x2017, /* 0x0cd8-0x0cdf */
+ 0x2017, /* 0x0cd8-0x0cdf */
0x05d0, 0x05d1, 0x05d2, 0x05d3, 0x05d4, 0x05d5, 0x05d6, 0x05d7, /* 0x0ce0-0x0ce7 */
0x05d8, 0x05d9, 0x05da, 0x05db, 0x05dc, 0x05dd, 0x05de, 0x05df, /* 0x0ce8-0x0cef */
0x05e0, 0x05e1, 0x05e2, 0x05e3, 0x05e4, 0x05e5, 0x05e6, 0x05e7, /* 0x0cf0-0x0cf7 */
- 0x05e8, 0x05e9, 0x05ea /* 0x0cf8-0x0cff */
+ 0x05e8, 0x05e9, 0x05ea /* 0x0cf8-0x0cff */
};
static unsigned short const keysym_to_unicode_da1_df9[] = {
- 0x0e01, 0x0e02, 0x0e03, 0x0e04, 0x0e05, 0x0e06, 0x0e07, /* 0x0da0-0x0da7 */
+ 0x0e01, 0x0e02, 0x0e03, 0x0e04, 0x0e05, 0x0e06, 0x0e07, /* 0x0da0-0x0da7 */
0x0e08, 0x0e09, 0x0e0a, 0x0e0b, 0x0e0c, 0x0e0d, 0x0e0e, 0x0e0f, /* 0x0da8-0x0daf */
0x0e10, 0x0e11, 0x0e12, 0x0e13, 0x0e14, 0x0e15, 0x0e16, 0x0e17, /* 0x0db0-0x0db7 */
0x0e18, 0x0e19, 0x0e1a, 0x0e1b, 0x0e1c, 0x0e1d, 0x0e1e, 0x0e1f, /* 0x0db8-0x0dbf */
@@ -1245,7 +1245,7 @@ static unsigned short const keysym_to_unicode_da1_df9[] = {
0x0e40, 0x0e41, 0x0e42, 0x0e43, 0x0e44, 0x0e45, 0x0e46, 0x0e47, /* 0x0de0-0x0de7 */
0x0e48, 0x0e49, 0x0e4a, 0x0e4b, 0x0e4c, 0x0e4d, 0x0000, 0x0000, /* 0x0de8-0x0def */
0x0e50, 0x0e51, 0x0e52, 0x0e53, 0x0e54, 0x0e55, 0x0e56, 0x0e57, /* 0x0df0-0x0df7 */
- 0x0e58, 0x0e59 /* 0x0df8-0x0dff */
+ 0x0e58, 0x0e59 /* 0x0df8-0x0dff */
};
static unsigned short const keysym_to_unicode_ea0_eff[] = {
@@ -1264,7 +1264,7 @@ static unsigned short const keysym_to_unicode_ea0_eff[] = {
};
static unsigned short keysym_to_unicode_12a1_12fe[] = {
- 0x1e02, 0x1e03, 0x0000, 0x0000, 0x0000, 0x1e0a, 0x0000, /* 0x12a0-0x12a7 */
+ 0x1e02, 0x1e03, 0x0000, 0x0000, 0x0000, 0x1e0a, 0x0000, /* 0x12a0-0x12a7 */
0x1e80, 0x0000, 0x1e82, 0x1e0b, 0x1ef2, 0x0000, 0x0000, 0x0000, /* 0x12a8-0x12af */
0x1e1e, 0x1e1f, 0x0000, 0x0000, 0x1e40, 0x1e41, 0x0000, 0x1e56, /* 0x12b0-0x12b7 */
0x1e81, 0x1e57, 0x1e83, 0x1e60, 0x1ef3, 0x1e84, 0x1e85, 0x1e61, /* 0x12b8-0x12bf */
@@ -1275,15 +1275,15 @@ static unsigned short keysym_to_unicode_12a1_12fe[] = {
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x12e0-0x12e7 */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x12e8-0x12ef */
0x0175, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x1e6b, /* 0x12f0-0x12f7 */
- 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0177 /* 0x12f0-0x12ff */
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0177 /* 0x12f0-0x12ff */
};
-
+
static unsigned short const keysym_to_unicode_13bc_13be[] = {
- 0x0152, 0x0153, 0x0178 /* 0x13b8-0x13bf */
+ 0x0152, 0x0153, 0x0178 /* 0x13b8-0x13bf */
};
static unsigned short keysym_to_unicode_14a1_14ff[] = {
- 0x2741, 0x00a7, 0x0589, 0x0029, 0x0028, 0x00bb, 0x00ab, /* 0x14a0-0x14a7 */
+ 0x2741, 0x00a7, 0x0589, 0x0029, 0x0028, 0x00bb, 0x00ab, /* 0x14a0-0x14a7 */
0x2014, 0x002e, 0x055d, 0x002c, 0x2013, 0x058a, 0x2026, 0x055c, /* 0x14a8-0x14af */
0x055b, 0x055e, 0x0531, 0x0561, 0x0532, 0x0562, 0x0533, 0x0563, /* 0x14b0-0x14b7 */
0x0534, 0x0564, 0x0535, 0x0565, 0x0536, 0x0566, 0x0537, 0x0567, /* 0x14b8-0x14bf */
@@ -1302,7 +1302,7 @@ static unsigned short keysym_to_unicode_15d0_15f6[] = {
0x10d8, 0x10d9, 0x10da, 0x10db, 0x10dc, 0x10dd, 0x10de, 0x10df, /* 0x15d8-0x15df */
0x10e0, 0x10e1, 0x10e2, 0x10e3, 0x10e4, 0x10e5, 0x10e6, 0x10e7, /* 0x15e0-0x15e7 */
0x10e8, 0x10e9, 0x10ea, 0x10eb, 0x10ec, 0x10ed, 0x10ee, 0x10ef, /* 0x15e8-0x15ef */
- 0x10f0, 0x10f1, 0x10f2, 0x10f3, 0x10f4, 0x10f5, 0x10f6 /* 0x15f0-0x15f7 */
+ 0x10f0, 0x10f1, 0x10f2, 0x10f3, 0x10f4, 0x10f5, 0x10f6 /* 0x15f0-0x15f7 */
};
static unsigned short keysym_to_unicode_16a0_16f6[] = {
@@ -1316,11 +1316,11 @@ static unsigned short keysym_to_unicode_16a0_16f6[] = {
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x16d8-0x16df */
0x0000, 0x1e37, 0xf0e2, 0xf0e3, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x16e0-0x16e7 */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x16e8-0x16ef */
- 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0259 /* 0x16f0-0x16f6 */
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0259 /* 0x16f0-0x16f6 */
};
static unsigned short const keysym_to_unicode_1e9f_1eff[] = {
- 0x0303,
+ 0x0303,
0x1ea0, 0x1ea1, 0x1ea2, 0x1ea3, 0x1ea4, 0x1ea5, 0x1ea6, 0x1ea7, /* 0x1ea0-0x1ea7 */
0x1ea8, 0x1ea9, 0x1eaa, 0x1eab, 0x1eac, 0x1ead, 0x1eae, 0x1eaf, /* 0x1ea8-0x1eaf */
0x1eb0, 0x1eb1, 0x1eb2, 0x1eb3, 0x1eb4, 0x1eb5, 0x1eb6, 0x1eb7, /* 0x1eb0-0x1eb7 */
@@ -1337,7 +1337,7 @@ static unsigned short const keysym_to_unicode_1e9f_1eff[] = {
static unsigned short const keysym_to_unicode_20a0_20ac[] = {
0x20a0, 0x20a1, 0x20a2, 0x20a3, 0x20a4, 0x20a5, 0x20a6, 0x20a7, /* 0x20a0-0x20a7 */
- 0x20a8, 0x20a9, 0x20aa, 0x20ab, 0x20ac /* 0x20a8-0x20af */
+ 0x20a8, 0x20a9, 0x20aa, 0x20ab, 0x20ac /* 0x20a8-0x20af */
};
static unsigned int
@@ -1345,52 +1345,52 @@ KeySymToUcs4(KeySym keysym)
{
/* 'Unicode keysym' */
if ((keysym & 0xff000000) == 0x01000000)
- return (keysym & 0x00ffffff);
+ return (keysym & 0x00ffffff);
if (keysym > 0 && keysym < 0x100)
- return keysym;
+ return keysym;
else if (keysym > 0x1a0 && keysym < 0x200)
- return keysym_to_unicode_1a1_1ff[keysym - 0x1a1];
+ return keysym_to_unicode_1a1_1ff[keysym - 0x1a1];
else if (keysym > 0x2a0 && keysym < 0x2ff)
- return keysym_to_unicode_2a1_2fe[keysym - 0x2a1];
+ return keysym_to_unicode_2a1_2fe[keysym - 0x2a1];
else if (keysym > 0x3a1 && keysym < 0x3ff)
- return keysym_to_unicode_3a2_3fe[keysym - 0x3a2];
+ return keysym_to_unicode_3a2_3fe[keysym - 0x3a2];
else if (keysym > 0x4a0 && keysym < 0x4e0)
- return keysym_to_unicode_4a1_4df[keysym - 0x4a1];
+ return keysym_to_unicode_4a1_4df[keysym - 0x4a1];
else if (keysym > 0x589 && keysym < 0x5ff)
- return keysym_to_unicode_590_5fe[keysym - 0x590];
+ return keysym_to_unicode_590_5fe[keysym - 0x590];
else if (keysym > 0x67f && keysym < 0x700)
- return keysym_to_unicode_680_6ff[keysym - 0x680];
+ return keysym_to_unicode_680_6ff[keysym - 0x680];
else if (keysym > 0x7a0 && keysym < 0x7fa)
- return keysym_to_unicode_7a1_7f9[keysym - 0x7a1];
+ return keysym_to_unicode_7a1_7f9[keysym - 0x7a1];
else if (keysym > 0x8a3 && keysym < 0x8ff)
- return keysym_to_unicode_8a4_8fe[keysym - 0x8a4];
+ return keysym_to_unicode_8a4_8fe[keysym - 0x8a4];
else if (keysym > 0x9de && keysym < 0x9f9)
- return keysym_to_unicode_9df_9f8[keysym - 0x9df];
+ return keysym_to_unicode_9df_9f8[keysym - 0x9df];
else if (keysym > 0xaa0 && keysym < 0xaff)
- return keysym_to_unicode_aa1_afe[keysym - 0xaa1];
+ return keysym_to_unicode_aa1_afe[keysym - 0xaa1];
else if (keysym > 0xcde && keysym < 0xcfb)
- return keysym_to_unicode_cdf_cfa[keysym - 0xcdf];
+ return keysym_to_unicode_cdf_cfa[keysym - 0xcdf];
else if (keysym > 0xda0 && keysym < 0xdfa)
- return keysym_to_unicode_da1_df9[keysym - 0xda1];
+ return keysym_to_unicode_da1_df9[keysym - 0xda1];
else if (keysym > 0xe9f && keysym < 0xf00)
- return keysym_to_unicode_ea0_eff[keysym - 0xea0];
+ return keysym_to_unicode_ea0_eff[keysym - 0xea0];
else if (keysym > 0x12a0 && keysym < 0x12ff)
- return keysym_to_unicode_12a1_12fe[keysym - 0x12a1];
+ return keysym_to_unicode_12a1_12fe[keysym - 0x12a1];
else if (keysym > 0x13bb && keysym < 0x13bf)
- return keysym_to_unicode_13bc_13be[keysym - 0x13bc];
+ return keysym_to_unicode_13bc_13be[keysym - 0x13bc];
else if (keysym > 0x14a0 && keysym < 0x1500)
- return keysym_to_unicode_14a1_14ff[keysym - 0x14a1];
+ return keysym_to_unicode_14a1_14ff[keysym - 0x14a1];
else if (keysym > 0x15cf && keysym < 0x15f7)
- return keysym_to_unicode_15d0_15f6[keysym - 0x15d0];
+ return keysym_to_unicode_15d0_15f6[keysym - 0x15d0];
else if (keysym > 0x169f && keysym < 0x16f7)
- return keysym_to_unicode_16a0_16f6[keysym - 0x16a0];
+ return keysym_to_unicode_16a0_16f6[keysym - 0x16a0];
else if (keysym > 0x1e9e && keysym < 0x1f00)
- return keysym_to_unicode_1e9f_1eff[keysym - 0x1e9f];
+ return keysym_to_unicode_1e9f_1eff[keysym - 0x1e9f];
else if (keysym > 0x209f && keysym < 0x20ad)
- return keysym_to_unicode_20a0_20ac[keysym - 0x20a0];
+ return keysym_to_unicode_20a0_20ac[keysym - 0x20a0];
else
- return 0;
+ return 0;
}
/*
diff --git a/qt4/immodule/quiminputcontext_compose.h b/qt4/immodule/quiminputcontext_compose.h
index 5fdc185..260cdd3 100644
--- a/qt4/immodule/quiminputcontext_compose.h
+++ b/qt4/immodule/quiminputcontext_compose.h
@@ -46,14 +46,14 @@
class QKeyEvent;
typedef struct _DefTree {
- struct _DefTree *next; /* another Key definition */
- struct _DefTree *succession; /* successive Key Sequence */
- /* Key definitions */
+ struct _DefTree *next; /* another Key definition */
+ struct _DefTree *succession; /* successive Key Sequence */
+ /* Key definitions */
unsigned modifier_mask;
unsigned modifier;
- KeySym keysym; /* leaf only */
+ KeySym keysym; /* leaf only */
char *mb;
- char *utf8; /* make from mb */
+ char *utf8; /* make from mb */
KeySym ks;
} DefTree;
--
1.6.4.2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment