Resolves #2290842 Fix Super-space in Wayland

- Fix compose sequences beyond U10000
This commit is contained in:
Takao Fujiwara 2024-06-08 12:14:57 +09:00
parent 21ca965641
commit 77787d99c6
2 changed files with 293 additions and 1 deletions

View File

@ -745,6 +745,72 @@ index d907458e..534a9d37 100644
--
2.45.0
From aea035a96261f9c3a36f5cd9c30b84b1d7609103 Mon Sep 17 00:00:00 2001
From: fujiwarat <takao.fujiwara1@gmail.com>
Date: Sat, 8 Jun 2024 10:23:31 +0900
Subject: [PATCH] ui/gtk3: Fix Super-space in Wayland
ibus_bus_set_global_shortcut_keys_async() was not called in Plasma
Wayland after "Fix to unref GdkDisplay in Wayland" patch is applied.
Now it's called correctly and the event handler is disabled instead.
BUG=rhbz#2290842
BUG=https://github.com/ibus/ibus/issues/2644
Fixes: https://github.com/ibus/ibus/commit/627e7cc
---
ui/gtk3/keybindingmanager.vala | 9 +++++----
ui/gtk3/panel.vala | 5 ++---
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/ui/gtk3/keybindingmanager.vala b/ui/gtk3/keybindingmanager.vala
index 71b4acb2..d4c7636a 100644
--- a/ui/gtk3/keybindingmanager.vala
+++ b/ui/gtk3/keybindingmanager.vala
@@ -60,8 +60,9 @@ public class KeybindingManager : GLib.Object {
public delegate void KeybindingHandlerFunc(Gdk.Event event);
- private KeybindingManager() {
- Gdk.Event.handler_set(event_handler);
+ private KeybindingManager(bool is_wayland_im) {
+ if (!is_wayland_im)
+ Gdk.Event.handler_set(event_handler);
}
/**
@@ -107,9 +108,9 @@ public class KeybindingManager : GLib.Object {
m_bindings.remove (binding);
}
- public static KeybindingManager get_instance () {
+ public static KeybindingManager get_instance (bool is_wayland_im=false) {
if (m_instance == null)
- m_instance = new KeybindingManager ();
+ m_instance = new KeybindingManager (is_wayland_im);
return m_instance;
}
diff --git a/ui/gtk3/panel.vala b/ui/gtk3/panel.vala
index 534a9d37..b24c23ac 100644
--- a/ui/gtk3/panel.vala
+++ b/ui/gtk3/panel.vala
@@ -446,11 +446,10 @@ class Panel : IBus.PanelService {
}
private void bind_switch_shortcut() {
- if (m_is_wayland_im)
- return;
string[] accelerators = m_settings_hotkey.get_strv("triggers");
- var keybinding_manager = KeybindingManager.get_instance();
+ var keybinding_manager =
+ KeybindingManager.get_instance(m_is_wayland_im);
BindingCommon.KeyEventFuncType ftype =
BindingCommon.KeyEventFuncType.IME_SWITCHER;
--
2.45.0
From be94b8ddb4c37fe83646860a08c600b98e67fe84 Mon Sep 17 00:00:00 2001
From: fujiwarat <takao.fujiwara1@gmail.com>
Date: Sat, 25 May 2024 18:10:36 +0900
@ -1296,3 +1362,225 @@ index a5210004..fd1d15f7 100644
--
2.45.0
From 8d314d749f5ab83eb6de189faba184108fbccd61 Mon Sep 17 00:00:00 2001
From: fujiwarat <takao.fujiwara1@gmail.com>
Date: Sat, 8 Jun 2024 11:46:57 +0900
Subject: [PATCH 1/2] src/ibuscomposetable: Fix UFDD5 key for compose seq with fr(bepo_afnor)
AltGr-t with fr(bepo_afnor) keymap has no keysym name but can be
used in the compose key sequences.
Most Unicode format (UXXXX) should be supported in the compose sequences
in case they are not used in XKB options except for 'Pointer_*' XKB option
names.
Also refactor compose sequences with each range beyond U10000.
Also update ibus_keyval_name() can output keysym names beyond U10000.
BUG=https://github.com/ibus/ibus/issues/2646
Fixes: https://github.com/ibus/ibus/commit/ad883dc
---
src/ibuscomposetable.c | 35 +++++++++++++++++++++++++++++------
src/ibusenginesimpleprivate.h | 1 +
src/ibuskeynames.c | 7 +------
src/tests/ibus-compose.basic | 10 ++++++++++
4 files changed, 41 insertions(+), 12 deletions(-)
diff --git a/src/ibuscomposetable.c b/src/ibuscomposetable.c
index 9d4377a9..2c97fd3b 100644
--- a/src/ibuscomposetable.c
+++ b/src/ibuscomposetable.c
@@ -1,7 +1,7 @@
/* -*- mode: C; c-basic-offset: 4; indent-tabs-mode: nil; -*- */
/* ibus - The Input Bus
* Copyright (C) 2013-2014 Peng Huang <shawn.p.huang@gmail.com>
- * Copyright (C) 2013-2023 Takao Fujiwara <takao.fujiwara1@gmail.com>
+ * Copyright (C) 2013-2024 Takao Fujiwara <takao.fujiwara1@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -222,6 +222,12 @@ parse_compose_sequence (IBusComposeData *compose_data,
compose_data->sequence[n] = codepoint;
}
+ if (codepoint >= 0x10000) {
+ if (!ibus_compose_key_flag (0xffff & codepoint)) {
+ g_warning ("The keysym %s > 0xffff is not supported: %s",
+ match, line);
+ }
+ }
if (codepoint == IBUS_KEY_VoidSymbol) {
g_warning ("Could not get code point of keysym %s: %s",
match, line);
@@ -603,6 +609,7 @@ ibus_compose_list_check_duplicated (GList *compose_list,
/*
* Actual typed keysyms have a flag against the definition.
+ * https://gitlab.freedesktop.org/xorg/proto/xorgproto/-/blob/master/include/X11/keysymdef.h?ref_type=heads#L82
* https://gitlab.freedesktop.org/xorg/lib/libx11/-/blob/master/nls/en_US.UTF-8/Compose.pre#L4559
*/
guint
@@ -611,11 +618,27 @@ ibus_compose_key_flag (guint key)
const char *name;
if (key <= 0xff)
return 0;
+ switch (key) {
+ /* <Aogonek> is not used in UTF-8 compose sequences but <ohorn> in EN
+ * compose file and vn keymap is assumed instead.
+ */
+ case 0x1a1:
+ /* <Zabovedot> is not used in UTF-8 compose sequences but <Uhorn> in EN
+ * compose file and vn keymap s assumed instead.
+ */
+ case 0x1af:
+ /* <caron> is not used in UTF-8 compose sequences but <EZH> in EN compose
+ * file and fr(nodeadkeys) keymap is assumed instead.
+ */
+ case 0x1b7:
+ return 0x1000000;
+ default:;
+ }
name = ibus_keyval_name (key);
/* If name is null, the key sequence is expressed as "<Uxxxx>" format in
* the Compose file and the typed keysym has the flag.
*/
- if (!name)
+ if (!name || g_str_has_prefix (name, "0x"))
return 0x1000000;
/* "<Pointer_EnableKeys>" is not described in the Compose file but <UFEF9>
* in the file.
@@ -648,8 +671,8 @@ ibus_compose_data_compare (gpointer a,
gunichar code_a = compose_data_a->sequence[i];
gunichar code_b = compose_data_b->sequence[i];
- code_a += ibus_compose_key_flag (code_a);
- code_b += ibus_compose_key_flag (code_b);
+ code_a &= 0xffff;
+ code_b &= 0xffff;
if (code_a != code_b)
return code_a - code_b;
if (code_a == 0 && code_b == 0)
@@ -1581,9 +1604,9 @@ compare_seq (const void *key, const void *value)
guint saved_key = (guint)seq[i];
guint flag = ibus_compose_key_flag (saved_key);
if (typed_key < (saved_key + flag))
- return -1;
+ return (0xffff & typed_key) - saved_key;
else if (typed_key > (saved_key + flag))
- return 1;
+ return (0xffff & typed_key) - saved_key;
i++;
}
diff --git a/src/ibusenginesimpleprivate.h b/src/ibusenginesimpleprivate.h
index fd600853..ae42342b 100644
--- a/src/ibusenginesimpleprivate.h
+++ b/src/ibusenginesimpleprivate.h
@@ -42,6 +42,7 @@ struct _IBusComposeTablePrivate
};
+guint ibus_compose_key_flag (guint key);
gboolean ibus_check_algorithmically (const guint *compose_buffer,
int n_compose,
gunichar *output);
diff --git a/src/ibuskeynames.c b/src/ibuskeynames.c
index 544c6ade..2925bdec 100644
--- a/src/ibuskeynames.c
+++ b/src/ibuskeynames.c
@@ -47,12 +47,7 @@ ibus_keyval_name (guint keyval)
static gchar buf[100];
gdk_key *found;
- /* Check for directly encoded 24-bit UCS characters: */
- if ((keyval & 0xff000000) == 0x01000000)
- {
- g_sprintf (buf, "U+%.04X", (keyval & 0x00ffffff));
- return buf;
- }
+ /* <ohorn> with 0x01000000 is supported in gdk_keys_by_keyval */
found = bsearch (&keyval, gdk_keys_by_keyval,
IBUS_NUM_KEYS, sizeof (gdk_key),
diff --git a/src/tests/ibus-compose.basic b/src/tests/ibus-compose.basic
index 0735d4ea..4e8cb9ab 100644
--- a/src/tests/ibus-compose.basic
+++ b/src/tests/ibus-compose.basic
@@ -8,6 +8,13 @@
<dead_macron> <U0227> : "ǟ" U01DE
<Multi_key> <macron> <U0227> : "ǟ" U01DE
<Multi_key> <underscore> <U0227> : "ǟ" U01DE
+# AltGr-t, Shift-asterisk with fr(bepo_afnor) keymap outputs
+# <UFDD5> <0>
+# Support Unicode keysyms in case they are not used in XKB options except
+# for 'Pointer_*' XKB option names.
+<UFDD5> <0> : "⁰" U2070
+#
+### Multibyte chars tests
# Khmer digraphs
# This case swaps U17fe and U17ff in en-US
<U17fe> : "ាំ"
@@ -22,3 +29,6 @@
# This case swaps c_h and C_h in en-US
<c_h> : "Ch"
<C_h> : "ch"
+# Some <U10000> are supported for musical composer in en-US
+<Multi_key> <U1D157> <U1D165> : "𝇒" U1D1D2 # MUSICAL SYMBOL SQUARE B
+
--
2.45.0
From 909dff4fd50d86492fb7f42a09bbd04625fa60f4 Mon Sep 17 00:00:00 2001
From: Wismill <dev@wismill.eu>
Date: Sat, 8 Jun 2024 11:47:01 +0900
Subject: [PATCH 2/2] src/tests/ibus-compose: Add some Unicode boundary tests
BUG=https://github.com/ibus/ibus/pull/2649
---
src/tests/ibus-compose.basic | 8 +++++++-
src/tests/ibus-compose.emoji | 4 ++++
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/src/tests/ibus-compose.basic b/src/tests/ibus-compose.basic
index 4e8cb9ab..d904dbb4 100644
--- a/src/tests/ibus-compose.basic
+++ b/src/tests/ibus-compose.basic
@@ -3,7 +3,9 @@
<Multi_key> <quotedbl> <Cyrillic_zhe> : "Ӝ" U04DC
<Multi_key> <quotedbl> <Cyrillic_ZHE> : "ӝ" U04DD
#
-# Unicode tests of Uxxxx
+# A Unicode keysym <Uxxxx> has a real value 0x01000000 + xxxx.
+# https://gitlab.freedesktop.org/xorg/proto/xorgproto/-/blob/master/include/X11/keysymdef.h?ref_type=heads#L82
+#
# en-US is "ǡ" U01E1 but this case is "ǟ" U01DE
<dead_macron> <U0227> : "ǟ" U01DE
<Multi_key> <macron> <U0227> : "ǟ" U01DE
@@ -13,6 +15,10 @@
# Support Unicode keysyms in case they are not used in XKB options except
# for 'Pointer_*' XKB option names.
<UFDD5> <0> : "⁰" U2070
+# ohorn, grave with vn keymap
+# IBus does not distingish ohorn and Aogonek
+<ohorn> <grave> : "Ờ" U1EDC
+<U01A1> <grave> : "Ờ" U1EDC
#
### Multibyte chars tests
# Khmer digraphs
diff --git a/src/tests/ibus-compose.emoji b/src/tests/ibus-compose.emoji
index 7fbf82cf..fdd560f8 100644
--- a/src/tests/ibus-compose.emoji
+++ b/src/tests/ibus-compose.emoji
@@ -1,3 +1,4 @@
+# Emoji tests
<Multi_key> <Multi_key> <l> <e> <o> : "♌" U264C # LEO
<Multi_key> <Multi_key> <v> <i> <r> <g> <o> : "♍" U264D # VIRGO
<Multi_key> <Multi_key> <I> <n> <t> : "∫"
@@ -9,3 +10,6 @@
<Multi_key> <Multi_key> <o> <I> <n> <t> : "∮"
<Multi_key> <Multi_key> <o> <I> <I> <n> <t> : "∯"
<Multi_key> <Multi_key> <o> <I> <I> <I> <n> <t> : "∰"
+# Unicode boundary tests
+<U2800> <0> : "a"
+<braille_blank> <0> : "a"
--
2.45.0

View File

@ -61,7 +61,7 @@
Name: ibus
Version: 1.5.30
# https://github.com/fedora-infra/rpmautospec/issues/101
Release: 4%{?dist}
Release: 5%{?dist}
Summary: Intelligent Input Bus for Linux OS
License: LGPL-2.1-or-later
URL: https://github.com/ibus/%name/wiki
@ -625,6 +625,10 @@ dconf update || :
%{_datadir}/installed-tests/ibus
%changelog
* Sat Jun 08 2024 Takao Fujiwara <tfujiwar@redhat.com> - 1.5.30-5
- Resolves #2290842 Fix Super-space in Wayland
- Fix compose sequences beyond U10000
* Fri Jun 07 2024 Python Maint <python-maint@redhat.com> - 1.5.30-4
- Rebuilt for Python 3.13