Resolves: #2088656 Hide XKB engine but enable it in Plasma Wayland

This commit is contained in:
Takao Fujiwara 2022-06-02 16:57:37 +09:00
parent 6f0634e053
commit 9da0396a49
2 changed files with 123 additions and 1 deletions

View File

@ -1094,3 +1094,122 @@ index f8dced6b..92464234 100755
--
2.35.3
From 85b381d531b8fc319e627a5e9d4b815f34a50e2f Mon Sep 17 00:00:00 2001
From: fujiwarat <takao.fujiwara1@gmail.com>
Date: Thu, 2 Jun 2022 16:47:10 +0900
Subject: [PATCH] ui/gtk3: Hide XKB engine but enable it in Plasma Wayland
IBus just cannot forward key events in Plasma Wayland because
IBus has to handle the compose keys.
BUG=rhbz#2088656
---
ui/gtk3/panel.vala | 46 +++++++++++++++++++++++++++++-----------------
1 file changed, 29 insertions(+), 17 deletions(-)
diff --git a/ui/gtk3/panel.vala b/ui/gtk3/panel.vala
index 61bfa1b6..900f0168 100644
--- a/ui/gtk3/panel.vala
+++ b/ui/gtk3/panel.vala
@@ -41,6 +41,7 @@ class Panel : IBus.PanelService {
private Gtk.Menu m_ime_menu;
private Gtk.Menu m_sys_menu;
private IBus.EngineDesc[] m_engines = {};
+ private IBus.EngineDesc m_en_engine;
private GLib.HashTable<string, IBus.EngineDesc> m_engine_contexts =
new GLib.HashTable<string, IBus.EngineDesc>(GLib.str_hash,
GLib.str_equal);
@@ -910,13 +911,20 @@ class Panel : IBus.PanelService {
}
private void switch_engine(int i, bool force = false) {
- GLib.assert(i >= 0 && i < m_engines.length);
+ if (m_is_wayland)
+ GLib.assert(i >= 0 && i <= m_engines.length);
+ else
+ GLib.assert(i >= 0 && i < m_engines.length);
// Do not need switch
if (i == 0 && !force)
return;
- IBus.EngineDesc engine = m_engines[i];
+ IBus.EngineDesc engine;
+ if (m_is_wayland && m_engines.length == 0)
+ engine = m_en_engine;
+ else
+ engine = m_engines[i];
set_engine(engine);
}
@@ -1006,17 +1014,15 @@ class Panel : IBus.PanelService {
string[]? order_names) {
string[]? engine_names = unowned_engine_names;
- if (engine_names == null || engine_names.length == 0) {
- if (m_is_wayland)
- engine_names = {};
- else
- engine_names = {"xkb:us::eng"};
- }
+ if (engine_names == null || engine_names.length == 0)
+ engine_names = {"xkb:us::eng"};
string[] names = {};
foreach (var name in order_names) {
if (m_is_wayland && name.has_prefix("xkb:"))
+ name = "xkb:us::eng";
+ if (name in names)
continue;
if (name in engine_names)
names += name;
@@ -1024,7 +1030,7 @@ class Panel : IBus.PanelService {
foreach (var name in engine_names) {
if (m_is_wayland && name.has_prefix("xkb:"))
- continue;
+ name = "xkb:us::eng";
if (name in names)
continue;
names += name;
@@ -1065,14 +1071,20 @@ class Panel : IBus.PanelService {
}
if (m_engines.length == 0) {
- if (engines.length > 0) {
- m_engines = engines;
- switch_engine(0, true);
- run_preload_engines(engines, 1);
- } else {
- m_candidate_panel.set_language(new Pango.AttrLanguage(
- Pango.Language.from_string(null)));
+ m_engines = engines;
+ // Do not show engines in panel icon and suggest systemsettings5
+ // in Plasma Wayland in case all engines are XKB.
+ if (m_is_wayland && m_engines.length == 1 &&
+ m_engines[0].get_name() == "xkb:us::eng") {
+ m_engines = {};
+ if (m_en_engine == null) {
+ m_en_engine =
+ m_bus.get_engines_by_names({"xkb:us::eng"})[0];
+ }
}
+ switch_engine(0, true);
+ if (m_engines.length > 0)
+ run_preload_engines(m_engines, 1);
} else {
var current_engine = m_engines[0];
m_engines = engines;
@@ -1566,7 +1578,7 @@ class Panel : IBus.PanelService {
if (engine != null) {
var name = engine.get_name();
- if (name.length >= 4 && name[0:4] == "xkb:")
+ if (!m_is_wayland && name.length >= 4 && name[0:4] == "xkb:")
language = m_switcher.get_xkb_language(engine);
}
--
2.35.3

View File

@ -39,7 +39,7 @@
Name: ibus
Version: 1.5.26
Release: 7%{?dist}
Release: 8%{?dist}
Summary: Intelligent Input Bus for Linux OS
License: LGPLv2+
URL: https://github.com/ibus/%name/wiki
@ -522,6 +522,9 @@ dconf update || :
%{_datadir}/installed-tests/ibus
%changelog
* Thu Jun 02 2022 Takao Fujiwara <tfujiwar@redhat.com> - 1.5.26-8
- Resolves: #2088656 Hide XKB engine but enable it in Plasma Wayland
* Wed May 25 2022 Takao Fujiwara <tfujiwar@redhat.com> - 1.5.26-7
- Update xkb-latin-layouts gsettings