Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The virtual keyboard should show or hide automatically if enabled #1086

Merged
merged 1 commit into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 7 additions & 10 deletions src/lib/fcitx/instance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1042,11 +1042,9 @@ Instance::Instance(int argc, char **argv) {

activateInputMethod(icEvent);

if (virtualKeyboardAutoShow()) {
auto *inputContext = icEvent.inputContext();
if (!inputContext->clientControlVirtualkeyboardShow()) {
inputContext->showVirtualKeyboard();
}
auto *inputContext = icEvent.inputContext();
if (!inputContext->clientControlVirtualkeyboardShow()) {
inputContext->showVirtualKeyboard();
}

if (!d->globalConfig_.showInputMethodInformationWhenFocusIn() ||
Expand Down Expand Up @@ -1091,11 +1089,10 @@ Instance::Instance(int argc, char **argv) {
d->lastUnFocusedProgram_ = icEvent.inputContext()->program();
d->lastUnFocusedIc_ = icEvent.inputContext()->watch();
deactivateInputMethod(icEvent);
if (virtualKeyboardAutoHide()) {
auto *inputContext = icEvent.inputContext();
if (!inputContext->clientControlVirtualkeyboardHide()) {
inputContext->hideVirtualKeyboard();
}

auto *inputContext = icEvent.inputContext();
if (!inputContext->clientControlVirtualkeyboardHide()) {
inputContext->hideVirtualKeyboard();
}
}));
d->eventWatchers_.emplace_back(d->watchEvent(
Expand Down
4 changes: 2 additions & 2 deletions src/lib/fcitx/instance_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -219,9 +219,9 @@ class InstancePrivate : public QPtrHolder<Instance> {

std::string lastGroup_;

bool virtualKeyboardAutoShow_ = true;
bool virtualKeyboardAutoShow_ = false;

bool virtualKeyboardAutoHide_ = true;
bool virtualKeyboardAutoHide_ = false;

VirtualKeyboardFunctionMode virtualKeyboardFunctionMode_ =
VirtualKeyboardFunctionMode::Full;
Expand Down
10 changes: 10 additions & 0 deletions src/lib/fcitx/userinterfacemanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,11 @@ bool UserInterfaceManager::isVirtualKeyboardVisible() const {
void UserInterfaceManager::showVirtualKeyboard() const {
FCITX_D();

auto *instance = d->addonManager_->instance();
if (!instance->virtualKeyboardAutoShow()) {
return;
}

auto *ui = d->ui_;
if (ui == nullptr || ui->addonInfo() == nullptr ||
ui->addonInfo()->uiType() != UIType::OnScreenKeyboard) {
Expand All @@ -346,6 +351,11 @@ void UserInterfaceManager::showVirtualKeyboard() const {
void UserInterfaceManager::hideVirtualKeyboard() const {
FCITX_D();

auto *instance = d->addonManager_->instance();
if (!instance->virtualKeyboardAutoHide()) {
return;
}

auto *ui = d->ui_;
if (ui == nullptr || ui->addonInfo() == nullptr ||
ui->addonInfo()->uiType() != UIType::OnScreenKeyboard) {
Expand Down
Loading