Toshaan Bharvani
3 years ago
commit
b5dc20bd3e
6 changed files with 2550 additions and 0 deletions
@ -0,0 +1,403 @@ |
|||||||
|
From 41c325dfb32269c9aadfeedb4df44656aac4d883 Mon Sep 17 00:00:00 2001 |
||||||
|
From: fujiwarat <takao.fujiwara1@gmail.com> |
||||||
|
Date: Fri, 20 Nov 2020 09:53:54 +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#1601577 rhbz#1797726 SEGV in ibus_engine_desc_get_layout() in |
||||||
|
bus_engine_proxy_new_internal() |
||||||
|
WIP: Added 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#1795499 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() |
||||||
|
|
||||||
|
BUG=rhbz#1350291 |
||||||
|
BUG=rhbz#1601577 |
||||||
|
BUG=rhbz#1663528 |
||||||
|
BUG=rhbz#1767691 |
||||||
|
BUG=rhbz#1795499 |
||||||
|
BUG=rhbz#1771238 |
||||||
|
BUG=rhbz#1767976 |
||||||
|
BUG=rhbz#1797120 |
||||||
|
--- |
||||||
|
bus/dbusimpl.c | 47 ++++++++++++++++++++++++--- |
||||||
|
bus/engineproxy.c | 51 ++++++++++++++++++++++------- |
||||||
|
client/x11/main.c | 8 ++++- |
||||||
|
src/ibusbus.c | 5 +++ |
||||||
|
ui/gtk3/extension.vala | 4 +++ |
||||||
|
ui/gtk3/switcher.vala | 73 +++++++++++++++++++++++++----------------- |
||||||
|
6 files changed, 141 insertions(+), 47 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 2d98995c..bbbe5532 100644 |
||||||
|
--- a/bus/engineproxy.c |
||||||
|
+++ b/bus/engineproxy.c |
||||||
|
@@ -660,20 +660,33 @@ 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; |
||||||
|
+ |
||||||
|
g_assert (path); |
||||||
|
g_assert (IBUS_IS_ENGINE_DESC (desc)); |
||||||
|
g_assert (G_IS_DBUS_CONNECTION (connection)); |
||||||
|
+ g_assert (error && *error == NULL); |
||||||
|
|
||||||
|
- GDBusProxyFlags flags = G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START; |
||||||
|
- BusEngineProxy *engine = |
||||||
|
+ /* 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, |
||||||
|
@@ -681,12 +694,19 @@ 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); |
||||||
|
} |
||||||
|
return engine; |
||||||
|
} |
||||||
|
+#pragma GCC reset_options |
||||||
|
|
||||||
|
typedef struct { |
||||||
|
GTask *task; |
||||||
|
@@ -748,23 +768,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/client/x11/main.c b/client/x11/main.c |
||||||
|
index c9ee174d..768b91f0 100644 |
||||||
|
--- a/client/x11/main.c |
||||||
|
+++ b/client/x11/main.c |
||||||
|
@@ -40,6 +40,7 @@ |
||||||
|
#include <iconv.h> |
||||||
|
#include <signal.h> |
||||||
|
#include <stdlib.h> |
||||||
|
+#include <unistd.h> |
||||||
|
|
||||||
|
#include <getopt.h> |
||||||
|
|
||||||
|
@@ -1104,7 +1105,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/src/ibusbus.c b/src/ibusbus.c |
||||||
|
index b7ffbb47..668c8a26 100644 |
||||||
|
--- a/src/ibusbus.c |
||||||
|
+++ b/src/ibusbus.c |
||||||
|
@@ -689,6 +689,11 @@ 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_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 a4529c88..29a70dd5 100644 |
||||||
|
--- a/ui/gtk3/switcher.vala |
||||||
|
+++ b/ui/gtk3/switcher.vala |
||||||
|
@@ -140,8 +140,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); |
||||||
|
|
||||||
|
m_is_running = true; |
||||||
|
m_keyval = keyval; |
||||||
|
@@ -198,16 +198,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) { |
||||||
|
@@ -243,30 +245,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.24.1 |
||||||
|
|
@ -0,0 +1,154 @@ |
|||||||
|
From 571e3b6e4f386abf12d3db70b9468e092c8d72bd Mon Sep 17 00:00:00 2001 |
||||||
|
From: Alynx Zhou <alynx.zhou@gmail.com> |
||||||
|
Date: Tue, 24 Aug 2021 10:12:52 +0800 |
||||||
|
Subject: [PATCH] client/gtk2/ibusimcontext: Fix wrong cursor location in gtk3 |
||||||
|
apps |
||||||
|
|
||||||
|
If you apply this patch in your tarball, please also apply this to |
||||||
|
client/gtk3/ibusimcontext.c besides client/gtk2/ibusimcontext.c . |
||||||
|
|
||||||
|
BUG=https://github.com/ibus/ibus/issues/2337 |
||||||
|
--- |
||||||
|
client/gtk2/ibusimcontext.c | 5 ++++- |
||||||
|
1 file changed, 4 insertions(+), 1 deletion(-) |
||||||
|
|
||||||
|
diff --git a/client/gtk2/ibusimcontext.c b/client/gtk2/ibusimcontext.c |
||||||
|
index da9a402f..b1ccede9 100644 |
||||||
|
--- a/client/gtk2/ibusimcontext.c |
||||||
|
+++ b/client/gtk2/ibusimcontext.c |
||||||
|
@@ -1497,7 +1497,10 @@ _set_cursor_location_internal (IBusIMContext *ibusimcontext) |
||||||
|
|
||||||
|
#if GTK_CHECK_VERSION (3, 98, 4) |
||||||
|
#elif GTK_CHECK_VERSION (2, 91, 0) |
||||||
|
- area.y += gdk_window_get_height (ibusimcontext->client_window); |
||||||
|
+ if (area.x == -1 && area.y == -1 && area.width == 0 && area.height == 0) { |
||||||
|
+ area.x = 0; |
||||||
|
+ area.y += gdk_window_get_height (ibusimcontext->client_window); |
||||||
|
+ } |
||||||
|
#else |
||||||
|
if (area.x == -1 && area.y == -1 && area.width == 0 && area.height == 0) { |
||||||
|
gint w, h; |
||||||
|
-- |
||||||
|
2.31.1 |
||||||
|
|
||||||
|
From 5487a6baa4b22605ba8197ca1a0fa43c91d57786 Mon Sep 17 00:00:00 2001 |
||||||
|
From: fujiwarat <takao.fujiwara1@gmail.com> |
||||||
|
Date: Mon, 6 Sep 2021 20:23:59 +0900 |
||||||
|
Subject: [PATCH] client/gtk2/ibusimcontext: Implement clear preedit for GTK4 |
||||||
|
|
||||||
|
IBus IM module uses synchornized key processes for GTK4 and the timing |
||||||
|
of the GTK reset siginal may work with focus-in/out between windows. |
||||||
|
(I don't test GTK4 firefox and terminal yet and the verification is not |
||||||
|
completed.) |
||||||
|
So ibus_im_context_clear_preedit_text() is now called with the GTK4 reset |
||||||
|
siginal. |
||||||
|
ibus_im_context_clear_preedit_text() works with ibus-setup-anthy -> |
||||||
|
"Conversion" tab -> "Behavior on Focus Out" pull down menu. |
||||||
|
|
||||||
|
BUG=https://github.com/ibus/ibus/issues/2334 |
||||||
|
--- |
||||||
|
client/gtk2/ibusimcontext.c | 9 ++++++--- |
||||||
|
1 file changed, 6 insertions(+), 3 deletions(-) |
||||||
|
|
||||||
|
diff --git a/client/gtk2/ibusimcontext.c b/client/gtk2/ibusimcontext.c |
||||||
|
index b1ccede9..e12be45d 100644 |
||||||
|
--- a/client/gtk2/ibusimcontext.c |
||||||
|
+++ b/client/gtk2/ibusimcontext.c |
||||||
|
@@ -1270,6 +1270,8 @@ ibus_im_context_reset (GtkIMContext *context) |
||||||
|
* IBus uses button-press-event instead until GTK is fixed. |
||||||
|
* https://gitlab.gnome.org/GNOME/gtk/issues/1534 |
||||||
|
*/ |
||||||
|
+ if (_use_sync_mode) |
||||||
|
+ ibus_im_context_clear_preedit_text (ibusimcontext); |
||||||
|
ibus_input_context_reset (ibusimcontext->ibuscontext); |
||||||
|
} |
||||||
|
gtk_im_context_reset (ibusimcontext->slave); |
||||||
|
@@ -1383,7 +1385,7 @@ ibus_im_context_set_client_window (GtkIMContext *context, |
||||||
|
|
||||||
|
if (ibusimcontext->client_window) { |
||||||
|
#if !GTK_CHECK_VERSION (3, 98, 4) |
||||||
|
- if (ibusimcontext->use_button_press_event) |
||||||
|
+ if (ibusimcontext->use_button_press_event && !_use_sync_mode) |
||||||
|
_connect_button_press_event (ibusimcontext, FALSE); |
||||||
|
#endif |
||||||
|
g_object_unref (ibusimcontext->client_window); |
||||||
|
@@ -1393,7 +1395,7 @@ ibus_im_context_set_client_window (GtkIMContext *context, |
||||||
|
if (client != NULL) { |
||||||
|
ibusimcontext->client_window = g_object_ref (client); |
||||||
|
#if !GTK_CHECK_VERSION (3, 98, 4) |
||||||
|
- if (!ibusimcontext->use_button_press_event) |
||||||
|
+ if (!ibusimcontext->use_button_press_event && !_use_sync_mode) |
||||||
|
_connect_button_press_event (ibusimcontext, TRUE); |
||||||
|
#endif |
||||||
|
} |
||||||
|
@@ -1994,7 +1996,8 @@ _ibus_context_update_preedit_text_cb (IBusInputContext *ibuscontext, |
||||||
|
|
||||||
|
#if !GTK_CHECK_VERSION (3, 98, 4) |
||||||
|
if (!ibusimcontext->use_button_press_event && |
||||||
|
- mode == IBUS_ENGINE_PREEDIT_COMMIT) { |
||||||
|
+ mode == IBUS_ENGINE_PREEDIT_COMMIT && |
||||||
|
+ !_use_sync_mode) { |
||||||
|
if (ibusimcontext->client_window) { |
||||||
|
_connect_button_press_event (ibusimcontext, TRUE); |
||||||
|
} |
||||||
|
-- |
||||||
|
2.28.0 |
||||||
|
|
||||||
|
From 4957d1468db4fc5ed30c3ae1f2afac9e51b329d6 Mon Sep 17 00:00:00 2001 |
||||||
|
From: fujiwarat <takao.fujiwara1@gmail.com> |
||||||
|
Date: Mon, 6 Sep 2021 20:25:52 +0900 |
||||||
|
Subject: [PATCH] client/gtk2/ibusimcontext: Calculate keycode from keysym in |
||||||
|
GTK3 forward-key-event |
||||||
|
|
||||||
|
IBus GTK3 mode also calculates keycode from keysym if keycode == 0 |
||||||
|
with forward-key-event signal to follow GTK4. |
||||||
|
--- |
||||||
|
client/gtk2/ibusimcontext.c | 22 ++++++++++++++++++---- |
||||||
|
1 file changed, 18 insertions(+), 4 deletions(-) |
||||||
|
|
||||||
|
diff --git a/client/gtk2/ibusimcontext.c b/client/gtk2/ibusimcontext.c |
||||||
|
index e12be45d..b1424e87 100644 |
||||||
|
--- a/client/gtk2/ibusimcontext.c |
||||||
|
+++ b/client/gtk2/ibusimcontext.c |
||||||
|
@@ -1939,13 +1939,16 @@ _ibus_context_forward_key_event_cb (IBusInputContext *ibuscontext, |
||||||
|
int group = 0; |
||||||
|
g_return_if_fail (GTK_IS_IM_CONTEXT (ibusimcontext)); |
||||||
|
if (keycode == 0 && ibusimcontext->client_window) { |
||||||
|
- GdkDisplay *display = gtk_widget_get_display (ibusimcontext->client_window); |
||||||
|
+ GdkDisplay *display = |
||||||
|
+ gtk_widget_get_display (ibusimcontext->client_window); |
||||||
|
GdkKeymapKey *keys = NULL; |
||||||
|
gint n_keys = 0; |
||||||
|
- if (!gdk_display_map_keyval (display, keyval, &keys, &n_keys)) |
||||||
|
+ if (gdk_display_map_keyval (display, keyval, &keys, &n_keys)) { |
||||||
|
+ keycode = keys->keycode; |
||||||
|
+ group = keys->group; |
||||||
|
+ } else { |
||||||
|
g_warning ("Failed to parse keycode from keyval %x", keyval); |
||||||
|
- keycode = keys->keycode; |
||||||
|
- group = keys->group; |
||||||
|
+ } |
||||||
|
} |
||||||
|
gtk_im_context_filter_key ( |
||||||
|
GTK_IM_CONTEXT (ibusimcontext), |
||||||
|
@@ -1957,6 +1960,17 @@ _ibus_context_forward_key_event_cb (IBusInputContext *ibuscontext, |
||||||
|
(GdkModifierType)state, |
||||||
|
group); |
||||||
|
#else |
||||||
|
+ if (keycode == 0 && ibusimcontext->client_window) { |
||||||
|
+ GdkDisplay *display = |
||||||
|
+ gdk_window_get_display (ibusimcontext->client_window); |
||||||
|
+ GdkKeymap *keymap = gdk_keymap_get_for_display (display); |
||||||
|
+ GdkKeymapKey *keys = NULL; |
||||||
|
+ gint n_keys = 0; |
||||||
|
+ if (gdk_keymap_get_entries_for_keyval (keymap, keyval, &keys, &n_keys)) |
||||||
|
+ keycode = keys->keycode; |
||||||
|
+ else |
||||||
|
+ g_warning ("Failed to parse keycode from keyval %x", keyval); |
||||||
|
+ } |
||||||
|
GdkEventKey *event = _create_gdk_event (ibusimcontext, keyval, keycode, state); |
||||||
|
gdk_event_put ((GdkEvent *)event); |
||||||
|
gdk_event_free ((GdkEvent *)event); |
||||||
|
-- |
||||||
|
2.28.0 |
||||||
|
|
@ -0,0 +1,18 @@ |
|||||||
|
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 |
||||||
|
|
||||||
|
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 |
@ -0,0 +1,37 @@ |
|||||||
|
From d63da885f8f4e3764b8b572347b70a0cefadc335 Mon Sep 17 00:00:00 2001 |
||||||
|
From: fujiwarat <takao.fujiwara1@gmail.com> |
||||||
|
Date: Wed, 16 Jun 2021 20:55:20 +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 |
||||||
|
@@ -44,7 +44,7 @@ TEST_LOG="test-suite.log" |
||||||
|
TEST_LOG_STDOUT=0 |
||||||
|
RESULT_LOG="" |
||||||
|
HAVE_GRAPHICS=1 |
||||||
|
-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" |
||||||
|
@@ -80,9 +80,9 @@ usage() |
||||||
|
"-b, --builddir=BUILDDIR Set the BUILDDIR\n" \ |
||||||
|
"-s, --srcdir=SOURCEDIR Set the SOURCEDIR\n" \ |
||||||
|
"-c, --no-graphics Use Xvfb instead of Xorg\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 |
||||||
|
|
@ -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) |
Loading…
Reference in new issue