Use private connection for our im module so we don't conflict with krita.
See also: https://bugs.kde.org/show_bug.cgi?id=408015
This commit is contained in:
parent
0537c17fce
commit
8333ab1b7c
|
@ -1,2 +1,2 @@
|
|||
#!/bin/sh
|
||||
find . \( -not \( -name '*proxy.h' -o -name '*proxy.cpp' \) \) -a \( -name '*.h' -o -name '*.cpp' \) | xargs clang-format -i
|
||||
find . \( -not \( -name '*proxy.h' -o -name '*proxy.cpp' -o -name 'moc_*.cpp' \) \) -a \( -name '*.h' -o -name '*.cpp' \) | xargs clang-format -i
|
||||
|
|
|
@ -94,13 +94,12 @@ void FcitxQtWatcher::watch() {
|
|||
d->serviceWatcher_.addWatchedService(FCITX_PORTAL_SERVICE_NAME);
|
||||
}
|
||||
|
||||
if (QDBusConnection::sessionBus().interface()->isServiceRegistered(
|
||||
if (connection().interface()->isServiceRegistered(
|
||||
FCITX_MAIN_SERVICE_NAME)) {
|
||||
d->mainPresent_ = true;
|
||||
}
|
||||
if (d->watchPortal_ &&
|
||||
QDBusConnection::sessionBus().interface()->isServiceRegistered(
|
||||
FCITX_PORTAL_SERVICE_NAME)) {
|
||||
if (d->watchPortal_ && connection().interface()->isServiceRegistered(
|
||||
FCITX_PORTAL_SERVICE_NAME)) {
|
||||
d->portalPresent_ = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -22,10 +22,6 @@
|
|||
|
||||
namespace fcitx {
|
||||
|
||||
QStringList QFcitxPlatformInputContextPlugin::keys() const {
|
||||
return QStringList{QStringLiteral("fcitx5"), QStringLiteral("fcitx")};
|
||||
}
|
||||
|
||||
QFcitxPlatformInputContext *
|
||||
QFcitxPlatformInputContextPlugin::create(const QString &system,
|
||||
const QStringList ¶mList) {
|
||||
|
|
|
@ -30,12 +30,11 @@ namespace fcitx {
|
|||
|
||||
class QFcitxPlatformInputContextPlugin : public QPlatformInputContextPlugin {
|
||||
Q_OBJECT
|
||||
public:
|
||||
Q_PLUGIN_METADATA(IID QPlatformInputContextFactoryInterface_iid FILE
|
||||
"fcitx.json")
|
||||
QStringList keys() const;
|
||||
public:
|
||||
QFcitxPlatformInputContext *create(const QString &system,
|
||||
const QStringList ¶mList);
|
||||
const QStringList ¶mList) override;
|
||||
};
|
||||
} // namespace fcitx
|
||||
|
||||
|
|
|
@ -159,7 +159,9 @@ struct xkb_context *_xkb_context_new_helper() {
|
|||
}
|
||||
|
||||
QFcitxPlatformInputContext::QFcitxPlatformInputContext()
|
||||
: watcher_(new FcitxQtWatcher(QDBusConnection::sessionBus(), this)),
|
||||
: watcher_(new FcitxQtWatcher(
|
||||
QDBusConnection::connectToBus(QDBusConnection::SessionBus, "fcitx"),
|
||||
this)),
|
||||
cursorPos_(0), useSurroundingText_(false),
|
||||
syncMode_(get_boolean_env("FCITX_QT_USE_SYNC", false)), destroy_(false),
|
||||
xkbContext_(_xkb_context_new_helper()),
|
||||
|
@ -363,7 +365,7 @@ void QFcitxPlatformInputContext::setFocusObject(QObject *object) {
|
|||
|
||||
void QFcitxPlatformInputContext::windowDestroyed(QObject *object) {
|
||||
/* access QWindow is not possible here, so we use our own map to do so */
|
||||
icMap_.erase(reinterpret_cast<QWindow *>(object));
|
||||
icMap_.erase(static_cast<QWindow *>(object));
|
||||
// qDebug() << "Window Destroyed and we destroy IC correctly, horray!";
|
||||
}
|
||||
|
||||
|
@ -407,8 +409,7 @@ void QFcitxPlatformInputContext::createInputContextFinished(
|
|||
if (!proxy) {
|
||||
return;
|
||||
}
|
||||
auto w =
|
||||
reinterpret_cast<QWindow *>(proxy->property("wid").value<void *>());
|
||||
auto w = static_cast<QWindow *>(proxy->property("wid").value<void *>());
|
||||
FcitxQtICData *data =
|
||||
static_cast<FcitxQtICData *>(proxy->property("icData").value<void *>());
|
||||
data->rect = QRect();
|
||||
|
@ -448,6 +449,7 @@ void QFcitxPlatformInputContext::updateCapability(const FcitxQtICData &data) {
|
|||
}
|
||||
|
||||
void QFcitxPlatformInputContext::commitString(const QString &str) {
|
||||
qDebug() << "COMMIT" << str;
|
||||
cursorPos_ = 0;
|
||||
preeditList_.clear();
|
||||
commitPreedit_.clear();
|
||||
|
@ -609,6 +611,10 @@ void QFcitxPlatformInputContext::updateCurrentIM(const QString &name,
|
|||
|
||||
QLocale QFcitxPlatformInputContext::locale() const { return locale_; }
|
||||
|
||||
bool QFcitxPlatformInputContext::hasCapability(Capability) const {
|
||||
return true;
|
||||
}
|
||||
|
||||
void QFcitxPlatformInputContext::createICData(QWindow *w) {
|
||||
auto iter = icMap_.find(w);
|
||||
if (iter == icMap_.end()) {
|
||||
|
@ -877,5 +883,3 @@ bool QFcitxPlatformInputContext::processCompose(uint keyval, uint state,
|
|||
return true;
|
||||
}
|
||||
} // namespace fcitx
|
||||
|
||||
// kate: indent-mode cstyle; space-indent on; indent-width 0;
|
||||
|
|
|
@ -103,16 +103,17 @@ public:
|
|||
QFcitxPlatformInputContext();
|
||||
virtual ~QFcitxPlatformInputContext();
|
||||
|
||||
bool filterEvent(const QEvent *event) override;
|
||||
bool isValid() const override;
|
||||
void setFocusObject(QObject *object) override;
|
||||
void invokeAction(QInputMethod::Action, int cursorPosition) override;
|
||||
void reset() override;
|
||||
void commit() override;
|
||||
void update(Qt::InputMethodQueries quries) override;
|
||||
void setFocusObject(QObject *object) override;
|
||||
bool filterEvent(const QEvent *event) override;
|
||||
QLocale locale() const override;
|
||||
bool hasCapability(Capability capability) const override;
|
||||
|
||||
public Q_SLOTS:
|
||||
public slots:
|
||||
void cursorRectChanged();
|
||||
void commitString(const QString &str);
|
||||
void updateFormattedPreedit(const FcitxQtFormattedPreeditList &preeditList,
|
||||
|
@ -124,6 +125,8 @@ public Q_SLOTS:
|
|||
void windowDestroyed(QObject *object);
|
||||
void updateCurrentIM(const QString &name, const QString &uniqueName,
|
||||
const QString &langCode);
|
||||
private slots:
|
||||
void processKeyEventFinished(QDBusPendingCallWatcher *);
|
||||
|
||||
private:
|
||||
bool processCompose(uint keyval, uint state, bool isRelaese);
|
||||
|
@ -173,8 +176,6 @@ private:
|
|||
QScopedPointer<struct xkb_compose_state, XkbComposeStateDeleter>
|
||||
xkbComposeState_;
|
||||
QLocale locale_;
|
||||
private slots:
|
||||
void processKeyEventFinished(QDBusPendingCallWatcher *);
|
||||
};
|
||||
} // namespace fcitx
|
||||
|
||||
|
|
Loading…
Reference in New Issue