Skip to content

[wayland] Do not show layout override warning when override is disabled #1390

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
38 changes: 24 additions & 14 deletions src/modules/wayland/waylandmodule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -716,20 +716,30 @@ void WaylandModule::selfDiagnose() {
}
}

std::unordered_set<std::string> groupLayouts;
for (const auto &groupName : instance_->inputMethodManager().groups()) {
if (const auto *group =
instance_->inputMethodManager().group(groupName)) {
groupLayouts.insert(group->defaultLayout());
}
if (groupLayouts.size() >= 2) {
messages.push_back(
_("Sending keyboard layout configuration to wayland "
"compositor from Fcitx is "
"not yet supported on current desktop. You may still use "
"Fcitx's internal layout conversion by adding layout as "
"input method to the input method group."));
break;
// layout diagnosis only when overriding is enabled
if (*config_.allowOverrideXKB) {
std::optional<std::string> firstLayout;
for (const auto &groupName :
instance_->inputMethodManager().groups()) {
if (const auto *group =
instance_->inputMethodManager().group(groupName)) {
const auto &layout = group->defaultLayout();
if (!firstLayout) {
firstLayout = layout;
} else if (layout != *firstLayout) {
messages.push_back(_(
"Sending keyboard layout configuration to wayland "
"compositor from Fcitx is "
"not yet supported on current desktop. You may "
"still "
"use "
"Fcitx's internal layout conversion by adding "
"layout "
"as "
"input method to the input method group."));
break;
}
}
}
}

Expand Down
Loading