Skip to content
Permalink
Browse files

Merge pull request #85 from dai-vdr/fix-qt5-candwin-infinite-loop

Fix qt5 candwin infinite loop, closes#30
  • Loading branch information...
dai-vdr committed Jun 10, 2016
2 parents 108a501 + 7c821df commit 590a909ac6a2445ad5539f60956ad5b9fca32a26
@@ -50,7 +50,7 @@ const Qt::WindowFlags candidateFlag = (Qt::Window
| Qt::WindowStaysOnTopHint
| Qt::FramelessWindowHint
| Qt::Tool
#if defined(Q_WS_X11)
#if defined(Q_WS_X11) || defined(Q_OS_UNIX)
| Qt::X11BypassWindowManagerHint
#endif
);
@@ -51,7 +51,7 @@ const Qt::WindowFlags subwindowFlag = (Qt::Window
| Qt::WindowStaysOnTopHint
| Qt::FramelessWindowHint
| Qt::Tool
#if defined(Q_WS_X11)
#if defined(Q_WS_X11) || defined(Q_OS_UNIX)
| Qt::X11BypassWindowManagerHint
#endif
);
@@ -73,7 +73,7 @@ const Qt::WindowFlags candidateFlag = (Qt::Window
| Qt::WindowStaysOnTopHint
| Qt::FramelessWindowHint
| Qt::Tool
#if defined(Q_WS_X11)
#if defined(Q_WS_X11) || defined(Q_OS_UNIX)
| Qt::X11BypassWindowManagerHint
#endif
);
@@ -297,8 +297,8 @@ void CandidateWindowProxy::initializeProcess()
if (process->state() != QProcess::NotRunning) {
return;
}
process->close();
QString style = candidateWindowStyle();
qputenv("__UIM_CANDWIN_CALLED", QByteArray("STARTED"));
#if QT_VERSION < 0x050000
process->start(UIM_LIBEXECDIR "/uim-candwin-qt4", QStringList() << style);
#else
@@ -556,6 +556,8 @@ void CandidateWindowProxy::preparePageCandidates(int page)

void CandidateWindowProxy::setFocusWidget()
{
if (QApplication::focusWidget() == NULL)
return;
window = QApplication::focusWidget()->window();
window->installEventFilter(this);
}
@@ -96,6 +96,9 @@ QInputContext *UimInputContextPlugin::create( const QString & key )
QPlatformInputContext *UimInputContextPlugin::create( const QString & key, const QStringList & paramList )
#endif
{
if (qgetenv("__UIM_CANDWIN_CALLED") == QByteArray("STARTED"))
return NULL;

#if QT_VERSION >= 0x050000
Q_UNUSED(paramList);
#endif
@@ -143,7 +143,7 @@ QUimTextUtil::acquirePrimaryText( enum UTextOrigin origin,
char **former, char **latter )
{
int err;
#if defined(Q_WS_X11)
#if defined(Q_WS_X11) || defined(Q_OS_UNIX)
mWidget = QApplication::focusWidget();
#else
return -1;
@@ -551,7 +551,7 @@ QUimTextUtil::acquireSelectionText( enum UTextOrigin origin,
char **former, char **latter )
{
int err;
#if defined(Q_WS_X11)
#if defined(Q_WS_X11) || defined(Q_OS_UNIX)
mWidget = QApplication::focusWidget();
#else
return -1;
@@ -821,7 +821,7 @@ QUimTextUtil::deletePrimaryText( enum UTextOrigin origin, int former_req_len,
int latter_req_len )
{
int err;
#if defined(Q_WS_X11)
#if defined(Q_WS_X11) || defined(Q_OS_UNIX)
mWidget = QApplication::focusWidget();
#else
return -1;
@@ -1130,7 +1130,7 @@ QUimTextUtil::deleteSelectionText( enum UTextOrigin origin,
int former_req_len, int latter_req_len )
{
int err;
#if defined(Q_WS_X11)
#if defined(Q_WS_X11) || defined(Q_OS_UNIX)
mWidget = QApplication::focusWidget();
#else
return -1;
@@ -526,7 +526,7 @@ modmask(char *name)
return(mask);
}

#ifdef Q_WS_X11
#if defined(Q_WS_X11)
int
QUimInputContext::TransFileName(char *transname, const char *name, size_t len)
{
@@ -224,7 +224,7 @@ bool QUimPlatformInputContext::filterEvent(const QEvent *event)
modifier |= UMod_Control;
if (keyevent->modifiers() & Qt::AltModifier)
modifier |= UMod_Alt;
#if defined(Q_WS_X11)
#if defined(Q_WS_X11) || defined(Q_OS_UNIX)
if (keyevent->modifiers() & Qt::MetaModifier)
modifier |= UMod_Meta;
#endif
@@ -338,7 +338,7 @@ bool QUimPlatformInputContext::filterEvent(const QEvent *event)
modifier &= ~UMod_Alt;
break;
case Qt::Key_Meta: key = UKey_Meta_key;
#ifdef Q_WS_X11
#if defined(Q_WS_X11) || defined(Q_OS_UNIX)
if (type == QEvent::KeyPress)
modifier &= ~UMod_Meta;
#endif
@@ -76,6 +76,7 @@ class QUimPlatformInputContext : public QPlatformInputContext
virtual void reset();
virtual void showInputPanel();
virtual void update(Qt::InputMethodQueries);
virtual void setFocusObject(QObject *object);

uim_context uimContext() { return m_uc; }

@@ -99,7 +100,6 @@ class QUimPlatformInputContext : public QPlatformInputContext
private:
uim_context createUimContext(const char *imname);
void createCandidateWindow();
void setFocusObject(QObject *object);
void setFocus();
void unsetFocus();

0 comments on commit 590a909

Please sign in to comment.
You can’t perform that action at this time.