chore: Build ibus with xinit

This commit is contained in:
Kyle Gospodnetich 2024-12-27 11:17:02 -08:00
parent 39b25e3e7b
commit fd17046f05
13 changed files with 5030 additions and 1 deletions

View File

@ -502,7 +502,8 @@ RUN --mount=type=cache,dst=/var/cache/rpm-ostree \
ibus-gtk4 \
ibus-libs \
ibus-panel \
ibus-setup && \
ibus-setup \
ibus-xinit && \
rpm-ostree install \
jupiter-sd-mounting-btrfs \
at-spi2-core.i686 \

View File

@ -0,0 +1,4 @@
cksum 4283112382 4124084 ibus-1.5.30.tar.gz
sha1sum cda03c8622d5817e1a968b38bd05240e2102928d ibus-1.5.30.tar.gz
sha256sum 05b84d4a45139face161596e5ade8e6c5da55cfaf6f194861da66516190f5b96 ibus-1.5.30.tar.gz
sha512sum cbed37bf62e8d8593c838f8ef7fe0b22bf8f4a661b887fc7be2f2768dda912075abdf3070c22b9699def90e7002aaaf7394f5fc590e12ef6ebb2bb5161cc29a0 ibus-1.5.30.tar.gz

View File

@ -0,0 +1,650 @@
From 68996e1430e3478bda1201d8e31a82679b2659a4 Mon Sep 17 00:00:00 2001
From: fujiwarat <takao.fujiwara1@gmail.com>
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
bus_dbus_impl_dispatch_message_by_rule()
check if dbus_connection is closed in bus_dbus_impl_connection_filter_cb().
rhbz#1767976 SEGV in assert(connection != NULL) in
bus_dbus_impl_connection_filter_cb()
call bus_connection_set_filter() in bus_dbus_impl_destroy().
rhbz#2213445 SEGV in bus_panel_proxy_new()
WIP: Add a GError.
rhbz#1601577 rhbz#1797726 SEGV in ibus_engine_desc_get_layout() in
bus_engine_proxy_new_internal()
WIP: Add a GError to get the error message to check why the SEGV happened.
rhbz#1663528 SEGV in g_mutex_clear() in bus_dbus_impl_destroy()
If the mutex is not unlocked, g_mutex_clear() causes assert.
rhbz#1767691 SEGV in client/x11/main.c:_sighandler().
Do not call atexit functions in _sighandler().
rhbz#2195895 SEGV in client/x11/main.c:_xim_set_cursor_location()
check if IBusInputContext was disconnected.
rhbz#1795499 rhbz#1936777 SEGV in ibus_bus_get_bus_address() because of
no _bus->priv.
_changed_cb() should not be called after ibus_bus_destroy() is called.
rhbz#1771238 SEGV in assert(m_loop == null) in switcher.vala.
Grabbing keyboard could be failed and switcher received the keyboard
events and m_loop was not released.
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 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
BUG=rhbz#1663528
BUG=rhbz#1767691
BUG=rhbz#1795499
BUG=rhbz#1771238
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 | 25 ++++++++++++---
src/ibusbus.c | 6 ++++
ui/gtk3/extension.vala | 4 +++
ui/gtk3/switcher.vala | 73 +++++++++++++++++++++++++-----------------
8 files changed, 208 insertions(+), 56 deletions(-)
diff --git a/bus/dbusimpl.c b/bus/dbusimpl.c
index 59787a80..af2fbde2 100644
--- a/bus/dbusimpl.c
+++ b/bus/dbusimpl.c
@@ -610,6 +610,7 @@ static void
bus_dbus_impl_destroy (BusDBusImpl *dbus)
{
GList *p;
+ int i;
for (p = dbus->objects; p != NULL; p = p->next) {
IBusService *object = (IBusService *) p->data;
@@ -633,6 +634,10 @@ bus_dbus_impl_destroy (BusDBusImpl *dbus)
for (p = dbus->connections; p != NULL; p = p->next) {
BusConnection *connection = BUS_CONNECTION (p->data);
+ /* rhbz#1767976 Fix connection == NULL in
+ * bus_dbus_impl_connection_filter_cb()
+ */
+ bus_connection_set_filter (connection, NULL, NULL, NULL);
g_signal_handlers_disconnect_by_func (connection,
bus_dbus_impl_connection_destroy_cb, dbus);
ibus_object_destroy (IBUS_OBJECT (connection));
@@ -647,12 +652,39 @@ bus_dbus_impl_destroy (BusDBusImpl *dbus)
dbus->unique_names = NULL;
dbus->names = NULL;
+ for (i = 0; g_idle_remove_by_data (dbus); i++) {
+ if (i > 1000) {
+ g_warning ("Too many idle threads were generated by " \
+ "bus_dbus_impl_forward_message_idle_cb and " \
+ "bus_dbus_impl_dispatch_message_by_rule_idle_cb");
+ break;
+ }
+ }
g_list_free_full (dbus->start_service_calls,
(GDestroyNotify) bus_method_call_free);
dbus->start_service_calls = NULL;
- g_mutex_clear (&dbus->dispatch_lock);
- g_mutex_clear (&dbus->forward_lock);
+ /* rhbz#1663528 Call g_mutex_trylock() before g_mutex_clear()
+ * because if the mutex is not unlocked, g_mutex_clear() causes assert.
+ */
+#define BUS_DBUS_MUTEX_SAFE_CLEAR(mtex) { \
+ int count = 0; \
+ while (!g_mutex_trylock ((mtex))) { \
+ g_usleep (1); \
+ if (count > 60) { \
+ g_warning (#mtex " is dead lock"); \
+ break; \
+ } \
+ ++count; \
+ } \
+ g_mutex_unlock ((mtex)); \
+ g_mutex_clear ((mtex)); \
+}
+
+ BUS_DBUS_MUTEX_SAFE_CLEAR (&dbus->dispatch_lock);
+ BUS_DBUS_MUTEX_SAFE_CLEAR (&dbus->forward_lock);
+
+#undef BUS_DBUS_MUTEX_SAFE_CLEAR
/* FIXME destruct _lock and _queue members. */
IBUS_OBJECT_CLASS(bus_dbus_impl_parent_class)->destroy ((IBusObject *) dbus);
@@ -1483,13 +1515,20 @@ bus_dbus_impl_connection_filter_cb (GDBusConnection *dbus_connection,
gboolean incoming,
gpointer user_data)
{
+ BusDBusImpl *dbus;
+ BusConnection *connection;
+
g_assert (G_IS_DBUS_CONNECTION (dbus_connection));
g_assert (G_IS_DBUS_MESSAGE (message));
g_assert (BUS_IS_DBUS_IMPL (user_data));
- BusDBusImpl *dbus = (BusDBusImpl *) user_data;
- BusConnection *connection = bus_connection_lookup (dbus_connection);
+ if (g_dbus_connection_is_closed (dbus_connection))
+ return NULL;
+
+ dbus = (BusDBusImpl *) user_data;
+ connection = bus_connection_lookup (dbus_connection);
g_assert (connection != NULL);
+ g_assert (BUS_IS_CONNECTION (connection));
if (incoming) {
/* is incoming message */
diff --git a/bus/engineproxy.c b/bus/engineproxy.c
index b3e16066..ba479b59 100644
--- a/bus/engineproxy.c
+++ b/bus/engineproxy.c
@@ -693,10 +693,12 @@ bus_engine_proxy_g_signal (GDBusProxy *proxy,
g_return_if_reached ();
}
+#pragma GCC optimize ("O0")
static BusEngineProxy *
bus_engine_proxy_new_internal (const gchar *path,
IBusEngineDesc *desc,
- GDBusConnection *connection)
+ GDBusConnection *connection,
+ GError **error)
{
GDBusProxyFlags flags;
BusEngineProxy *engine;
@@ -706,12 +708,20 @@ bus_engine_proxy_new_internal (const gchar *path,
g_assert (path);
g_assert (IBUS_IS_ENGINE_DESC (desc));
g_assert (G_IS_DBUS_CONNECTION (connection));
+ g_assert (error && *error == NULL);
+ /* rhbz#1601577 engine == NULL if connection is closed. */
+ if (g_dbus_connection_is_closed (connection)) {
+ *error = g_error_new (G_DBUS_ERROR,
+ G_DBUS_ERROR_FAILED,
+ "Connection is closed.");
+ return NULL;
+ }
flags = G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START;
engine = (BusEngineProxy *) g_initable_new (
BUS_TYPE_ENGINE_PROXY,
NULL,
- NULL,
+ error,
"desc", desc,
"g-connection", connection,
"g-interface-name", IBUS_INTERFACE_ENGINE,
@@ -719,6 +729,12 @@ bus_engine_proxy_new_internal (const gchar *path,
"g-default-timeout", g_gdbus_timeout,
"g-flags", flags,
NULL);
+ /* FIXME: rhbz#1601577 */
+ if (!engine) {
+ /* show abrt local variable */
+ gchar *message = g_strdup ((*error)->message);
+ g_error ("%s", message);
+ }
const gchar *layout = ibus_engine_desc_get_layout (desc);
if (layout != NULL && layout[0] != '\0') {
engine->keymap = ibus_keymap_get (layout);
@@ -756,6 +772,7 @@ bus_engine_proxy_new_internal (const gchar *path,
return engine;
}
+#pragma GCC reset_options
typedef struct {
GTask *task;
@@ -818,23 +835,30 @@ create_engine_ready_cb (BusFactoryProxy *factory,
GAsyncResult *res,
EngineProxyNewData *data)
{
+ GError *error = NULL;
+ gchar *path;
+ BusEngineProxy *engine;
+
g_return_if_fail (data->task != NULL);
- GError *error = NULL;
- gchar *path = bus_factory_proxy_create_engine_finish (factory,
- res,
- &error);
+ path = bus_factory_proxy_create_engine_finish (factory, res, &error);
if (path == NULL) {
g_task_return_error (data->task, error);
engine_proxy_new_data_free (data);
return;
}
- BusEngineProxy *engine =
- bus_engine_proxy_new_internal (path,
- data->desc,
- g_dbus_proxy_get_connection ((GDBusProxy *)data->factory));
+ engine = bus_engine_proxy_new_internal (
+ path,
+ data->desc,
+ g_dbus_proxy_get_connection ((GDBusProxy *)data->factory),
+ &error);
g_free (path);
+ if (!engine) {
+ g_task_return_error (data->task, error);
+ engine_proxy_new_data_free (data);
+ return;
+ }
/* FIXME: set destroy callback ? */
g_task_return_pointer (data->task, engine, NULL);
diff --git a/bus/panelproxy.c b/bus/panelproxy.c
index e6001ebf..00828fbc 100644
--- a/bus/panelproxy.c
+++ b/bus/panelproxy.c
@@ -122,6 +122,8 @@ bus_panel_proxy_new (BusConnection *connection,
const gchar *path = NULL;
GObject *obj;
BusPanelProxy *panel;
+ GError *error = NULL;
+ const gchar *message;
g_assert (BUS_IS_CONNECTION (connection));
@@ -138,7 +140,7 @@ bus_panel_proxy_new (BusConnection *connection,
obj = g_initable_new (BUS_TYPE_PANEL_PROXY,
NULL,
- NULL,
+ &error,
"g-object-path", path,
"g-interface-name", IBUS_INTERFACE_PANEL,
"g-connection", bus_connection_get_dbus_connection (connection),
@@ -146,6 +148,11 @@ bus_panel_proxy_new (BusConnection *connection,
"g-flags", G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START | G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES,
NULL);
+ if (error) {
+ /* TODO: rhbz#2213445 Why does this issue happen? */
+ message = error->message;
+ g_critical ("Failed to generate BusPanelProxy: %s", message);
+ }
panel = BUS_PANEL_PROXY (obj);
panel->panel_type = panel_type;
return panel;
diff --git a/client/x11/main.c b/client/x11/main.c
index b7eb5961..3075d5d0 100644
--- a/client/x11/main.c
+++ b/client/x11/main.c
@@ -45,6 +45,7 @@
#include <iconv.h>
#include <signal.h>
#include <stdlib.h>
+#include <unistd.h>
#include <getopt.h>
@@ -69,6 +70,7 @@ typedef struct _X11ICONN X11ICONN;
typedef struct _X11IC X11IC;
struct _X11IC {
IBusInputContext *context;
+ gboolean ibus_connected;
Window client_window;
Window focus_window;
gint32 input_style;
@@ -327,6 +329,18 @@ _xim_store_ic_values (X11IC *x11ic, IMChangeICStruct *call_data)
return 1;
}
+static void
+ibus_ic_connection_closed_cb (GDBusConnection *connection,
+ gboolean remote_peer_vanished,
+ GError *error,
+ X11IC *x11ic)
+{
+ /* rhbz#2195895 The moment of the IBusBus disconnection would be
+ * different from the moment of XIM_DISCONNECT.
+ */
+ x11ic->ibus_connected = FALSE;
+}
+
static int
xim_create_ic (XIMS xims, IMChangeICStruct *call_data)
@@ -334,6 +348,7 @@ xim_create_ic (XIMS xims, IMChangeICStruct *call_data)
static int base_icid = 1;
X11IC *x11ic;
guint32 capabilities = IBUS_CAP_FOCUS;
+ GDBusConnection *connection;
call_data->icid = base_icid ++;
@@ -345,8 +360,9 @@ xim_create_ic (XIMS xims, IMChangeICStruct *call_data)
x11ic->icid = call_data->icid;
x11ic->connect_id = call_data->connect_id;
- x11ic->conn = (X11ICONN *)g_hash_table_lookup (_connections,
- GINT_TO_POINTER ((gint) call_data->connect_id));
+ x11ic->conn = (X11ICONN *)g_hash_table_lookup (
+ _connections,
+ GINT_TO_POINTER ((gint) call_data->connect_id));
if (x11ic->conn == NULL) {
g_slice_free (X11IC, x11ic);
g_return_val_if_reached (0);
@@ -376,6 +392,10 @@ xim_create_ic (XIMS xims, IMChangeICStruct *call_data)
G_CALLBACK (_context_enabled_cb), x11ic);
g_signal_connect (x11ic->context, "disabled",
G_CALLBACK (_context_disabled_cb), x11ic);
+ connection = g_dbus_proxy_get_connection (G_DBUS_PROXY (x11ic->context));
+ x11ic->ibus_connected = !g_dbus_connection_is_closed (connection);
+ g_signal_connect (connection, "closed",
+ G_CALLBACK (ibus_ic_connection_closed_cb), x11ic);
if (x11ic->input_style & XIMPreeditCallbacks)
@@ -400,11 +420,19 @@ xim_destroy_ic (XIMS xims, IMChangeICStruct *call_data)
LOG (1, "XIM_DESTROY_IC ic=%d connect_id=%d",
call_data->icid, call_data->connect_id);
- x11ic = (X11IC *)g_hash_table_lookup (_x11_ic_table,
- GINT_TO_POINTER ((gint) call_data->icid));
+ x11ic = (X11IC *)g_hash_table_lookup (
+ _x11_ic_table,
+ GINT_TO_POINTER ((gint) call_data->icid));
g_return_val_if_fail (x11ic != NULL, 0);
if (x11ic->context) {
+ GDBusConnection *connection =
+ g_dbus_proxy_get_connection (G_DBUS_PROXY (x11ic->context));
+ x11ic->ibus_connected = FALSE;
+ g_signal_handlers_disconnect_by_func (
+ connection,
+ (GCallback)ibus_ic_connection_closed_cb,
+ x11ic);
ibus_proxy_destroy ((IBusProxy *)x11ic->context);
g_object_unref (x11ic->context);
x11ic->context = NULL;
@@ -412,7 +440,8 @@ xim_destroy_ic (XIMS xims, IMChangeICStruct *call_data)
g_hash_table_remove (_x11_ic_table,
GINT_TO_POINTER ((gint) call_data->icid));
- x11ic->conn->clients = g_list_remove (x11ic->conn->clients, (gconstpointer)x11ic);
+ x11ic->conn->clients = g_list_remove (x11ic->conn->clients,
+ (gconstpointer)x11ic);
g_free (x11ic->preedit_string);
x11ic->preedit_string = NULL;
@@ -439,6 +468,8 @@ xim_set_ic_focus (XIMS xims, IMChangeFocusStruct *call_data)
x11ic = (X11IC *) g_hash_table_lookup (_x11_ic_table,
GINT_TO_POINTER ((gint) call_data->icid));
g_return_val_if_fail (x11ic != NULL, 0);
+ if (!x11ic->ibus_connected)
+ return 1;
ibus_input_context_focus_in (x11ic->context);
_xim_set_cursor_location (x11ic);
@@ -458,6 +489,8 @@ xim_unset_ic_focus (XIMS xims, IMChangeFocusStruct *call_data)
x11ic = (X11IC *) g_hash_table_lookup (_x11_ic_table,
GINT_TO_POINTER ((gint) call_data->icid));
g_return_val_if_fail (x11ic != NULL, 0);
+ if (!x11ic->ibus_connected)
+ return 1;
ibus_input_context_focus_out (x11ic->context);
@@ -712,6 +745,8 @@ xim_forward_event (XIMS xims, IMForwardEventStruct *call_data)
_x11_ic_table,
GINT_TO_POINTER ((gint) call_data->icid));
g_return_val_if_fail (x11ic != NULL, 0);
+ if (!x11ic->ibus_connected)
+ return 0;
xevent = (XKeyEvent*) &(call_data->event);
@@ -870,6 +905,8 @@ _xim_set_cursor_location (X11IC *x11ic)
}
}
+ if (!x11ic->ibus_connected)
+ return;
ibus_input_context_set_cursor_location (x11ic->context,
preedit_area.x,
preedit_area.y,
@@ -950,6 +987,8 @@ xim_reset_ic (XIMS xims, IMResetICStruct *call_data)
x11ic = (X11IC *) g_hash_table_lookup (_x11_ic_table,
GINT_TO_POINTER ((gint) call_data->icid));
g_return_val_if_fail (x11ic != NULL, 0);
+ if (!x11ic->ibus_connected)
+ return 1;
ibus_input_context_reset (x11ic->context);
@@ -1309,7 +1348,12 @@ _atexit_cb ()
static void
_sighandler (int sig)
{
- exit(EXIT_FAILURE);
+ /* rhbz#1767691 _sighandler() is called with SIGTERM
+ * and exit() causes SEGV during calling atexit functions.
+ * _atexit_cb() might be broken. _exit() does not call
+ * atexit functions.
+ */
+ _exit(EXIT_FAILURE);
}
static void
diff --git a/portal/portal.c b/portal/portal.c
index c2e4fc7f..76ef4f0a 100644
--- a/portal/portal.c
+++ b/portal/portal.c
@@ -90,6 +90,11 @@ static void portal_context_g_signal (GDBusProxy *proxy,
GVariant *parameters,
IBusPortalContext *portal_context);
+#define IBUS_TYPE_PORTAL_CONTEXT \
+ (ibus_portal_context_get_type ())
+#define IBUS_IS_PORTAL_CONTEXT(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IBUS_TYPE_PORTAL_CONTEXT))
+
G_DEFINE_TYPE_WITH_CODE (IBusPortalContext,
ibus_portal_context,
IBUS_DBUS_TYPE_INPUT_CONTEXT_SKELETON,
@@ -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;
+ /* rhbz#2151344 portal_context might not be finalized? */
+ if (!G_LIKELY (IBUS_IS_PORTAL_CONTEXT (portal_context))) {
+ g_warn_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC,
+ "portal_context is not IBusPortalContext");
+ continue;
+ }
if (g_strcmp0 (portal_context->owner, name) == 0) {
g_object_unref (portal_context);
}
diff --git a/src/ibusbus.c b/src/ibusbus.c
index 0e6d67f1..fcc742b6 100644
--- a/src/ibusbus.c
+++ b/src/ibusbus.c
@@ -742,6 +742,12 @@ ibus_bus_destroy (IBusObject *object)
_bus = NULL;
if (bus->priv->monitor) {
+ /* rhbz#1795499 _changed_cb() causes SEGV because of no bus->priv
+ * after ibus_bus_destroy() is called.
+ */
+ g_signal_handlers_disconnect_by_func (bus->priv->monitor,
+ (GCallback) _changed_cb, bus);
+ g_file_monitor_cancel (bus->priv->monitor);
g_object_unref (bus->priv->monitor);
bus->priv->monitor = NULL;
}
diff --git a/ui/gtk3/extension.vala b/ui/gtk3/extension.vala
index a6f2e8e6..b7a04081 100644
--- a/ui/gtk3/extension.vala
+++ b/ui/gtk3/extension.vala
@@ -73,6 +73,10 @@ class ExtensionGtk : Gtk.Application {
string signal_name,
Variant parameters) {
debug("signal_name = %s", signal_name);
+ /* rhbz#1797120 Fix assert(bus.is_connected()) in
+ * panel_binding_construct()
+ */
+ return_if_fail(m_bus.is_connected());
m_panel = new PanelBinding(m_bus, this);
m_panel.load_settings();
}
diff --git a/ui/gtk3/switcher.vala b/ui/gtk3/switcher.vala
index e3fab8d9..a827094f 100644
--- a/ui/gtk3/switcher.vala
+++ b/ui/gtk3/switcher.vala
@@ -176,8 +176,8 @@ class Switcher : Gtk.Window {
IBus.EngineDesc[] engines,
int index,
string input_context_path) {
- assert (m_loop == null);
- assert (index < engines.length);
+ assert(m_loop == null);
+ assert(index < engines.length);
if (m_is_running)
return index;
@@ -236,16 +236,18 @@ class Switcher : Gtk.Window {
null,
event,
null);
- if (status != Gdk.GrabStatus.SUCCESS)
+ if (status != Gdk.GrabStatus.SUCCESS) {
warning("Grab keyboard failed! status = %d", status);
- status = seat.grab(get_window(),
- Gdk.SeatCapabilities.POINTER,
- true,
- null,
- event,
- null);
- if (status != Gdk.GrabStatus.SUCCESS)
- warning("Grab pointer failed! status = %d", status);
+ } else {
+ status = seat.grab(get_window(),
+ Gdk.SeatCapabilities.POINTER,
+ true,
+ null,
+ event,
+ null);
+ if (status != Gdk.GrabStatus.SUCCESS)
+ warning("Grab pointer failed! status = %d", status);
+ }
#else
Gdk.Device device = event.get_device();
if (device == null) {
@@ -281,30 +283,41 @@ class Switcher : Gtk.Window {
Gdk.EventMask.KEY_RELEASE_MASK,
null,
Gdk.CURRENT_TIME);
- if (status != Gdk.GrabStatus.SUCCESS)
+ if (status != Gdk.GrabStatus.SUCCESS) {
warning("Grab keyboard failed! status = %d", status);
- // Grab all pointer events
- status = pointer.grab(get_window(),
- Gdk.GrabOwnership.NONE,
- true,
- Gdk.EventMask.BUTTON_PRESS_MASK |
- Gdk.EventMask.BUTTON_RELEASE_MASK,
- null,
- Gdk.CURRENT_TIME);
- if (status != Gdk.GrabStatus.SUCCESS)
- warning("Grab pointer failed! status = %d", status);
+ } else {
+ // Grab all pointer events
+ status = pointer.grab(get_window(),
+ Gdk.GrabOwnership.NONE,
+ true,
+ Gdk.EventMask.BUTTON_PRESS_MASK |
+ Gdk.EventMask.BUTTON_RELEASE_MASK,
+ null,
+ Gdk.CURRENT_TIME);
+ if (status != Gdk.GrabStatus.SUCCESS)
+ warning("Grab pointer failed! status = %d", status);
+ }
#endif
- // Probably we can delete m_popup_delay_time in 1.6
- pointer.get_position_double(null,
- out m_mouse_init_x,
- out m_mouse_init_y);
- m_mouse_moved = false;
+ /* Fix RHBZ #1771238 assert(m_loop == null)
+ * Grabbing keyboard can be failed when the second Super-e is typed
+ * before Switcher dialog is focused. And m_loop could not be released
+ * if the failed Super-e would call m_loop.run() below and could not
+ * call key_release_event(). And m_loop == null would be false in the
+ * third Super-e.
+ */
+ if (status == Gdk.GrabStatus.SUCCESS) {
+ // Probably we can delete m_popup_delay_time in 1.6
+ pointer.get_position_double(null,
+ out m_mouse_init_x,
+ out m_mouse_init_y);
+ m_mouse_moved = false;
- m_loop = new GLib.MainLoop();
- m_loop.run();
- m_loop = null;
+ m_loop = new GLib.MainLoop();
+ m_loop.run();
+ m_loop = null;
+ }
#if VALA_0_34
seat.ungrab();
--
2.41.0

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,22 @@
XIM=ibus
XIM_PROGRAM="/usr/bin/ibus-daemon"
ICON="ibus"
XIM_ARGS="-r --xim"
PREFERENCE_PROGRAM=/usr/bin/ibus-setup
SHORT_DESC="IBus"
GTK_IM_MODULE=ibus
NOT_RUN=gnome3
# IMSETTINGS_IGNORE_SESSION concatenate the current session name and type x11 or
# wayland. The current session name is calculated by get_destop()
# in /usr/libexec/imsettings-functions and the value is case-sensitive.
IMSETTINGS_IGNORE_SESSION=KDE-wayland
if test -f /usr/lib64/qt5/plugins/platforminputcontexts/libibusplatforminputcontextplugin.so || \
test -f /usr/lib/qt5/plugins/platforminputcontexts/libibusplatforminputcontextplugin.so || \
test -f /usr/lib64/qt4/plugins/inputmethods/libqtim-ibus.so || \
test -f /usr/lib/qt4/plugins/inputmethods/libqtim-ibus.so;
then
QT_IM_MODULE=ibus
else
QT_IM_MODULE=xim
fi

View File

@ -0,0 +1,37 @@
From d63da885f8f4e3764b8b572347b70a0cefadc335 Mon Sep 17 00:00:00 2001
From: fujiwarat <takao.fujiwara1@gmail.com>
Date: Fri, 11 Feb 2022 11:43:57 +0900
Subject: [PATCH] src/tests: Change window manager to mutter for RHEL
---
src/tests/ibus-desktop-testing-runner.in | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/tests/ibus-desktop-testing-runner.in b/src/tests/ibus-desktop-testing-runner.in
index 54b7e0d7..211e0da5 100755
--- a/src/tests/ibus-desktop-testing-runner.in
+++ b/src/tests/ibus-desktop-testing-runner.in
@@ -45,7 +45,7 @@ TEST_LOG_STDOUT=0
SCREEN_LOG=""
HAVE_GRAPHICS=1
VERBOSE=0
-DESKTOP_COMMAND="dbus-launch --exit-with-session gnome-session"
+DESKTOP_COMMAND="dbus-launch --exit-with-session mutter"
PID_XORG=0
PID_GNOME_SESSION=0
TESTING_RUNNER="default"
@@ -81,9 +81,9 @@ usage()
"-s, --srcdir=SOURCEDIR Set the SOURCEDIR\n" \
"-c, --no-graphics Use Xvfb instead of Xorg\n" \
"-V, --verbose Verbose log for ibus-daemon\n" \
-"-d, --desktop=DESKTOP Run DESTKTOP. The default is gnome-session.\n" \
+"-d, --desktop=DESKTOP Run DESTKTOP. The default is mutter.\n" \
" Suffix '-with-dbus' can run DESKTOP with dbus session." \
-" E.g. --desktop=mutter-with-dbus" \
+" E.g. --desktop=gnome-session-with-dbus" \
"-t, --tests=\"TESTS...\" Run TESTS programs which is separated by space\n" \
"-r, --runner=RUNNER Run TESTS programs with a test RUNNER.\n" \
" RUNNDER = gnome or default.\n" \
--
2.28.0

View File

@ -0,0 +1,73 @@
.\" This file is distributed under the same license as the ibus
.\" package.
.\" Copyright (C) Takao Fujiwara <takao.fujiwara1@gmail.com>, 2013.
.\"
.TH IBUS.CONF "5" "August 2013" "1.5.3" "User Commands"
.SH NAME
.B ibus.conf
\- X input preload/configuration file for ibus
.SH SYNOPSIS
.B /etc/X11/xinit/xinput.d/ibus.conf
.SH DESCRIPTION
.PP
IBus is an Intelligent Input Bus. It is a new input framework for Linux
OS. It provides full featured and user friendly input method user
interface. It also may help developers to develop input method easily.
.PP
.B ibus.conf
is a configuration file containing X input setting values to be read in
and set by /etc/X11/xinit/xinitrc\-common.
.I imsettings-switch(1)
is called from XDG auto\-start and invokes
xinitrc\-common.
.LP
If this file is the alias of
.I /etc/X11/xinit/xinputrc
for the system setting
or
.I [$XDG_CONFIG_HOME|$HOME/.config]/imsettings/xinputrc
for the user setting, the setting can be default.
.I im\-chooser(1)
can choose the user setting.
.LP
The configuration options are:
.TP
\fBXIM\fP
XIM name for XMODIFIERS
.TP
\fBXIM_PROGRAM\fP
XIM executable program name
.TP
\fBXIM_ARGS\fP
XIM arguments for XIM_PROGRAM
.TP
\fBSHORT_DESC\fP
XIM human readable name for
.I im\-chooser(1)
.TP
\fBICON\fP
icon file for
.I im\-chooser(1)
.TP
\fBPREFERENCE_PROGRAM\fP
XIM setup program for
.I im\-chooser(1)
.TP
\fBGTK_IM_MODULE\fP
IM environment valuable for GTK+ applications.
.TP
\fBQT_IM_MODULE\fP
IM environment valuable for QT applications.
.SH BUGS
If you find a bug, please report it at http://code.google.com/p/ibus/issues/list
.SH "SEE ALSO"
.BR ibus\-daemon (1)
.BR imsettings\-switch (1)
.BR im\-chooser (1)
.BR X (7)

2318
spec_files/ibus/ibus.spec Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,3 @@
role_pkgs_req:
- rsync
- xorg-x11-server-Xvfb

View File

@ -0,0 +1,68 @@
#!/bin/bash
TEST_LOG="test.log"
TEST_RUN_IN_RAWHIDE=1
declare -i TEST_RUN_IN_RAWHIDE
if [ $# -gt 0 ] ; then
TEST_LOG="$1"
TEST_RUN_IN_RAWHIDE=$2
fi
gen_results()
{
TEST_RUNTIME="$1"
TEST_STATUS="$2"
TEST_STATUS_UPPER="$(echo "$TEST_STATUS" | tr '[:lower:]' '[:upper:]')"
cat > results.xml << _EOF
results:
- test: results
result: $TEST_STATUS
runtime: $TEST_RUNTIME
logs:
- ${TEST_STATUS_UPPER}-str_results.log
_EOF
DIR=$(dirname "$TEST_LOG")
if [ x"$TEST_LOG" != x ] ; then
cp "$TEST_LOG" "$DIR/${TEST_STATUS_UPPER}-str_results.log"
else
touch "$DIR/${TEST_STATUS_UPPER}-str_results.log"
fi
if [ x"$DIR" != x. ] ; then
mv results.xml "$DIR"
fi
}
if [ $TEST_RUN_IN_RAWHIDE -eq 0 ] ; then
if grep -q -i rawhide /etc/fedora-release &> /dev/null ; then
gen_results "0" "pass"
echo -n PASS
exit 0
fi
fi
if [ ! -f $TEST_LOG ] ; then
gen_results "0" "fail"
echo -n ERROR
else
FAIL="$(grep "^FAIL: " $TEST_LOG | grep -v 'FAIL: 0$')"
RUNTIME_FAIL="$(grep -v 'frame' $TEST_LOG | grep "^FAIL: " | sed -e "s/FAIL: //")"
RUNTIME_PASS="$(grep -v 'frame' $TEST_LOG | grep "^PASS: " | sed -e "s/PASS: //")"
if [ x"$RUNTIME_FAIL" = x ] ; then
RUNTIME_FAIL="0"
fi
if [ x"$RUNTIME_PASS" = x ] ; then
RUNTIME_PASS="0"
fi
RUNTIME="$(expr $RUNTIME_FAIL + $RUNTIME_PASS)"
if [ x"$FAIL" != x ] ; then
gen_results "$RUNTIME" "fail"
echo -n ERROR
else
gen_results "$RUNTIME" "pass"
echo -n PASS
fi
fi

View File

@ -0,0 +1,4 @@
---
dependencies:
- role: str-common-init

View File

@ -0,0 +1,214 @@
---
- name: Check if Fedora desktop
register: fedora_desktop
stat:
path: "/etc/fedora-release"
- name: Build and install GNOME installed-tests testing harness
block:
- name: Installing common GNOME desktop components
package:
name:
# IBus CI sets
- xorg-x11-server-Xvfb
- ibus
- ibus-desktop-testing
- dbus-x11
# https://pagure.io/fedora-comps/blob/main/f/comps-f38.xml.in
# dnf group info GNOME
# mandatory
- dconf
- gdm
- gnome-connections
- gnome-control-center
- gnome-initial-setup
- gnome-session-wayland-session
- gnome-session-xsession
- gnome-settings-daemon
- gnome-shell
- gnome-software
- gnome-terminal
- gnome-text-editor
- nautilus
- polkit
# default
- adobe-source-code-pro-fonts
- at-spi2-atk
- at-spi2-core
- avahi
- baobab
# Sometimes version mismatch with gnome-shell in rawhide
#- chrome-gnome-shell
- evince
- fprintd-pam
- glib-networking
- gnome-bluetooth
- gnome-calculator
- gnome-characters
- gnome-classic-session
- gnome-clocks
- gnome-color-manager
- gnome-disk-utility
- gnome-font-viewer
- gnome-logs
- gnome-remote-desktop
- gnome-system-monitor
- gnome-terminal-nautilus
- gnome-user-docs
- gvfs-fuse
- gvfs-goa
- gvfs-gphoto2
- gvfs-mtp
- gvfs-smb
- libcanberra-gtk3
- libproxy-duktape
- librsvg2
- libsane-hpaio
- mesa-dri-drivers
- mesa-libEGL
- ModemManager
- NetworkManager-adsl
- NetworkManager-ppp
- NetworkManager-wwan
- orca
- PackageKit-command-not-found
- PackageKit-gtk3-module
- sane-backends-drivers-scanners
- systemd-oomd-defaults
- tracker
- tracker-miners
- xdg-desktop-portal
- xdg-desktop-portal-gnome
- xdg-desktop-portal-gtk
- xdg-user-dirs-gtk
- name: Installing Fedora specific GNOME desktop components
when: fedora_desktop.stat.exists == true
package:
name:
- gnome-screenshot
- gnome-boxes
- yelp
- cheese
- eog
- evince-djvu
- gnome-backgrounds
- gnome-contacts
- gnome-maps
- gnome-photos
- gnome-themes-extra
- gnome-user-share
- gnome-weather
- gvfs-afc
- gvfs-afp
- gvfs-archive
- NetworkManager-openconnect-gnome
- NetworkManager-openvpn-gnome
- NetworkManager-pptp-gnome
- NetworkManager-ssh-gnome
- NetworkManager-vpnc-gnome
- rygel
- simple-scan
- sushi
- totem
- name: Installing GNOME installed-tests testing harness
when: fedora_desktop.stat.exists == true
package:
name:
- gnome-desktop-testing
- name: Installing build environment
when: fedora_desktop.stat.exists == false
package:
name:
- autoconf
- automake
- make
- gcc
- git
- libtool
- name: Fetching GNOME installed-tests testing harness source from remote repository
when: fedora_desktop.stat.exists == false
git:
repo: 'https://gitlab.gnome.org/GNOME/gnome-desktop-testing.git'
dest: gnome-desktop-testing
force: yes
- name: Checkout v2021.1 tag in GNOME installed-tests testing harness
when: fedora_desktop.stat.exists == false
command: git checkout -b v2021.1 refs/tags/v2021.1
args:
chdir: gnome-desktop-testing
- name: Configure GNOME installed-tests testing harness build
when: fedora_desktop.stat.exists == false
command: ./autogen.sh --prefix=/usr --sysconfdir=/etc --localstatedir=/var
args:
chdir: gnome-desktop-testing
- name: Build GNOME installed-tests testing harness
when: fedora_desktop.stat.exists == false
command: make
args:
chdir: gnome-desktop-testing
- name: Install GNOME installed-tests testing harness
when: fedora_desktop.stat.exists == false
command: make install
args:
chdir: gnome-desktop-testing
- name: Start IBus installed-tests testing harness
environment:
ANSIBLE: 1
TMPDIR: '{{ remote_artifacts }}'
G_MESSAGES_DEBUG: 'all'
LANG: 'C.UTF-8'
block:
- name: Execute IBus tests
shell: |
set -e
# Delete LC_CTYPE=C.UTF-8
export -n LC_CTYPE
status="FAIL: frame"
ibus-desktop-testing-runner \
--no-graphics \
--runner=gnome \
--tests='{{ installed_test_name }}' \
--output='{{ remote_artifacts }}/{{ installed_test_name }}.log' \
--result='{{ remote_artifacts }}/test.log' \
null
if [ $? -eq 0 ]; then
status="PASS: frame"
fi
if [ -f /var/tmp/ibus-ci-autostart.log ] ; then
echo "#### /var/tmp/ibus-ci-autostart.log"
cat /var/tmp/ibus-ci-autostart.log
rm /var/tmp/ibus-ci-autostart.log
echo "#"
fi
echo "${status}" >> {{ remote_artifacts }}/test.log
echo "#### {{ remote_artifacts }}/{{ installed_test_name }}.log"
if [ -f {{ remote_artifacts }}/{{ installed_test_name }}.log ] ; then
cat {{ remote_artifacts }}/{{ installed_test_name }}.log
fi
echo "#"
echo "#### {{ remote_artifacts }}/test.log"
if [ -f {{ remote_artifacts }}/test.log ] ; then
cat {{ remote_artifacts }}/test.log
fi
echo "#"
- name: Check the results
script: check-results.sh "{{ remote_artifacts }}/test.log" "0"
register: test_fails
failed_when: '"ERROR" in test_fails.stdout'
- name: Set role result
set_fact:
role_result: "{{ test_fails.stdout }}"
role_result_failed: "{{ (test_fails.stdout|d|length > 0) or (test_fails.stderr|d|length > 0) }}"
role_result_msg: "{{ test_fails.stdout|d('tests failed.') }}"
- include_role:
name: str-common-final

View File

@ -0,0 +1,14 @@
- hosts: localhost
roles:
- role: ibus-desktop-testing-role
installed_test_name: ibus
tags:
- classic
- gating
required_packages:
- ibus-tests
# ibus-compose test needs locales
- glibc-langpack-el
- glibc-langpack-fi
- glibc-langpack-pt