add support of virtualkeyboard show and hide
This commit is contained in:
parent
e3b2cd18f1
commit
1976eeb2df
|
@ -47,6 +47,11 @@ QDBusPendingReply<> FcitxQtInputContextProxy::focusOut() {
|
|||
return d->icproxy_->FocusOut();
|
||||
}
|
||||
|
||||
QDBusPendingReply<> FcitxQtInputContextProxy::hideVirtualKeyboard() {
|
||||
Q_D(FcitxQtInputContextProxy);
|
||||
return d->icproxy_->HideVirtualKeyboard();
|
||||
}
|
||||
|
||||
QDBusPendingReply<bool> FcitxQtInputContextProxy::processKeyEvent(
|
||||
unsigned int keyval, unsigned int keycode, unsigned int state, bool type,
|
||||
unsigned int time) {
|
||||
|
@ -90,6 +95,11 @@ FcitxQtInputContextProxy::setSurroundingTextPosition(unsigned int cursor,
|
|||
return d->icproxy_->SetSurroundingTextPosition(cursor, anchor);
|
||||
}
|
||||
|
||||
QDBusPendingReply<> FcitxQtInputContextProxy::showVirtualKeyboard() {
|
||||
Q_D(FcitxQtInputContextProxy);
|
||||
return d->icproxy_->ShowVirtualKeyboard();
|
||||
}
|
||||
|
||||
QDBusPendingReply<> FcitxQtInputContextProxy::prevPage() {
|
||||
Q_D(FcitxQtInputContextProxy);
|
||||
return d->icproxy_->PrevPage();
|
||||
|
@ -111,6 +121,11 @@ QDBusPendingReply<> FcitxQtInputContextProxy::invokeAction(unsigned int action,
|
|||
return d->icproxy_->InvokeAction(action, cursor);
|
||||
}
|
||||
|
||||
QDBusPendingReply<bool> FcitxQtInputContextProxy::isVirtualKeyboardVisible() {
|
||||
Q_D(FcitxQtInputContextProxy);
|
||||
return d->icproxy_->IsVirtualKeyboardVisible();
|
||||
}
|
||||
|
||||
bool FcitxQtInputContextProxy::supportInvokeAction() const {
|
||||
Q_D(const FcitxQtInputContextProxy);
|
||||
return d->supportInvokeAction_;
|
||||
|
|
|
@ -35,6 +35,7 @@ public:
|
|||
public Q_SLOTS:
|
||||
QDBusPendingReply<> focusIn();
|
||||
QDBusPendingReply<> focusOut();
|
||||
QDBusPendingReply<> hideVirtualKeyboard();
|
||||
QDBusPendingReply<bool> processKeyEvent(unsigned int keyval,
|
||||
unsigned int keycode,
|
||||
unsigned int state, bool type,
|
||||
|
@ -49,10 +50,12 @@ public Q_SLOTS:
|
|||
unsigned int anchor);
|
||||
QDBusPendingReply<> setSurroundingTextPosition(unsigned int cursor,
|
||||
unsigned int anchor);
|
||||
QDBusPendingReply<> showVirtualKeyboard();
|
||||
QDBusPendingReply<> prevPage();
|
||||
QDBusPendingReply<> nextPage();
|
||||
QDBusPendingReply<> selectCandidate(int i);
|
||||
QDBusPendingReply<> invokeAction(unsigned int action, int cursor);
|
||||
QDBusPendingReply<bool> isVirtualKeyboardVisible();
|
||||
|
||||
bool supportInvokeAction() const;
|
||||
|
||||
|
|
|
@ -58,6 +58,12 @@ public Q_SLOTS: // METHODS
|
|||
return asyncCallWithArgumentList(QStringLiteral("FocusOut"), argumentList);
|
||||
}
|
||||
|
||||
inline QDBusPendingReply<> HideVirtualKeyboard()
|
||||
{
|
||||
QList<QVariant> argumentList;
|
||||
return asyncCallWithArgumentList(QStringLiteral("HideVirtualKeyboard"), argumentList);
|
||||
}
|
||||
|
||||
inline QDBusPendingReply<> InvokeAction(unsigned int action, int cursor) {
|
||||
QList<QVariant> argumentList;
|
||||
argumentList << QVariant::fromValue(action)
|
||||
|
@ -66,6 +72,12 @@ public Q_SLOTS: // METHODS
|
|||
argumentList);
|
||||
}
|
||||
|
||||
inline QDBusPendingReply<bool> IsVirtualKeyboardVisible()
|
||||
{
|
||||
QList<QVariant> argumentList;
|
||||
return asyncCallWithArgumentList(QStringLiteral("IsVirtualKeyboardVisible"), argumentList);
|
||||
}
|
||||
|
||||
inline QDBusPendingReply<> NextPage()
|
||||
{
|
||||
QList<QVariant> argumentList;
|
||||
|
@ -135,6 +147,12 @@ public Q_SLOTS: // METHODS
|
|||
return asyncCallWithArgumentList(QStringLiteral("SetSurroundingTextPosition"), argumentList);
|
||||
}
|
||||
|
||||
inline QDBusPendingReply<> ShowVirtualKeyboard()
|
||||
{
|
||||
QList<QVariant> argumentList;
|
||||
return asyncCallWithArgumentList(QStringLiteral("ShowVirtualKeyboard"), argumentList);
|
||||
}
|
||||
|
||||
Q_SIGNALS: // SIGNALS
|
||||
void CommitString(const QString &str);
|
||||
void CurrentIM(const QString &name, const QString &uniqueName, const QString &langCode);
|
||||
|
|
|
@ -54,6 +54,13 @@
|
|||
<arg name="action" direction="in" type="u"/>
|
||||
<arg name="cursor" direction="in" type="i"/>
|
||||
</method>
|
||||
<method name="ShowVirtualKeyboard">
|
||||
</method>
|
||||
<method name="HideVirtualKeyboard">
|
||||
</method>
|
||||
<method name="IsVirtualKeyboardVisible">
|
||||
<arg type="b" direction="out"/>
|
||||
</method>
|
||||
<signal name="CommitString">
|
||||
<arg name="str" type="s"/>
|
||||
</signal>
|
||||
|
|
|
@ -688,6 +688,32 @@ bool QFcitxPlatformInputContext::hasCapability(Capability) const {
|
|||
return true;
|
||||
}
|
||||
|
||||
void QFcitxPlatformInputContext::showInputPanel() {
|
||||
auto *proxy = validIC();
|
||||
if (proxy == nullptr) {
|
||||
return;
|
||||
}
|
||||
proxy->showVirtualKeyboard();
|
||||
}
|
||||
|
||||
void QFcitxPlatformInputContext::hideInputPanel() {
|
||||
auto *proxy = validIC();
|
||||
if (proxy == nullptr) {
|
||||
return;
|
||||
}
|
||||
proxy->hideVirtualKeyboard();
|
||||
}
|
||||
|
||||
bool QFcitxPlatformInputContext::isInputPanelVisible() const {
|
||||
auto *proxy = const_cast<QFcitxPlatformInputContext *>(this)->validIC();
|
||||
if (proxy == nullptr) {
|
||||
return false;
|
||||
}
|
||||
auto reply = proxy->isVirtualKeyboardVisible();
|
||||
reply.waitForFinished();
|
||||
return reply.value();
|
||||
}
|
||||
|
||||
void QFcitxPlatformInputContext::createICData(QWindow *w) {
|
||||
auto iter = icMap_.find(w);
|
||||
if (iter == icMap_.end()) {
|
||||
|
|
|
@ -155,6 +155,9 @@ public:
|
|||
bool filterEvent(const QEvent *event) override;
|
||||
QLocale locale() const override;
|
||||
bool hasCapability(Capability capability) const override;
|
||||
virtual void showInputPanel() override;
|
||||
virtual void hideInputPanel() override;
|
||||
virtual bool isInputPanelVisible() const override;
|
||||
|
||||
public Q_SLOTS:
|
||||
void cursorRectChanged();
|
||||
|
|
Loading…
Reference in New Issue