Enhance #2237486 Implement preedit color in Plasma Wayland

- Part-of #2240490 Eacute with CapsLock in Plasma Wayland only
- Revert dnf5 to dnf in autogen
- Test fix #2239633 g_list_remove() in ibus-portal SIGSEGV
This commit is contained in:
Takao Fujiwara 2023-09-30 12:37:41 +09:00
parent 52531c070d
commit ec611b250c
3 changed files with 152 additions and 37 deletions

View File

@ -1,6 +1,6 @@
From db158389251d9360518abcbdd1770d0e82dbb855 Mon Sep 17 00:00:00 2001
From 68996e1430e3478bda1201d8e31a82679b2659a4 Mon Sep 17 00:00:00 2001
From: fujiwarat <takao.fujiwara1@gmail.com>
Date: Sun, 9 Jul 2023 19:04:44 +0900
Date: Sat, 30 Sep 2023 11:50:14 +0900
Subject: [PATCH] Fix SEGV in bus_panel_proxy_focus_in()
rhbz#1350291 SEGV in BUS_IS_CONNECTION(skip_connection) in
@ -39,7 +39,11 @@ rhbz#1797120 SEGV in assert(bus.is_connected()) in panel_binding_construct()
Check m_ibus in extension.vala:bus_name_acquired_cb()
rhbz#2151344 SEGV with portal_context->owner in name_owner_changed()
Maybe g_object_unref() is called but not finalzed yet.
Maybe g_object_unref() is called but not finalized yet.
rhbz#2239633 SEGV with g_object_unref() in
ibus_portal_context_handle_destroy()
Connect "handle-destroy" signal after g_list_prepend().
BUG=rhbz#1350291
BUG=rhbz#1601577
@ -51,16 +55,17 @@ BUG=rhbz#1767976
BUG=rhbz#1797120
BUG=rhbz#2151344
BUG=rhbz#2195895
BUG=rhbz#2239633
---
bus/dbusimpl.c | 47 ++++++++++++++++++++++++---
bus/engineproxy.c | 44 +++++++++++++++++++------
bus/panelproxy.c | 9 +++++-
client/x11/main.c | 56 ++++++++++++++++++++++++++++----
portal/portal.c | 11 +++++++
portal/portal.c | 25 ++++++++++++---
src/ibusbus.c | 6 ++++
ui/gtk3/extension.vala | 4 +++
ui/gtk3/switcher.vala | 73 +++++++++++++++++++++++++-----------------
8 files changed, 199 insertions(+), 51 deletions(-)
8 files changed, 208 insertions(+), 56 deletions(-)
diff --git a/bus/dbusimpl.c b/bus/dbusimpl.c
index 59787a80..af2fbde2 100644
@ -446,7 +451,7 @@ index b7eb5961..3075d5d0 100644
static void
diff --git a/portal/portal.c b/portal/portal.c
index c2e4fc7f..a347fe6a 100644
index c2e4fc7f..76ef4f0a 100644
--- a/portal/portal.c
+++ b/portal/portal.c
@@ -90,6 +90,11 @@ static void portal_context_g_signal (GDBusProxy *proxy,
@ -461,7 +466,37 @@ index c2e4fc7f..a347fe6a 100644
G_DEFINE_TYPE_WITH_CODE (IBusPortalContext,
ibus_portal_context,
IBUS_DBUS_TYPE_INPUT_CONTEXT_SKELETON,
@@ -624,6 +629,12 @@ name_owner_changed (GDBusConnection *connection,
@@ -449,11 +454,6 @@ ibus_portal_context_new (IBusInputContext *context,
g_strdup_printf (IBUS_PATH_INPUT_CONTEXT, portal_context->id);
portal_context->service = ibus_dbus_service_skeleton_new ();
- g_signal_connect (portal_context->service,
- "handle-destroy",
- G_CALLBACK (ibus_portal_context_handle_destroy),
- portal_context);
-
if (!g_dbus_interface_skeleton_export (
G_DBUS_INTERFACE_SKELETON (portal_context->service),
connection, portal_context->object_path,
@@ -466,8 +466,17 @@ ibus_portal_context_new (IBusInputContext *context,
return NULL;
}
+ /* rhbz#2239633 g_list_prepend() needs to be callsed before
+ * ibus_portal_context_handle_destroy() is connected
+ * for g_list_remove() in ibus_portal_context_finalize().
+ */
all_contexts = g_list_prepend (all_contexts, portal_context);
+ g_signal_connect (portal_context->service,
+ "handle-destroy",
+ G_CALLBACK (ibus_portal_context_handle_destroy),
+ portal_context);
+
return portal_context;
}
@@ -624,6 +633,12 @@ name_owner_changed (GDBusConnection *connection,
IBusPortalContext *portal_context = l->data;
next = l->next;
@ -475,10 +510,10 @@ index c2e4fc7f..a347fe6a 100644
g_object_unref (portal_context);
}
diff --git a/src/ibusbus.c b/src/ibusbus.c
index 47400cb8..c9fbe492 100644
index 0e6d67f1..fcc742b6 100644
--- a/src/ibusbus.c
+++ b/src/ibusbus.c
@@ -708,6 +708,12 @@ ibus_bus_destroy (IBusObject *object)
@@ -742,6 +742,12 @@ ibus_bus_destroy (IBusObject *object)
_bus = NULL;
if (bus->priv->monitor) {
@ -507,10 +542,10 @@ index a6f2e8e6..b7a04081 100644
m_panel.load_settings();
}
diff --git a/ui/gtk3/switcher.vala b/ui/gtk3/switcher.vala
index 9400e9ba..2ecbdac1 100644
index e3fab8d9..a827094f 100644
--- a/ui/gtk3/switcher.vala
+++ b/ui/gtk3/switcher.vala
@@ -140,8 +140,8 @@ class Switcher : Gtk.Window {
@@ -176,8 +176,8 @@ class Switcher : Gtk.Window {
IBus.EngineDesc[] engines,
int index,
string input_context_path) {
@ -521,7 +556,7 @@ index 9400e9ba..2ecbdac1 100644
if (m_is_running)
return index;
@@ -200,16 +200,18 @@ class Switcher : Gtk.Window {
@@ -236,16 +236,18 @@ class Switcher : Gtk.Window {
null,
event,
null);
@ -549,7 +584,7 @@ index 9400e9ba..2ecbdac1 100644
#else
Gdk.Device device = event.get_device();
if (device == null) {
@@ -245,30 +247,41 @@ class Switcher : Gtk.Window {
@@ -281,30 +283,41 @@ class Switcher : Gtk.Window {
Gdk.EventMask.KEY_RELEASE_MASK,
null,
Gdk.CURRENT_TIME);

View File

@ -1,6 +1,36 @@
From af5471beb784dda626eb272f852f279f1a61ebb9 Mon Sep 17 00:00:00 2001
From f44e4e35cf477bbd757dd6a6c657a8699eb41ca6 Mon Sep 17 00:00:00 2001
From: fujiwarat <takao.fujiwara1@gmail.com>
Date: Thu, 7 Sep 2023 13:46:29 +0900
Date: Sat, 30 Sep 2023 09:48:07 +0900
Subject: [PATCH] autogen: Revert DNF for Fedora 39
Seems DNF5 is deleted by default.
Fixes: https://github.com/ibus/ibus/commit/f05c12d
BUG=https://github.com/ibus/ibus/pull/2569
---
autogen.sh | 2 +-
2 files changed, 2 insertions(+), 5 deletions(-)
diff --git a/autogen.sh b/autogen.sh
index 05682f47..d6f8f983 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -47,7 +47,7 @@ cd "$srcdir"
rpm -q $FEDORA_PKG1 || exit 1
rpm -q $FEDORA_PKG2 || exit 1
rpm -q $FEDORA_PKG3 || exit 1
- (grep -qE '37|38' /etc/fedora-release) && DNF=dnf || DNF=dnf5
+ DNF=dnf
$DNF update --assumeno $FEDORA_PKG1 || exit 1
$DNF update --assumeno $FEDORA_PKG2 || exit 1
$DNF update --assumeno $FEDORA_PKG3 || exit 1
--
2.41.0
From db829f4aee399e5472bd55dc630a94425e72bacd Mon Sep 17 00:00:00 2001
From: fujiwarat <takao.fujiwara1@gmail.com>
Date: Sat, 30 Sep 2023 09:51:43 +0900
Subject: [PATCH] client/wayland: Implement preedit color in Plasma Wayland
Wayland input-method protocol version 1 supports the preedit style
@ -18,10 +48,10 @@ Rf. https://github.com/ibus/ibus/wiki/Wayland-Colors
BUG=rhbz#2237486
---
client/wayland/Makefile.am | 1 +
client/wayland/ibuswaylandim.c | 175 +++-
client/wayland/ibuswaylandim.c | 176 +++-
.../text-input-unstable-v1-client-protocol.h | 847 ++++++++++++++++++
src/ibusattribute.h | 52 +-
4 files changed, 1072 insertions(+), 3 deletions(-)
4 files changed, 1073 insertions(+), 3 deletions(-)
create mode 100644 client/wayland/text-input-unstable-v1-client-protocol.h
diff --git a/client/wayland/Makefile.am b/client/wayland/Makefile.am
@ -37,7 +67,7 @@ index 7e8d18af..94e357b4 100644
ibus_wayland_SOURCES = \
diff --git a/client/wayland/ibuswaylandim.c b/client/wayland/ibuswaylandim.c
index ffc20de1..bf321a71 100644
index ffc20de1..37966dd6 100644
--- a/client/wayland/ibuswaylandim.c
+++ b/client/wayland/ibuswaylandim.c
@@ -32,6 +32,7 @@
@ -56,7 +86,7 @@ index ffc20de1..bf321a71 100644
IBusModifierType modifiers;
struct xkb_context *xkb_context;
@@ -266,12 +268,175 @@ _context_forward_key_event_cb (IBusInputContext *context,
@@ -266,12 +268,176 @@ _context_forward_key_event_cb (IBusInputContext *context,
}
@ -188,7 +218,6 @@ index ffc20de1..bf321a71 100644
+ uint32_t whole_start = 0;
+ uint32_t whole_end = strlen (str);
+ uint32_t start, end;
+ gboolean drawn = FALSE;
+ for (i = 0; ; i++) {
+ IBusAttribute *attr = ibus_attr_list_get (attrs, i);
+ if (!attr)
@ -202,17 +231,19 @@ index ffc20de1..bf321a71 100644
+ } else if (strlen (str) == end) {
+ whole_end = start;
+ } else {
+ whole_start = start;
+ whole_end = end;
+ zwp_input_method_context_v1_preedit_styling (
+ priv->context,
+ whole_start,
+ whole_end - whole_start,
+ whole_wstyle);
+ drawn = TRUE;
+ whole_end = start;
+ if (whole_start < whole_end) {
+ zwp_input_method_context_v1_preedit_styling (
+ priv->context,
+ whole_start,
+ whole_end - whole_start,
+ whole_wstyle);
+ }
+ whole_start = end;
+ whole_end = strlen (str);
+ }
+ }
+ if (!drawn) {
+ if (whole_start < whole_end) {
+ zwp_input_method_context_v1_preedit_styling (
+ priv->context,
+ whole_start,
@ -232,7 +263,7 @@ index ffc20de1..bf321a71 100644
g_return_if_fail (IBUS_IS_WAYLAND_IM (wlim));
priv = ibus_wayland_im_get_instance_private (wlim);
/* CURSOR is byte offset. */
@@ -282,10 +447,13 @@ _context_show_preedit_text_cb (IBusInputContext *context,
@@ -282,10 +448,13 @@ _context_show_preedit_text_cb (IBusInputContext *context,
zwp_input_method_context_v1_preedit_cursor (priv->context,
cursor);
@ -247,7 +278,7 @@ index ffc20de1..bf321a71 100644
}
@@ -308,6 +476,7 @@ _context_update_preedit_text_cb (IBusInputContext *context,
@@ -308,6 +477,7 @@ _context_update_preedit_text_cb (IBusInputContext *context,
IBusText *text,
gint cursor_pos,
gboolean visible,
@ -255,7 +286,7 @@ index ffc20de1..bf321a71 100644
IBusWaylandIM *wlim)
{
IBusWaylandIMPrivate *priv;
@@ -317,6 +486,7 @@ _context_update_preedit_text_cb (IBusInputContext *context,
@@ -317,6 +487,7 @@ _context_update_preedit_text_cb (IBusInputContext *context,
g_object_unref (priv->preedit_text);
priv->preedit_text = g_object_ref_sink (text);
priv->preedit_cursor_pos = cursor_pos;
@ -263,7 +294,7 @@ index ffc20de1..bf321a71 100644
if (visible)
_context_show_preedit_text_cb (context, wlim);
@@ -977,7 +1147,7 @@ _create_input_context_done (GObject *object,
@@ -977,7 +1148,7 @@ _create_input_context_done (GObject *object,
G_CALLBACK (_context_forward_key_event_cb),
wlim);
@ -272,7 +303,7 @@ index ffc20de1..bf321a71 100644
G_CALLBACK (_context_update_preedit_text_cb),
wlim);
g_signal_connect (priv->ibuscontext, "show-preedit-text",
@@ -994,6 +1164,7 @@ _create_input_context_done (GObject *object,
@@ -994,6 +1165,7 @@ _create_input_context_done (GObject *object,
capabilities |= IBUS_CAP_SYNC_PROCESS_KEY_V2;
ibus_input_context_set_capabilities (priv->ibuscontext,
capabilities);
@ -1134,7 +1165,7 @@ index 00000000..71069ec7
+
+#endif
diff --git a/src/ibusattribute.h b/src/ibusattribute.h
index fe4cab45..5cfc36f7 100644
index fe4cab45..10190921 100644
--- a/src/ibusattribute.h
+++ b/src/ibusattribute.h
@@ -2,7 +2,8 @@
@ -1177,7 +1208,7 @@ index fe4cab45..5cfc36f7 100644
+ * @IBUS_ATTR_PREEDIT_ERROR_COMPOSE: A wrong compose key could be an error
+ * color. (Typing-booster)
+ *
+ * Type of Pre-edit style as the sematic name.
+ * Type of Pre-edit style as the semantic name.
+ * The Wayland specs prefers to express the semantic values rather than RGB
+ * values and text-input protocol version 1 defines some values:
+ * https://gitlab.freedesktop.org/wayland/wayland-protocols/-/blob/main/unstable/text-input/text-input-unstable-v1.xml?ref_type=heads#L251
@ -1206,3 +1237,46 @@ index fe4cab45..5cfc36f7 100644
--
2.41.0
From 7431ac25bbbbe0d88eec6a241d7a35921c73bd01 Mon Sep 17 00:00:00 2001
From: fujiwarat <takao.fujiwara1@gmail.com>
Date: Fri, 29 Sep 2023 22:57:27 +0900
Subject: [PATCH] client/wayland: Translate keycodes with CapsLock
Fix CapsLock and some Latin characters with fr(azerty) layout in
Plasma Wayland.
BUG=https://github.com/ibus/ibus/pull/2568
---
client/wayland/ibuswaylandim.c | 9 +--------
1 file changed, 1 insertion(+), 8 deletions(-)
diff --git a/client/wayland/ibuswaylandim.c b/client/wayland/ibuswaylandim.c
index ffc20de1..e3aae3d4 100644
--- a/client/wayland/ibuswaylandim.c
+++ b/client/wayland/ibuswaylandim.c
@@ -840,8 +840,6 @@ input_method_keyboard_key (void *data,
IBusWaylandIMPrivate *priv;
IBusWaylandKeyEvent event = { 0, };
uint32_t code;
- uint32_t num_syms;
- const xkb_keysym_t *syms;
g_return_if_fail (IBUS_IS_WAYLAND_IM (wlim));
priv = ibus_wayland_im_get_instance_private (wlim);
@@ -862,12 +860,7 @@ input_method_keyboard_key (void *data,
event.key = key;
event.state = state;
code = key + 8;
- num_syms = xkb_key_get_syms (priv->state, code, &syms);
-
- event.sym = XKB_KEY_NoSymbol;
- if (num_syms == 1)
- event.sym = syms[0];
-
+ event.sym = xkb_state_key_get_one_sym (priv->state, code);
event.modifiers = priv->modifiers;
if (state == WL_KEYBOARD_KEY_STATE_RELEASED)
event.modifiers |= IBUS_RELEASE_MASK;
--
2.41.0

View File

@ -58,7 +58,7 @@
Name: ibus
Version: 1.5.29~rc1
Release: 3%{?dist}
Release: 4%{?dist}
Summary: Intelligent Input Bus for Linux OS
License: LGPL-2.1-or-later
URL: https://github.com/ibus/%name/wiki
@ -579,6 +579,12 @@ dconf update || :
%{_datadir}/installed-tests/ibus
%changelog
* Sat Sep 30 2023 Takao Fujiwara <tfujiwar@redhat.com> - 1.5.29~rc1-3
- Enhance #2237486 Implement preedit color in Plasma Wayland
- Part-of #2240490 Eacute with CapsLock in Plasma Wayland only
- Revert dnf5 to dnf in autogen
- Test fix #2239633 g_list_remove() in ibus-portal SIGSEGV
* Thu Sep 07 2023 Takao Fujiwara <tfujiwar@redhat.com> - 1.5.29~rc1-3
- Resolves #2237486 Implement preedit color in Plasma Wayland