Sync from SUSE:ALP:Source:Standard:1.0 ibus revision be89ef0c48e961bc3990b5ce7fb266ce

This commit is contained in:
Adrian Schröter 2024-10-14 14:29:31 +02:00
commit 0564ea09b4
22 changed files with 3119 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

View File

@ -0,0 +1,4 @@
[Service]
# For now, Plasma Wayland does not support /etc/xdg/Xwayland-session.d
# so always enable --xim
Environment="IBUS_DAEMON_ARGS=--xim"

72
README.SUSE Normal file
View File

@ -0,0 +1,72 @@
ibus README for SuSE
How to start using ibus
English:
0:Note: ibus don't support QT3 immodule,
If you use qt3-base applications, modify your /usr/etc/X11/xim.d/ibus to
export QT_IM_MODULE=xim
1.openSUSE can start ibus automatically when your locale is set to en, zh_TW, zh_CN, zh_HK, zh_SG, ko_KR and ja_JP.
The setup script is a link in /usr/etc/X11/xim.d/YOUR-LOCALE/40-ibus which link to /usr/etc/X11/xim.d/ibus.
The number "40" makes ibus have priority over other input-method (e.g 50-scim or 90-xcin ).
If you prefer not using ibus, mv 40-ibus to 80-ibus (for example). Or see 2.
2.If for some reason can't start ibus when login Xwindow
There is another input-method who has higher priority then ibus (e.g 10-oxim)
You can edit ~/.xim, see ~/.xim.template for more informations.
Or edit ~/.profile, add
export INPUT_METHOD="ibus"
After installing ibus, there's a template for ibus: /usr/share/doc/packages/ibus/xim.ibus.suse.template
copy this file to ~/.xim, then you can use ibus next login X.
3.You want to use your own input-method other than system setting
(1)System setting:
Edit /etc/sysconfig/language , set INPUT_METHOD="scim-bridge", or whatever you want,Make sure your start-up script is put in /usr/etc/X11/xim.d/ with same name ypu mention.
(2)For specific language setting:
Link a start-up script in /usr/etc/X11/xim.d/ to your locale with a higher priority (smaller number), eg
ln -s /usr/etc/X11/xim.d/scim-bridge /usr/etc/X11/xim.d/zh_TW/20-scim-bridge
(3)Personal setting:
Edit ~/.profile add
export INPUT_METHOD="scim-bridge" or whatever script in /usr/etc/X11/xim.d/
or white your own ~/.xim, see ~/.xim.template for more informations.
4.Bug report or any suggestion to
https://github.com/ibus/ibus/issues
Chinese:
0:注意ibus 不支援 QT3 immodule,
若您使用 qt3-based 應用程式,請修改 /usr/etc/X11/xim.d/ibus 設定
export QT_IM_MODULE=xim
1.當您使用的語系是en 或zh_*時SuSE 會自動啟動ibus
啟動的script是/usr/etc/X11/xim.d/YOUR-LOCALE/40-ibus這是一個到上層目錄ibus的連結
"40"這個數字使他的優先順序高於90-xcin及50-scim
如果您不喜歡這個順序,修改連結的名稱為(例如80-ibus)或參考2.
2.重新登入X後如果不能用ibus...可能是:
有別的輸入法的優先順序高於ibus(例如10-oxim)
您可以編輯~/.xim請參考~/.xim.template
安裝ibus後會有一個範本/usr/share/doc/packages/ibus/xim.ibus.suse.template
將這個檔案複製到您的~/.xim當您下次登入X時就可以使用ibus了
或編輯~/.profile加入
export INPUT_METHOD="ibus"
3.如果您想要自己選擇輸入法而非使用系統設定
(1)全系統設定:
編輯 /etc/sysconfig/language, 設定 INPUT_METHOD="ibus" 或其他你想用的輸入法,
請注意你的啟動程序必須位於 /usr/etc/X11/xim.d/,並和您指定的名稱相同
(2)針對特定語言:
將您的啟動程序連結到你的語系中,並前置較高的優先順序(較小數字),例如
ln -s /usr/etc/X11/xim.d/ibus /usr/etc/X11/xim.d/zh_TW/20-ibus
(3)個人設定:
編輯 ~/.profile 加入
export INPUT_METHOD="ibus" 或其他在 /usr/etc/X11/xim.d/ 的啟動程序
或自行編寫啟動程序 ~/.xim請參考 ~/.xim.template
5.臭蟲回報或建議請至
https://github.com/ibus/ibus/issues

4
_multibuild Normal file
View File

@ -0,0 +1,4 @@
<multibuild>
<package>gtk4</package>
</multibuild>

27
baselibs.conf Normal file
View File

@ -0,0 +1,27 @@
ibus-gtk
post "%if "%_lib" == "lib64""
post "<prefix>%{_bindir}/gtk-query-immodules-2.0-64 --update-cache"
post "%else"
post "<prefix>%{_bindir}/gtk-query-immodules-2.0 --update-cache"
post "%endif"
postun "%if "%_lib" == "lib64""
postun "<prefix>%{_bindir}/gtk-query-immodules-2.0-64 --update-cache"
postun "%else"
postun "<prefix>%{_bindir}/gtk-query-immodules-2.0 --update-cache"
postun "%endif"
supplements "(ibus and gtk2-<targettype>)"
ibus-gtk3
post "%if "%_lib" == "lib64""
post "<prefix>%{_bindir}/gtk-query-immodules-3.0-64 --update-cache"
post "%else"
post "<prefix>%{_bindir}/gtk-query-immodules-3.0 --update-cache"
post "%endif"
postun "%if "%_lib" == "lib64""
postun "<prefix>%{_bindir}/gtk-query-immodules-3.0-64 --update-cache"
postun "%else"
postun "<prefix>%{_bindir}/gtk-query-immodules-3.0 --update-cache"
postun "%endif"
supplements "(ibus and gtk3-<targettype>)"
libibus-1_0-5
obsoletes "libibus2-<targettype> < <version>"

11
hide-setup-menu.patch Normal file
View File

@ -0,0 +1,11 @@
diff -Nura ibus-1.5.21/setup/ibus-setup.desktop ibus-1.5.21_new/setup/ibus-setup.desktop
--- ibus-1.5.21/setup/ibus-setup.desktop 2019-08-23 13:08:34.000000000 +0200
+++ ibus-1.5.21_new/setup/ibus-setup.desktop 2019-09-20 07:21:33.505022653 +0200
@@ -4,6 +4,7 @@
Exec=ibus-setup
Icon=ibus-setup
Terminal=false
+NoDisplay=true
Type=Application
StartupNotify=true
Categories=Settings;

BIN
ibus-1.5.28.tar.gz (Stored with Git LFS) Normal file

Binary file not shown.

15
ibus-autostart Normal file
View File

@ -0,0 +1,15 @@
#!/bin/sh
test x"$INPUT_METHOD" = x"ibus" || exit 0
# GNOME starts ibus by itself
case "$WINDOWMANAGER" in
*gnome*)
exit 0;;
esac
# sleep for a little while to avoid duplicate startup
# sleep 2
ibus start --service-file org.freedesktop.IBus.session.generic.service
exit 0

12
ibus-autostart.desktop Normal file
View File

@ -0,0 +1,12 @@
[Desktop Entry]
Name=IBus
GenericName=IBus Daemon
Comment=Start IBus daemon
Exec=ibus-autostart
Icon=ibus-setup
Terminal=false
Type=Application
StartupNotify=false
NoDisplay=true
X-KDE-autostart-after=panel
X-KDE-StartupNotify=false

View File

@ -0,0 +1,21 @@
diff -Nura ibus-1.5.16/xim.d-ibus-121 ibus-1.5.16_new/xim.d-ibus-121
--- ibus-1.5.16/xim.d-ibus-121 2017-06-05 14:38:10.728021247 +0800
+++ ibus-1.5.16_new/xim.d-ibus-121 2017-06-05 14:40:44.380353362 +0800
@@ -13,17 +13,6 @@
# G-S-D. see bnc#873016.
*gnome*)
SOURCES=$(gsettings get org.freedesktop.ibus.general preload-engines)
- if [ "$SOURCES" == '@as []' ]; then
- echo "initial GNOME startup, ibus default configuration applied"
- ibus-daemon -d
- timer=5
- while [ "$SOURCES" == '@as []' ] && [ ${timer} -gt 0 ]; do
- sleep 1
- timer=$[${timer}-1]
- SOURCES=$(gsettings get org.freedesktop.ibus.general preload-engines)
- done
- ibus exit
- fi
# make sure G-S-D keyboard plugin is active
echo "ibus will be managed by GNOME."
gsettings set org.gnome.settings-daemon.plugins.keyboard active true

View File

@ -0,0 +1,12 @@
diff -Nur ibus-1.5.22/ui/gtk3/panel.vala ibus-1.5.22-new/ui/gtk3/panel.vala
--- ibus-1.5.22/ui/gtk3/panel.vala 2020-02-21 20:46:17.000000000 +0800
+++ ibus-1.5.22-new/ui/gtk3/panel.vala 2020-02-24 17:55:17.718453204 +0800
@@ -1053,7 +1053,7 @@
private void show_setup_dialog() {
if (m_setup_pid != 0) {
- if (Posix.kill(m_setup_pid, Posix.Signal.USR1) == 0)
+ if (Posix.kill(m_setup_pid, Posix.SIGUSR1) == 0)
return;
m_setup_pid = 0;
}

411
ibus-fix-key-release.patch Normal file
View File

@ -0,0 +1,411 @@
From 7da18d08ce85405e41ba7bf363661292bc97ca39 Mon Sep 17 00:00:00 2001
From: fujiwarat <takao.fujiwara1@gmail.com>
Date: Wed, 22 Feb 2023 23:53:35 +0900
Subject: [PATCH] src: Call IBUS_TYPE_EMOJI_DATA in ibus_init()
Seems the evaluation of IBUS_EMOJI_DATA() depends on the compiler
optimization.
BUG=https://github.com/ibus/ibus/issues/2476
---
src/ibusshare.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/ibusshare.c b/src/ibusshare.c
index 340168c8..bb59f3cb 100644
--- a/src/ibusshare.c
+++ b/src/ibusshare.c
@@ -308,12 +308,15 @@ ibus_init (void)
IBUS_TYPE_TEXT;
IBUS_TYPE_ATTRIBUTE;
IBUS_TYPE_ATTR_LIST;
- IBUS_TYPE_LOOKUP_TABLE;
IBUS_TYPE_COMPONENT;
+ IBUS_TYPE_EMOJI_DATA;
IBUS_TYPE_ENGINE_DESC;
+ IBUS_TYPE_LOOKUP_TABLE;
IBUS_TYPE_OBSERVED_PATH;
IBUS_TYPE_REGISTRY;
IBUS_TYPE_X_EVENT;
+ IBUS_TYPE_UNICODE_BLOCK;
+ IBUS_TYPE_UNICODE_DATA;
_ibus_register_resource ();
}
--
2.38.1
From 9d9dca9e103e88b33e786c4a46f44123a6cf11c6 Mon Sep 17 00:00:00 2001
From: fujiwarat <takao.fujiwara1@gmail.com>
Date: Wed, 8 Mar 2023 19:44:16 +0900
Subject: [PATCH] client/x11: Fix Key typing order
ibus-x11 now also uses the hybrid process key events with
IBUS_ENABLE_SYNC_MODE=2 and it waits for the async API
with GSource and g_main_context_iteration() in xim_forward_event().
But g_main_context_iteration() calls gdk_event_source_dispatch()
and it can call another xim_forward_event() and the callbacks
of ibus_input_context_process_key_event_async() can be nested.
So if the forwarding API is called out of the callbacks of
ibus_input_context_process_key_event_async(), the key events
order is swapped due to the delayed return of
g_main_context_iteration().
To resolve this issue, the forwarding API should be called in
the callbacks of ibus_input_context_process_key_event_async().
BUG=https://github.com/ibus/ibus/issues/2480
---
client/x11/main.c | 160 ++++++++++++++++++++++++----------------------
1 file changed, 83 insertions(+), 77 deletions(-)
diff --git a/client/x11/main.c b/client/x11/main.c
index 905fd251..83d95cb7 100644
--- a/client/x11/main.c
+++ b/client/x11/main.c
@@ -2,7 +2,7 @@
/* vim:set et sts=4: */
/* ibus
* Copyright (C) 2007-2015 Peng Huang <shawn.p.huang@gmail.com>
- * Copyright (C) 2015-2022 Takao Fujiwara <takao.fujiwara1@gmail.com>
+ * Copyright (C) 2015-2023 Takao Fujiwara <takao.fujiwara1@gmail.com>
* Copyright (C) 2007-2015 Red Hat, Inc.
*
* main.c:
@@ -49,6 +49,8 @@
#include <getopt.h>
#define ESC_SEQUENCE_ISO10646_1 "\033%G"
+/* Wait for about 120 secs to return a key from async process-key-event. */
+#define MAX_WAIT_KEY_TIME 120000
#define LOG(level, fmt_args...) \
if (g_debug_level >= (level)) { \
@@ -461,11 +463,39 @@ xim_unset_ic_focus (XIMS xims, IMChangeFocusStruct *call_data)
}
+static void
+_xim_forward_key_event_done (X11IC *x11ic,
+ XEvent *event,
+ gboolean processed)
+{
+ IMForwardEventStruct fe;
+ if (processed) {
+ if (!x11ic->has_preedit_area) {
+ _xim_set_cursor_location (x11ic);
+ }
+ return;
+ }
+ g_assert (x11ic);
+ g_assert (event);
+
+ memset (&fe, 0, sizeof (fe));
+ fe.major_code = XIM_FORWARD_EVENT;
+ fe.icid = x11ic->icid;
+ fe.connect_id = x11ic->connect_id;
+ fe.sync_bit = 0;
+ fe.serial_number = 0L;
+ fe.event = *event;
+ IMForwardEvent (_xims, (XPointer) &fe);
+}
+
+
typedef struct {
- IMForwardEventStruct *pfe;
int count;
guint count_cb_id;
gboolean retval;
+ X11IC *x11ic;
+ CARD16 connect_id;
+ XEvent event;
} ProcessKeyEventReplyData;
static void
@@ -474,7 +504,7 @@ _process_key_event_done (GObject *object,
gpointer user_data)
{
IBusInputContext *context = (IBusInputContext *)object;
- IMForwardEventStruct *pfe = (IMForwardEventStruct*) user_data;
+ ProcessKeyEventReplyData *data = (ProcessKeyEventReplyData *)user_data;
GError *error = NULL;
gboolean retval = ibus_input_context_process_key_event_async_finish (
@@ -488,16 +518,15 @@ _process_key_event_done (GObject *object,
}
if (g_hash_table_lookup (_connections,
- GINT_TO_POINTER ((gint) pfe->connect_id))
+ GINT_TO_POINTER ((gint)data->connect_id))
== NULL) {
- g_slice_free (IMForwardEventStruct, pfe);
+ g_slice_free (ProcessKeyEventReplyData, data);
return;
}
- if (retval == FALSE) {
- IMForwardEvent (_xims, (XPointer) pfe);
- }
- g_slice_free (IMForwardEventStruct, pfe);
+ if (retval == FALSE)
+ _xim_forward_key_event_done (data->x11ic, &data->event, retval);
+ g_slice_free (ProcessKeyEventReplyData, data);
}
static void
@@ -518,6 +547,21 @@ _process_key_event_reply_done (GObject *object,
}
g_return_if_fail (data);
data->retval = retval;
+ if (g_hash_table_lookup (_connections,
+ GINT_TO_POINTER ((gint)data->connect_id))
+ == NULL) {
+ return;
+ }
+ /* _xim_forward_key_event_done() should be called in
+ * _process_key_event_reply_done() because g_main_context_iteration()
+ * can call another xim_forward_event() and xim_forward_event() can be
+ * nested and the first _process_key_event_reply_done() is returned
+ * at last with g_main_context_iteration() so
+ * if _xim_forward_key_event_done() is called out of
+ * _process_key_event_reply_done(), the key events order
+ * can be swapped.
+ */
+ _xim_forward_key_event_done (data->x11ic, &data->event, retval);
data->count = 0;
g_source_remove (data->count_cb_id);
}
@@ -529,9 +573,8 @@ _process_key_event_count_cb (gpointer user_data)
g_return_val_if_fail (data, G_SOURCE_REMOVE);
if (!data->count)
return G_SOURCE_REMOVE;
- /* Wait for about 10 secs. */
- if (data->count++ == 10000) {
- data->count = 0;
+ if (data->count++ == MAX_WAIT_KEY_TIME) {
+ g_warning ("Key event is not returned for %usecs.", MAX_WAIT_KEY_TIME);
return G_SOURCE_REMOVE;
}
return G_SOURCE_CONTINUE;
@@ -571,32 +614,13 @@ xim_forward_event (XIMS xims, IMForwardEventStruct *call_data)
event.keyval,
event.hardware_keycode - 8,
event.state);
- if (retval) {
- if (!x11ic->has_preedit_area) {
- _xim_set_cursor_location (x11ic);
- }
- return 1;
- }
-
- IMForwardEventStruct fe;
- memset (&fe, 0, sizeof (fe));
-
- fe.major_code = XIM_FORWARD_EVENT;
- fe.icid = x11ic->icid;
- fe.connect_id = x11ic->connect_id;
- fe.sync_bit = 0;
- fe.serial_number = 0L;
- fe.event = call_data->event;
-
- IMForwardEvent (_xims, (XPointer) &fe);
-
+ _xim_forward_key_event_done (x11ic, &call_data->event, retval);
retval = 1;
break;
}
case 2: {
GSource *source = g_timeout_source_new (1);
ProcessKeyEventReplyData *data = NULL;
- IMForwardEventStruct fe;
if (source)
data = g_slice_new0 (ProcessKeyEventReplyData);
@@ -610,11 +634,13 @@ xim_forward_event (XIMS xims, IMForwardEventStruct *call_data)
if (source)
g_source_destroy (source);
} else {
- CARD16 connect_id = x11ic->connect_id;
data->count = 1;
g_source_attach (source, NULL);
g_source_unref (source);
data->count_cb_id = g_source_get_id (source);
+ data->connect_id = call_data->connect_id;
+ data->x11ic = x11ic;
+ data->event = *((XEvent*)xevent);
ibus_input_context_process_key_event_async (
x11ic->context,
event.keyval,
@@ -626,7 +652,7 @@ xim_forward_event (XIMS xims, IMForwardEventStruct *call_data)
data);
g_source_set_callback (source, _process_key_event_count_cb,
data, NULL);
- while (data->count)
+ while (data->count > 0 && data->count < MAX_WAIT_KEY_TIME)
g_main_context_iteration (NULL, TRUE);
if (source->ref_count > 0) {
/* g_source_get_id() could causes a SEGV */
@@ -634,46 +660,33 @@ xim_forward_event (XIMS xims, IMForwardEventStruct *call_data)
"issue in %p.", source);
}
retval = data->retval;
- g_slice_free (ProcessKeyEventReplyData, data);
-
- if (g_hash_table_lookup (_connections,
- GINT_TO_POINTER ((gint)connect_id))
- == NULL) {
+ if (data->count == 0) {
+ g_slice_free (ProcessKeyEventReplyData, data);
return 1;
}
}
- if (retval) {
- if (! x11ic->has_preedit_area) {
- _xim_set_cursor_location (x11ic);
- }
- return 1;
+ g_slice_free (ProcessKeyEventReplyData, data);
+ if (g_hash_table_lookup (_connections,
+ GINT_TO_POINTER ((gint)call_data->connect_id))
+ == NULL) {
+ return 1;
}
-
- memset (&fe, 0, sizeof (fe));
-
- fe.major_code = XIM_FORWARD_EVENT;
- fe.icid = x11ic->icid;
- fe.connect_id = x11ic->connect_id;
- fe.sync_bit = 0;
- fe.serial_number = 0L;
- fe.event = call_data->event;
-
- IMForwardEvent (_xims, (XPointer) &fe);
-
+ _xim_forward_key_event_done (x11ic, &call_data->event, retval);
retval = 1;
break;
}
default: {
- IMForwardEventStruct *pfe;
+ ProcessKeyEventReplyData *data;
- pfe = g_slice_new0 (IMForwardEventStruct);
- pfe->major_code = XIM_FORWARD_EVENT;
- pfe->icid = x11ic->icid;
- pfe->connect_id = x11ic->connect_id;
- pfe->sync_bit = 0;
- pfe->serial_number = 0L;
- pfe->event = call_data->event;
+ if (!(data = g_slice_new0 (ProcessKeyEventReplyData))) {
+ g_warning ("Cannot allocate async data");
+ _xim_forward_key_event_done (x11ic, &call_data->event, 0);
+ return 1;
+ }
+ data->connect_id = call_data->connect_id;
+ data->x11ic = x11ic;
+ data->event = call_data->event;
ibus_input_context_process_key_event_async (
x11ic->context,
@@ -683,7 +696,7 @@ xim_forward_event (XIMS xims, IMForwardEventStruct *call_data)
-1,
NULL,
_process_key_event_done,
- pfe);
+ data);
retval = 1;
}
}
@@ -962,11 +975,10 @@ _xim_forward_key_event (X11IC *x11ic,
guint keycode,
guint state)
{
- g_return_if_fail (x11ic != NULL);
-
- IMForwardEventStruct fe = {0};
XEvent xkp = {0};
+ g_return_if_fail (x11ic != NULL);
+
xkp.xkey.type = (state & IBUS_RELEASE_MASK) ? KeyRelease : KeyPress;
xkp.xkey.serial = 0L;
xkp.xkey.send_event = False;
@@ -975,20 +987,14 @@ _xim_forward_key_event (X11IC *x11ic,
xkp.xkey.window =
x11ic->focus_window ? x11ic->focus_window : x11ic->client_window;
xkp.xkey.subwindow = None;
- xkp.xkey.root = DefaultRootWindow (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()));
+ xkp.xkey.root = DefaultRootWindow (
+ GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()));
xkp.xkey.time = 0;
xkp.xkey.state = state;
xkp.xkey.keycode = (keycode == 0) ? 0 : keycode + 8;
- fe.major_code = XIM_FORWARD_EVENT;
- fe.icid = x11ic->icid;
- fe.connect_id = x11ic->connect_id;
- fe.sync_bit = 0;
- fe.serial_number = 0L;
- fe.event = xkp;
-
- IMForwardEvent (_xims, (XPointer) & fe);
+ _xim_forward_key_event_done (x11ic, &xkp, FALSE);
}
static void
--
2.38.1
From 5b5d0795f297e330fdc84b6be6beab1305b0cda9 Mon Sep 17 00:00:00 2001
From: fujiwarat <takao.fujiwara1@gmail.com>
Date: Wed, 15 Mar 2023 10:22:05 +0900
Subject: [PATCH] util/IMdkit: Disable while loop before call
ForwardEventMessageProc()
Seems ProcessQueue() had a wrong XFree() with async process-key-event.
Fixes: c0fec89ae76f9522319f58107ab234992b249ec6
BUG=https://github.com/ibus/ibus/issues/2484
---
util/IMdkit/i18nPtHdr.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/util/IMdkit/i18nPtHdr.c b/util/IMdkit/i18nPtHdr.c
index 8dc52714..ec20e322 100644
--- a/util/IMdkit/i18nPtHdr.c
+++ b/util/IMdkit/i18nPtHdr.c
@@ -1747,11 +1747,13 @@ static void ProcessQueue (XIMS ims, CARD16 connect_id)
XimProtoHdr *hdr = (XimProtoHdr *) client->pending->p;
unsigned char *p1 = (unsigned char *) (hdr + 1);
IMProtocol call_data;
+ XIMPending *old = client->pending;
call_data.major_code = hdr->major_opcode;
call_data.any.minor_code = hdr->minor_opcode;
call_data.any.connect_id = connect_id;
+ client->pending = old->next;
switch (hdr->major_opcode)
{
case XIM_FORWARD_EVENT:
@@ -1760,12 +1762,7 @@ static void ProcessQueue (XIMS ims, CARD16 connect_id)
}
/*endswitch*/
XFree (hdr);
- {
- XIMPending *old = client->pending;
-
- client->pending = old->next;
- XFree (old);
- }
+ XFree (old);
}
/*endwhile*/
return;
--
2.39.2

View File

@ -0,0 +1,249 @@
diff -Naur ibus-1.5.25/src/ibusshare.c ibus-1.5.25.new/src/ibusshare.c
--- ibus-1.5.25/src/ibusshare.c 2021-08-20 02:48:40.000000000 +0200
+++ ibus-1.5.25.new/src/ibusshare.c 2021-09-08 19:41:27.233077477 +0200
@@ -90,79 +90,132 @@
return g_getenv("IBUS_SESSION_ID");
}
+static const gchar *ibus_get_socket_path_internal (gboolean compat, gchar *client_display);
+
const gchar *
ibus_get_socket_path (void)
{
static gchar *path = NULL;
if (path == NULL) {
- gchar *hostname = "unix";
- gchar *display;
- gchar *displaynumber = "0";
- /* gchar *screennumber = "0"; */
- gboolean is_wayland = FALSE;
- gchar *p;
-
- path = g_strdup (g_getenv ("IBUS_ADDRESS_FILE"));
- if (path != NULL) {
- return path;
+ path = ibus_get_socket_path_internal (FALSE, NULL);
+ }
+ return path;
+}
+
+static const gchar *
+ibus_get_socket_path_x11_compat (void)
+{
+ static gchar *path = NULL;
+ if (path == NULL)
+ path = ibus_get_socket_path_internal (TRUE, NULL);
+ return path;
+}
+
+static const gchar *
+ibus_get_socket_path_gnome_xwayland_compat (void)
+{
+ static gchar *path = NULL;
+ if (path == NULL) {
+ gint setup_display_number;
+ gchar *client_display;
+ gchar **tokens;
+
+ tokens = g_strsplit (ibus_get_socket_path_x11_compat (), "-", 3);
+ if (tokens[0] != NULL && tokens[1] != NULL && tokens[2] != NULL) {
+ setup_display_number = g_strtod(tokens[2], NULL);
+ if (setup_display_number > 0) {
+ client_display = g_strdup_printf (":%d", setup_display_number - 1);
+ path = ibus_get_socket_path_internal (TRUE, client_display);
+ }
}
- if (_display == NULL) {
+ g_strfreev (tokens);
+ }
+ return path;
+}
+
+static const gchar *
+ibus_get_socket_path_internal (gboolean compat, gchar *client_display)
+{
+ gchar *path = NULL;
+
+ gchar *hostname = "unix";
+ gchar *display;
+ gchar *displaynumber = "0";
+ /* gchar *screennumber = "0"; */
+ gboolean is_wayland = FALSE;
+ gchar *p;
+
+ path = g_strdup (g_getenv ("IBUS_ADDRESS_FILE"));
+ if (path != NULL) {
+ return path;
+ }
+
+ if (_display == NULL) {
+ if (compat) {
+ if (client_display == NULL)
+ display = g_strdup (g_getenv ("DISPLAY"));
+ else
+ display = client_display;
+ } else {
display = g_strdup (g_getenv ("WAYLAND_DISPLAY"));
if (display)
is_wayland = TRUE;
- else
+ else if (client_display == NULL)
display = g_strdup (g_getenv ("DISPLAY"));
+ else
+ display = client_display;
}
- else {
- display = g_strdup (_display);
- }
-
- if (is_wayland) {
- displaynumber = display;
- } else if (display) {
- p = display;
- hostname = display;
- for (; *p != ':' && *p != '\0'; p++);
+ }
+ else {
+ display = g_strdup (_display);
+ }
- if (*p == ':') {
- *p = '\0';
- p++;
- displaynumber = p;
- }
+ if (is_wayland) {
+ displaynumber = display;
+ } else if (display) {
+ p = display;
+ hostname = display;
+ for (; *p != ':' && *p != '\0'; p++);
+
+ if (*p == ':') {
+ *p = '\0';
+ p++;
+ displaynumber = p;
+ }
- for (; *p != '.' && *p != '\0'; p++);
+ for (; *p != '.' && *p != '\0'; p++);
- if (*p == '.') {
- *p = '\0';
- p++;
- /* Do not use screennumber
- screennumber = p; */
- }
+ if (*p == '.') {
+ *p = '\0';
+ p++;
+ /* Do not use screennumber
+ screennumber = p; */
}
+ }
- if (hostname[0] == '\0')
- hostname = "unix";
+ if (hostname[0] == '\0')
+ hostname = "unix";
+
+ p = g_strdup_printf ("%s-%s-%s",
+ ibus_get_local_machine_id (),
+ hostname,
+ displaynumber);
+ /* Qt5 IBus module has a hard-coded path and we cannot change this
+ * for the back compatibility.
+ * XDG_RUNTIME_DIR is not useful because it's generated by
+ * login but not `su` command and ibus-daemon can be run with `su`
+ * and we may change the path to XDG_CACHE_HOME in the future.
+ */
+ path = g_build_filename (g_get_user_config_dir (),
+ "ibus",
+ "bus",
+ p,
+ NULL);
+ g_free (p);
+ g_free (display);
- p = g_strdup_printf ("%s-%s-%s",
- ibus_get_local_machine_id (),
- hostname,
- displaynumber);
- /* Qt5 IBus module has a hard-coded path and we cannot change this
- * for the back compatibility.
- * XDG_RUNTIME_DIR is not useful because it's generated by
- * login but not `su` command and ibus-daemon can be run with `su`
- * and we may change the path to XDG_CACHE_HOME in the future.
- */
- path = g_build_filename (g_get_user_config_dir (),
- "ibus",
- "bus",
- p,
- NULL);
- g_free (p);
- g_free (display);
- }
return path;
}
@@ -243,14 +296,42 @@
return address;
}
+static void ibus_write_address_internal (const gchar *address, const gchar *socket_path);
+
void
ibus_write_address (const gchar *address)
{
+
+
+ const gchar *socket_path;
+ const gchar *socket_path_compat;
+
+ socket_path = ibus_get_socket_path ();
+ ibus_write_address_internal (address, socket_path);
+
+ if (g_getenv ("WAYLAND_DISPLAY") != NULL) {
+ socket_path_compat = ibus_get_socket_path_x11_compat ();
+ ibus_write_address_internal (address, socket_path_compat);
+
+ if (g_getenv ("GNOME_SETUP_DISPLAY") != NULL &&
+ strcmp (g_getenv ("GNOME_SETUP_DISPLAY"), g_getenv ("DISPLAY")) == 0) {
+ /* Running from gnome-shell with the setup display; write the socket
++ * address to an additional path for X11 clients */
+ socket_path_compat = ibus_get_socket_path_gnome_xwayland_compat ();
+ if (socket_path_compat != NULL)
+ ibus_write_address_internal (address, socket_path_compat);
+ }
+ }
+}
+
+static void
+ibus_write_address_internal (const gchar *address, const gchar *socket_path)
+{
FILE *pf;
gchar *path;
g_return_if_fail (address != NULL);
- path = g_path_get_dirname (ibus_get_socket_path ());
+ path = g_path_get_dirname (socket_path);
errno = 0;
if (g_mkdir_with_parents (path, 0700)) {
g_warning ("Failed to mkdir %s: %s", path, g_strerror (errno));
@@ -260,11 +341,11 @@
g_free (path);
errno = 0;
- if (g_unlink (ibus_get_socket_path ())) {
+ if (g_unlink (socket_path)) {
g_warning ("Failed to unlink %s: %s",
- ibus_get_socket_path (), g_strerror (errno));
+ socket_path, g_strerror (errno));
}
- pf = fopen (ibus_get_socket_path (), "w");
+ pf = fopen (socket_path, "w");
g_return_if_fail (pf != NULL);
fprintf (pf,

View File

@ -0,0 +1,158 @@
diff --git a/ui/gtk3/panel.vala b/ui/gtk3/panel.vala
index 452b14c8..81c246a2 100644
--- a/ui/gtk3/panel.vala
+++ b/ui/gtk3/panel.vala
@@ -1292,7 +1292,7 @@ class Panel : IBus.PanelService {
m_sys_menu.append(new Gtk.SeparatorMenuItem());
item = new Gtk.MenuItem.with_label(_("Restart"));
- item.activate.connect((i) => m_bus.exit(true));
+ item.activate.connect((i) => restart_daemon());
m_sys_menu.append(item);
item = new Gtk.MenuItem.with_label(_("Quit"));
@@ -1305,6 +1305,144 @@ class Panel : IBus.PanelService {
return m_sys_menu;
}
+ private const string systemd_service_file = "org.freedesktop.IBus.session.generic.service";
+
+ GLib.DBusConnection? get_session_bus() {
+ try {
+ return GLib.Bus.get_sync (GLib.BusType.SESSION, null);
+ } catch (GLib.IOError e) {
+ debug("%s\n", e.message);
+ }
+ return null;
+ }
+
+ string?
+ get_ibus_systemd_object_path(GLib.DBusConnection connection) {
+ string object_path = null;
+ assert(systemd_service_file != null);
+ try {
+ var variant = connection.call_sync (
+ "org.freedesktop.systemd1",
+ "/org/freedesktop/systemd1",
+ "org.freedesktop.systemd1.Manager",
+ "GetUnit",
+ new GLib.Variant("(s)", systemd_service_file),
+ new GLib.VariantType("(o)"),
+ GLib.DBusCallFlags.NONE,
+ -1,
+ null);
+ variant.get("(o)", ref object_path);
+ debug("Succeed to get an object path \"%s\" for IBus " +
+ "systemd service file \"%s\".\n",
+ object_path, systemd_service_file);
+ return object_path;
+ } catch (GLib.Error e) {
+ debug("IBus systemd service file \"%s\" is not installed " +
+ "in your system: %s\n",
+ systemd_service_file, e.message);
+ }
+ return null;
+ }
+
+ bool
+ is_running_daemon_via_systemd(GLib.DBusConnection connection,
+ string object_path) {
+ string? state = null;
+ try {
+ while (true) {
+ var variant = connection.call_sync (
+ "org.freedesktop.systemd1",
+ object_path,
+ "org.freedesktop.DBus.Properties",
+ "Get",
+ new GLib.Variant("(ss)",
+ "org.freedesktop.systemd1.Unit",
+ "ActiveState"),
+ new GLib.VariantType("(v)"),
+ GLib.DBusCallFlags.NONE,
+ -1,
+ null);
+ GLib.Variant child = null;
+ variant.get("(v)", ref child);
+ state = child.dup_string();
+ debug("systemd state is \"%s\" for an object " +
+ "path \"%s\".\n", state, object_path);
+ if (state != "activating")
+ break;
+ Posix.sleep(1);
+ }
+ } catch (GLib.Error e) {
+ debug("%s\n", e.message);
+ return false;
+ }
+ if (state == "active")
+ return true;
+ return false;
+ }
+
+ bool
+ start_daemon_via_systemd(GLib.DBusConnection connection,
+ bool restart) {
+ string object_path = null;
+ string method = "StartUnit";
+ assert(systemd_service_file != null);
+ if (restart)
+ method = "RestartUnit";
+ try {
+ var variant = connection.call_sync (
+ "org.freedesktop.systemd1",
+ "/org/freedesktop/systemd1",
+ "org.freedesktop.systemd1.Manager",
+ method,
+ new GLib.Variant("(ss)", systemd_service_file, "fail"),
+ new GLib.VariantType("(o)"),
+ GLib.DBusCallFlags.NONE,
+ -1,
+ null);
+ variant.get("(o)", ref object_path);
+ debug("Succeed to restart IBus daemon via IBus systemd " +
+ "service file \"%s\": \"%s\"\n",
+ systemd_service_file, object_path);
+ return true;
+ } catch (GLib.Error e) {
+ debug("Failed to %s IBus daemon via IBus systemd " +
+ "service file \"%s\": %s\n",
+ restart ? "restart" : "start",
+ systemd_service_file, e.message);
+ }
+ return false;
+ }
+
+ private void restart_daemon() {
+ do {
+ GLib.DBusConnection? connection = get_session_bus();
+ if (connection == null)
+ break;
+ var object_path = get_ibus_systemd_object_path(connection);
+ if (object_path == null)
+ break;
+ if (is_running_daemon_via_systemd(connection,
+ object_path)) {
+ var result = start_daemon_via_systemd(connection, true);
+ if (!result) {
+ var dialog = new Gtk.MessageDialog(
+ null,
+ Gtk.DialogFlags.DESTROY_WITH_PARENT,
+ Gtk.MessageType.ERROR,
+ Gtk.ButtonsType.CLOSE,
+ "Failed to restart IBus daemon via IBus systemd");
+ dialog.response.connect((id) => {
+ dialog.destroy();
+ });
+ dialog.show_all();
+ }
+ }
+ return;
+ } while (false);
+ // ibus-daemon is not launched via systemd
+ m_bus.exit(true);
+ }
+
private Gtk.Menu create_activate_menu() {
m_ime_menu = new Gtk.Menu();

View File

@ -0,0 +1,16 @@
---
client/x11/main.c | 3 +++
1 file changed, 3 insertions(+)
--- a/client/x11/main.c
+++ b/client/x11/main.c
@@ -421,6 +421,9 @@ xim_set_ic_focus (XIMS xims, IMChangeFoc
GINT_TO_POINTER ((gint) call_data->icid));
g_return_val_if_fail (x11ic != NULL, 0);
+ /* make sure that focus has been already out */
+ ibus_input_context_focus_out (x11ic->context);
+
ibus_input_context_focus_in (x11ic->context);
_xim_set_cursor_location (x11ic);

1402
ibus.changes Normal file

File diff suppressed because it is too large Load Diff

483
ibus.spec Normal file
View File

@ -0,0 +1,483 @@
#
# spec file
#
# Copyright (c) 2023 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%define flavor @BUILD_FLAVOR@%nil
%define with_gtk4 0
%define with_wayland 1
%define with_emoji 1
%if "%{flavor}" == "gtk4"
%define with_gtk4 1
%define nsuffix _%{flavor}
%endif
%if ! %{defined _distconfdir}
%define _distconfdir %{_sysconfdir}
%else
%define use_usretc 1
%endif
%define _name ibus
Name: %{_name}%{?nsuffix}
Version: 1.5.28
Release: 0
Summary: The "Intelligent Input Bus" input method
License: LGPL-2.1-or-later
Group: System/I18n/Chinese
URL: https://github.com/ibus/
Source: https://github.com/ibus/ibus/releases/download/%{version}/%{_name}-%{version}.tar.gz
Source2: README.SUSE
Source3: xim.ibus.suse.template
Source4: xim.d-ibus-121
Source7: macros.ibus
Source10: ibus-autostart
Source11: ibus-autostart.desktop
Source12: 20-defaults-openSUSE.conf
Source99: baselibs.conf
# PATFH-FIX-OPENSUSE ibus-xim-fix-re-focus-after-lock.patch bnc#874869 tiwai@suse.de
# Fix lost XIM input after screenlock
Patch4: ibus-xim-fix-re-focus-after-lock.patch
# PATCH-FIX-UPSTREAM ftake@geeko.jp
# Select an IM engine instead of xkb engine at the first login
Patch8: im-engines-precede-xkb.patch
# PATCH-FIX-OPENSUSE ibus-fix-Signal-does-not-exist.patch hillwood@opensuse.org
# panel.vala: The name `Signal' does not exist in the context of `Posix' in Leap 15.1 and below
Patch9: ibus-fix-Signal-does-not-exist.patch
# PATCH-FIX-SLE hide-setup-menu.patch bnc#899259 qzhao@suse.com
# ibus-setup should not launch from main menu.
Patch10: hide-setup-menu.patch
# PATCH-FIX-SLE setup-switch-im.patch bnc#899259 qzhao@suse.com
# switch to ibus when ibus not running.
Patch11: setup-switch-im.patch
# PATCH-FIX-SLE ibus-disable-engines-preload-in-GNOME.patch bnc#1036729 qzhao@suse.com
# Disable ibus engines preload in GNOME for These works are handled by gnome-shell.
Patch12: ibus-disable-engines-preload-in-GNOME.patch
# PATCH-FIX-UPSTREAM ibus-socket-name-compatibility.patch bsc#1171442, gh#ibus/ibus#2195 qkzhu@suse
# Compatibility workaround for ibus-use-wayland-display-for-socket-name.patch
# Qt5 does not be update to the new version and patch for ibus on Leap 15,
# it still needs this patch on leap 15. (boo#1187202)
Patch15: ibus-socket-name-compatibility.patch
# PATCH-FIX-UPSTREAM ibus-ui-gtk3-restart-via-systemd.patch
# Allow ibus-ui-gtk3 to restart ibus-daemon when it is launched by systemd
Patch16: ibus-ui-gtk3-restart-via-systemd.patch
# PATCH-FIX-UPSTREAM ibus-fix-key-release.patch
# Fixes a problem that wine/proton (steam) got a key stuck
Patch17: ibus-fix-key-release.patch
BuildRequires: pkgconfig(iso-codes)
BuildRequires: pkgconfig(libnotify)
BuildRequires: pkgconfig(systemd)
%if ! 0%{?with_gtk4}
BuildRequires: fdupes
BuildRequires: gettext-devel
BuildRequires: gobject-introspection-devel >= 0.9.6
BuildRequires: gtk-doc >= 1.9
BuildRequires: libtool
BuildRequires: pkgconfig
BuildRequires: python3-dbus-python-devel
BuildRequires: python3-gobject-devel
BuildRequires: unicode-ucd
BuildRequires: update-desktop-files
BuildRequires: pkgconfig(dbus-glib-1)
BuildRequires: pkgconfig(dconf) >= 0.7.5
BuildRequires: pkgconfig(glib-2.0) >= 2.34.0
BuildRequires: pkgconfig(gtk+-2.0)
BuildRequires: pkgconfig(libnotify) >= 0.7
BuildRequires: pkgconfig(python3)
# copy_deep method is supported since 0.31.1
BuildRequires: vala >= 0.31.1
BuildRequires: systemd-rpm-macros
BuildRequires: x11-tools
BuildRequires: pkgconfig(json-glib-1.0)
BuildRequires: pkgconfig(vapigen)
BuildRequires: pkgconfig(xkbcommon)
%if %{with_emoji}
Requires: %{_name}-dict-emoji = %{version}
%endif
Requires: dconf
Requires: iso-codes
Requires: libibus-1_0-5 = %{version}
Requires: python3-dbus-python
Requires: python3-gobject
Requires: python3-gobject-Gdk
# ibus-setup will require typelib(Gdk) typelib(GdkX11), typelib(Gtk)
# which are provided by two packages in openSUSE, so we limit their
# versions to 3.0 only.
Requires: typelib-1_0-Gtk-3_0
Provides: locale(ja;ko;zh)
%if %{with_wayland}
BuildRequires: pkgconfig(wayland-client) >= 1.2.0
%endif
%if %{with_emoji}
BuildRequires: unicode-emoji
BuildRequires: pkgconfig(cldr-emoji-annotation)
%endif
%endif
%description
IBus, short for Intelligent Input Bus, is an input framework. IBus
plugins then provide the particular logic how to translate keypresses
to input characters and possibly show disambiguation windows around
the text cursor.
%if ! 0%{?with_gtk4}
%package -n libibus-1_0-5
Summary: IBus libraries
Group: System/Libraries
%description -n libibus-1_0-5
This package contains the libraries for IBus
%package -n typelib-1_0-IBus-1_0
Summary: Introspection bindings for IBus
Group: System/Libraries
%description -n typelib-1_0-IBus-1_0
This package contains the introspection bindings for the IBus library.
%if %{with_emoji}
%package dict-emoji
Summary: Emoji dictionary for IBus
Group: System/I18n/Chinese
BuildArch: noarch
# make sure old ibus package containing emoji dict files is updated
Conflicts: ibus < 1.5.22
%description dict-emoji
This package contains data of emoji dictionary for IBus and other applications
%endif
%package gtk
Summary: IBus input method support for gtk2 applications
Group: System/I18n/Chinese
Requires: %{_name} = %{version}
Supplements: (ibus and gtk2)
%{gtk2_immodule_requires}
%description gtk
This package contains ibus im module for use by gtk2.
%package gtk3
Summary: IBus input method support for gtk3 applications
Group: System/I18n/Chinese
BuildRequires: pkgconfig(gtk+-3.0)
Requires: %{_name} = %{version}
Supplements: (ibus and gtk3)
%{gtk3_immodule_requires}
%description gtk3
This package contains ibus im module for use by gtk3.
%package devel
Summary: Development tools for ibus
Group: Development/Libraries/Other
Requires: dbus-1-devel
Requires: glib2-devel
Requires: gtk-doc
Requires: ibus = %{version}
Requires: libibus-1_0-5 = %{version}
Requires: typelib-1_0-IBus-1_0 = %{version}
%description devel
The ibus-devel package contains the header files and developer
docs for ibus.
%lang_package
%else
%package -n %{_name}-gtk4
Summary: IBus input method support for gtk4 applications
# on 15.4, both gtk4-devel and gtk4-devel-32bit provide pkgconfig(gtk4)
Group: System/I18n/Chinese
BuildRequires: gtk4-devel
BuildRequires: pkgconfig(dbus-1)
Requires: %{_name} = %{version}
Supplements: (ibus and gtk4)
%{gtk4_immodule_requires}
%description -n %{_name}-gtk4
This package contains ibus im module for use by gtk4.
%endif
%prep
%setup -q -n %{_name}-%{version}
%patch4 -p1
%patch8 -p1
%if 0%{?sle_version} < 150200 && 0%{?suse_version} <=1500
%patch9 -p1
%endif
cp -r %{SOURCE2} .
cp -r %{SOURCE3} .
cp -r %{SOURCE4} .
sed -i 1i"SYS_LIB=%{_lib}" xim.d-ibus-121
cp -r %{SOURCE10} .
cp -r %{SOURCE11} .
%patch10 -p1
%patch11 -p1
%patch12 -p1
%if 0%{?suse_version} <= 1500
%patch15 -p1
%endif
%patch16 -p1
%patch17 -p1
%build
%configure --disable-static \
--libexecdir=%{_libdir}/ibus \
%if %{with_wayland}
--enable-wayland \
%endif
%if %{with_emoji}
--enable-emoji-dict \
%else
--disable-emoji-dict \
%endif
--disable-python2 \
%if ! 0%{?with_gtk4}
--enable-gtk3 \
--enable-vala \
--enable-appindicator \
--with-python=python3 \
--enable-python-library \
--enable-introspection \
--enable-gtk-doc \
--enable-surrounding-text \
%else
--disable-dconf \
--disable-emoji-dict \
--disable-unicode-dict \
--disable-xim \
--disable-gtk2 \
--disable-gtk3 \
--enable-gtk4 \
%endif
# non-parallel to have reproducible results in spite of non-deterministic build scripts https://github.com/ibus/ibus/issues/2272
make
%install
%make_install
# Remove libtool archives
find %{buildroot} -type f -name "*.la" -delete -print
%if ! 0%{?with_gtk4}
# autostart
mkdir -p %{buildroot}%{_distconfdir}/X11/xim.d/
install -m 644 xim.d-ibus-121 %{buildroot}%{_distconfdir}/X11/xim.d/ibus
mkdir -p %{buildroot}%{_bindir}
install -c -m 0755 ibus-autostart %{buildroot}%{_bindir}/ibus-autostart
mkdir -p %{buildroot}%{_sysconfdir}/xdg/autostart
install -c -m 0644 ibus-autostart.desktop %{buildroot}%{_sysconfdir}/xdg/autostart/ibus-autostart.desktop
# systemd conf
mkdir -p %{buildroot}%{_userunitdir}/org.freedesktop.IBus.session.generic.service.d
install -c -m 0644 %{SOURCE12} %{buildroot}%{_userunitdir}/org.freedesktop.IBus.session.generic.service.d
PRIORITY=40
pushd %{buildroot}%{_distconfdir}/X11/xim.d/
for lang in am ar as bn el fa gu he hi hr ja ka kk kn ko lo ml my \
pa ru sk vi zh_TW zh_CN zh_HK zh_SG \
de fr it es nl cs pl da nn nb fi en sv
do
mkdir $lang
pushd $lang
ln -s ../ibus $PRIORITY-ibus
popd
done
popd
mkdir -p %{buildroot}%{_datadir}/pixmaps
ln -sf %{_datadir}/icons/hicolor/48x48/apps/ibus-keyboard.png \
%{buildroot}%{_datadir}/pixmaps/ibus-keyboard.png
# touch for %%ghost
touch %{buildroot}/%{_sysconfdir}/dconf/db/ibus
# install macros
mkdir -p %{buildroot}%{_rpmmacrodir}
install -m 644 %{SOURCE7} %{buildroot}%{_rpmmacrodir}
%suse_update_desktop_file -r org.freedesktop.IBus.Setup Settings DesktopSettings X-SuSE-Core-System
%fdupes %{buildroot}
%find_lang ibus10 %{?no_lang_C}
%pre
%systemd_user_pre org.freedesktop.IBus.session.GNOME.service org.freedesktop.IBus.session.generic.service
%post
%glib2_gsettings_schema_post
%systemd_user_post org.freedesktop.IBus.session.GNOME.service org.freedesktop.IBus.session.generic.service
%posttrans
dconf update
%preun
%systemd_user_preun org.freedesktop.IBus.session.GNOME.service org.freedesktop.IBus.session.generic.service
%postun
%glib2_gsettings_schema_postun
dconf update
%systemd_user_postun org.freedesktop.IBus.session.GNOME.service org.freedesktop.IBus.session.generic.service
%post gtk
%{gtk2_immodule_post}
%postun gtk
%{gtk2_immodule_postun}
%post -n libibus-1_0-5 -p /sbin/ldconfig
%postun -n libibus-1_0-5 -p /sbin/ldconfig
%post gtk3
%{gtk3_immodule_post}
%postun gtk3
%{gtk3_immodule_postun}
%else
# cleanup stuff that is packaged as part of the main ibus flavor
rm -rf %{buildroot}%{_datadir}
rm -rf %{buildroot}%{_includedir}
rm -rf %{buildroot}%{_bindir}
rm -rf %{buildroot}%{_libdir}/ibus
rm -rf %{buildroot}%{_libdir}/libibus*
rm -rf %{buildroot}%{_libdir}/pkgconfig
rm -rf %{buildroot}%{_prefix}/lib/systemd
rm -rf %{buildroot}%{_sysconfdir}/xdg
%post -n %{_name}-gtk4
%{gtk4_immodule_post}
%postun -n %{_name}-gtk4
#{gtk4_immodule_postun} there is a syntax error in the macro from gtk4-devel
if [ $1 -eq 0 ]; then
if [[ -x %{_bindir}/gio-querymodules-64 ]]; then
%{_bindir}/gio-querymodules-64 %{_libdir}/gtk-4.0/4.0.0/immodules
else
%{_bindir}/gio-querymodules %{_libdir}/gtk-4.0/4.0.0/immodules
fi
fi
%endif
%if ! 0%{?with_gtk4}
%files
%doc AUTHORS README README.SUSE xim.ibus.suse.template
%license COPYING
%{_rpmmacrodir}/macros.ibus
%if %{defined use_usretc}
%dir %{_distconfdir}/X11
%dir %{_distconfdir}/X11/xim.d
%{_distconfdir}/X11/xim.d/*
%else
%config %{_sysconfdir}/X11/xim.d/*
%endif
%dir %{_sysconfdir}/xdg/Xwayland-session.d
%{_sysconfdir}/xdg/Xwayland-session.d/10-ibus-x11
%{_bindir}/ibus
%{_bindir}/ibus-autostart
%{_bindir}/ibus-daemon
%{_bindir}/ibus-setup
%dir %{_datadir}/ibus
%{_datadir}/ibus/component
%dir %{_datadir}/ibus/dicts
%{_datadir}/ibus/dicts/unicode-*.dict
%{_datadir}/ibus/engine
%{_datadir}/ibus/keymaps
%{_datadir}/ibus/setup
%{_datadir}/applications/org.freedesktop.IBus.Setup.desktop
%dir %{_datadir}/GConf
%dir %{_datadir}/GConf/gsettings
%{_datadir}/GConf/gsettings/ibus.convert
%{_datadir}/glib-2.0/schemas/org.freedesktop.ibus.gschema.xml
%{_datadir}/icons/hicolor/*/apps/ibus*.*
%{_datadir}/pixmaps/ibus-keyboard.png
%{_libdir}/ibus
%{_datadir}/bash-completion/completions/ibus.bash
%{_datadir}/dbus-1/services/*.service
# This file is generated by dconf update
%ghost %{_sysconfdir}/dconf/db/ibus
%dir %{_sysconfdir}/dconf/db/ibus.d
# This file is not a config file. Users may not modify it.
%config %{_sysconfdir}/dconf/db/ibus.d/00-upstream-settings
%config %{_sysconfdir}/dconf/profile/ibus
%config %{_sysconfdir}/xdg/autostart/ibus-autostart.desktop
%{_mandir}/man1/ibus.1%{ext_man}
%{_mandir}/man1/ibus-daemon.1%{ext_man}
%{_mandir}/man1/ibus-setup.1%{ext_man}
%{_mandir}/man5/00-upstream-settings.5%{ext_man}
%{_mandir}/man5/ibus.5%{ext_man}
%dir %{_userunitdir}/gnome-session.target.wants
%{_userunitdir}/gnome-session.target.wants/org.freedesktop.IBus.session.GNOME.service
%{_userunitdir}/*.service
%{_userunitdir}/org.freedesktop.IBus.session.generic.service.d
%if %{with_emoji}
%{_datadir}/applications/org.freedesktop.IBus.Panel.Emojier.desktop
%{_datadir}/applications/org.freedesktop.IBus.Panel.Extension.Gtk3.desktop
%{_mandir}/man7/ibus-emoji.7%{ext_man}
%endif
%{python3_sitearch}/gi/overrides/IBus.py
%{python3_sitearch}/gi/overrides/__pycache__/IBus.cpython-*.opt-1.pyc
%{python3_sitearch}/gi/overrides/__pycache__/IBus.cpython-*.pyc
%files lang -f ibus10.lang
%files -n libibus-1_0-5
%{_libdir}/libibus-1.0.so.*
%if %{with_emoji}
%files dict-emoji
%dir %{_datadir}/ibus/dicts
%{_datadir}/ibus/dicts/emoji-*.dict
%endif
%files -n typelib-1_0-IBus-1_0
%{_libdir}/girepository-1.0/IBus-1.0.typelib
%files gtk
%{_libdir}/gtk-2.0/*/immodules/im-ibus.so
%files gtk3
%{_libdir}/gtk-3.0/3.0.0/immodules/im-ibus.so
%files devel
%{_libdir}/libibus-1.0.so
%{_includedir}/ibus-1.0
%{_datadir}/gtk-doc/html/ibus
%{_libdir}/pkgconfig/ibus-1.0.pc
%{_datadir}/gettext/its/ibus.*
%{_datadir}/gir-1.0/IBus-1.0.gir
%{_datadir}/vala/vapi/ibus-1.0.deps
%{_datadir}/vala/vapi/ibus-1.0.vapi
%else
%files -n %{_name}-gtk4
%dir %{_libdir}/gtk-4.0/4.0.0/immodules
%{_libdir}/gtk-4.0/4.0.0/immodules/libim-ibus.so
%endif
%changelog

View File

@ -0,0 +1,14 @@
--- ibus-1.5.27/ui/gtk3/panel.vala.org 2022-08-23 00:32:16.000000000 +0900
+++ ibus-1.5.27/ui/gtk3/panel.vala 2022-08-27 11:48:21.086332809 +0900
@@ -589,9 +589,9 @@
}
string[] names = {};
- foreach (unowned IBus.EngineDesc engine in xkb_engines)
- names += engine.get_name();
foreach (unowned IBus.EngineDesc engine in im_engines)
+ names += engine.get_name();
+ foreach (unowned IBus.EngineDesc engine in xkb_engines)
names += engine.get_name();
m_settings_general.set_strv("preload-engines", names);

34
macros.ibus Normal file
View File

@ -0,0 +1,34 @@
# RPM macros for ibus
# You should use %%{_ibus_icondir} and %%{_ibus_tabledir}
# in %%files section
# For ibus table packaging, you have to:
# Use %%ibus_table_requires as requires
# Use %%ibus_table_index_post %%DB_NAME in %%post to create
# table indexes for your table package.
%_ibus_includedir %{_includedir}/ibus-1.0
%_ibus_libdir %{_libdir}/ibus
%_ibus_libexecdir %{_ibus_libdir}
%_ibus_datadir %{_datadir}/ibus
%_ibus_componentdir %{_ibus_datadir}/component
%_ibus_enginedir %{_ibus_datadir}/engine
%_ibus_keymapdir %{_ibus_datadir}/keymaps
%_ibus_setupdir %{_ibus_datadir}/setup
%_ibus_autostartdir %{_sysconfdir}/X11/xim.d
%_ibus_tabledir %{_datadir}/ibus-table/tables
%_ibus_icondir %{_datadir}/ibus-table/icons
%ibus_requires \
Requires: ibus
%ibus_table_requires \
Requires: ibus-table
Requires(post): ibus-table
%ibus_table_index_post() \
%if "x%1" != "x%%1" \
DB_NAME="%1" \
%else \
echo "Missing argument DB_NAME in call to %%ibus_table_create_index." \
false \
%endif \
/usr/bin/ibus-table-createdb -i -n %{_ibus_tabledir}/${DB_NAME}.db || true

65
setup-switch-im.patch Normal file
View File

@ -0,0 +1,65 @@
--- ibus-1.5.26/setup/main.py.org 2022-03-14 14:15:48.000000000 +0900
+++ ibus-1.5.26/setup/main.py 2022-08-21 23:04:59.698814168 +0900
@@ -508,11 +508,16 @@
self.__engine_setup_exec_list[name] = os.spawnl(os.P_NOWAIT, *args)
def __init_bus(self):
+ method_name="ibus"
+ filename=".i18n"
+ usr_home =os.path.expanduser('~')
+
self.__bus = IBus.Bus()
if self.__bus.is_connected():
return
- message = _("The IBus daemon is not running. Do you wish to start it?")
+ message = _("Could not connect to IBus daemon.\n"
+ "Do you wish to switch to IBus on next login?")
dlg = Gtk.MessageDialog(message_type = Gtk.MessageType.QUESTION,
buttons = Gtk.ButtonsType.YES_NO,
text = message)
@@ -522,39 +527,11 @@
if id != Gtk.ResponseType.YES:
sys.exit(0)
- main_loop = GLib.MainLoop()
-
- timeout = 5
- GLib.timeout_add_seconds(timeout, lambda *args: main_loop.quit())
- self.__bus.connect("connected", lambda *args: main_loop.quit())
-
- os.spawnlp(os.P_NOWAIT, "ibus-daemon", "ibus-daemon", "--xim", "--daemonize")
-
- main_loop.run()
-
- if self.__bus.is_connected():
- message = _("IBus has been started! "
- "If you cannot use IBus, add the following lines to your $HOME/.bashrc; then relog into your desktop.\n"
- " export GTK_IM_MODULE=ibus\n"
- " export XMODIFIERS=@im=ibus\n"
- " export QT_IM_MODULE=ibus"
- )
- dlg = Gtk.MessageDialog(message_type = Gtk.MessageType.INFO,
- buttons = Gtk.ButtonsType.OK,
- text = message)
- id = dlg.run()
- dlg.destroy()
- self.__flush_gtk_events()
- else:
- # Translators: %d == 5 currently
- message = _("IBus daemon could not be started in %d seconds.")
- dlg = Gtk.MessageDialog(message_type = Gtk.MessageType.INFO,
- buttons = Gtk.ButtonsType.OK,
- text = message % timeout)
- id = dlg.run()
- dlg.destroy()
- self.__flush_gtk_events()
- sys.exit(0)
+ filename = os.path.join(usr_home, filename)
+ with open(filename, "w+") as f:
+ cmd = 'export INPUT_METHOD=\"' + method_name + '\"'
+ f.writelines(cmd)
+ sys.exit(0)
def __shortcut_button_clicked_cb(self, button, name, section, _name, entry):
buttons = (_("_Cancel"), Gtk.ResponseType.CANCEL,

57
xim.d-ibus-121 Normal file
View File

@ -0,0 +1,57 @@
if ! type ibus-daemon > /dev/null 2>&1 ; then
echo "ibus is not available."
return 1
fi
# explicitly set below, as referred in xdg autostart
export INPUT_METHOD=ibus
case "$WINDOWMANAGER" in
# GNOME 3 Settings Daemon keyboard plugin manages all ibus settings itself,
# so don't do manual setup&startup of ibus otherwise it would conflict with
# G-S-D. see bnc#873016.
*gnome*)
SOURCES=$(gsettings get org.freedesktop.ibus.general preload-engines)
if [ "$SOURCES" == '@as []' ]; then
echo "initial GNOME startup, ibus default configuration applied"
ibus-daemon -d
timer=5
while [ "$SOURCES" == '@as []' ] && [ ${timer} -gt 0 ]; do
sleep 1
timer=$[${timer}-1]
SOURCES=$(gsettings get org.freedesktop.ibus.general preload-engines)
done
ibus exit
fi
# make sure G-S-D keyboard plugin is active
echo "ibus will be managed by GNOME."
gsettings set org.gnome.settings-daemon.plugins.keyboard active true
return 0
;;
esac
export XMODIFIERS="@im=ibus"
export GTK_IM_MODULE=ibus
export QT_IM_SWITCHER=imsw-multi
# Qt5
export QT_IM_MODULE=ibus
# Qt4
if [ -e /usr/$SYS_LIB/qt4/plugins/inputmethods/libqtim-ibus.so ]; then
export QT4_IM_MODULE=ibus
else
export QT4_IM_MODULE=xim
fi
case "$WINDOWMANAGER" in
*kde*|*plasma*|*xfce*|*lxde*)
# started via xdg autostart
;;
*)
# FIXME: a little bit of delay is required to avoid race
(sleep 2; ibus-daemon --xim -d) &
;;
esac
# success:
return 0

26
xim.ibus.suse.template Normal file
View File

@ -0,0 +1,26 @@
#~/.xim template for users to set ibus as default input method
#copy this file to ~/.xim
#logout and login again, that's all
#for more infomations, see ~/.xim.template
#if any program can't input Chinese, try export #LC_CTYPE=zh_TW.UTF-8, e.g
export LC_CTYPE=$LANG
export XMODIFIERS="@im=ibus"
export GTK_IM_MODULE=ibus
export QT_IM_SWITCHER=imsw-multi
os_type=`uname -i`
if [ $os_type = "x86_64" ]; then
if [ -e /usr/lib64/qt4/plugins/inputmethods/libqtim-ibus.so ]; then
export QT_IM_MODULE=ibus
else
export QT_IM_MODULE=xim
fi
else
if [ -e /usr/lib/qt4/plugins/inputmethods/libqtim-ibus.so ]; then
export QT_IM_MODULE=ibus
else
export QT_IM_MODULE=xim
fi
fi
ibus-daemon --xim &