ibus/ibus-HEAD.patch
2021-09-01 12:21:31 +09:00

305 lines
10 KiB
Diff

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 943d37444d9cc0881cb5fff87bdd4b9efd5abdb4 Mon Sep 17 00:00:00 2001
From: fujiwarat <takao.fujiwara1@gmail.com>
Date: Mon, 9 Aug 2021 12:49:15 +0900
Subject: [PATCH] client/gtk2/ibusimcontext: Fix a key event loop with
forwarding keys.
_ibus_context_forward_key_event_cb() caused a key event loop in
_key_snooper_cb() with key release events.
---
client/gtk2/ibusimcontext.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/client/gtk2/ibusimcontext.c b/client/gtk2/ibusimcontext.c
index da9a402f..e66125df 100644
--- a/client/gtk2/ibusimcontext.c
+++ b/client/gtk2/ibusimcontext.c
@@ -366,6 +366,10 @@ ibus_im_context_commit_event (IBusIMContext *ibusimcontext,
g_signal_emit (ibusimcontext, _signal_commit_id, 0, text->text);
g_object_unref (text);
_request_surrounding_text (ibusimcontext);
+#if !GTK_CHECK_VERSION (3, 98, 4)
+ /* Avoid a loop with _ibus_context_forward_key_event_cb() */
+ event->state |= IBUS_HANDLED_MASK;
+#endif
return TRUE;
}
return FALSE;
@@ -643,12 +647,15 @@ _key_snooper_cb (GtkWidget *widget,
} while (0);
- if (ibusimcontext != NULL) {
+ if (ibusimcontext != NULL && event->type == GDK_KEY_PRESS) {
/* "retrieve-surrounding" signal sometimes calls unref by
* gtk_im_multicontext_get_slave() because priv->context_id is not
* the latest than global_context_id in GtkIMMulticontext.
* Since _focus_im_context is gotten by the focus_in event,
* it would be good to call ref here.
+ *
+ * Most release key events would be redundant from
+ * _ibus_context_forward_key_event_cb ().
*/
g_object_ref (ibusimcontext);
_request_surrounding_text (ibusimcontext);
@@ -657,7 +664,7 @@ _key_snooper_cb (GtkWidget *widget,
retval = _process_key_event (ibuscontext, event, ibusimcontext);
- if (ibusimcontext != NULL) {
+ if (ibusimcontext != NULL && event->type == GDK_KEY_PRESS) {
/* unref ibusimcontext could call ibus_im_context_finalize here
* because "retrieve-surrounding" signal could call unref.
*/
--
2.28.0
From 179ebddf4dbde1cef1cea2df4e659cf4940d1a30 Mon Sep 17 00:00:00 2001
From: fujiwarat <takao.fujiwara1@gmail.com>
Date: Fri, 27 Aug 2021 20:05:02 +0900
Subject: [PATCH] src/tests: Add --screendump option in
ibus-desktop-testing-runner
The screendump is useful in CI to if check gnome-shell-extension-no-overview
works.
Also add ibus-desktop-testing-autostart to get the debug info in CI.
You can copy ibus-desktop-testing.desktop to $HOME/.config/autostart
if CI fails.
---
src/tests/Makefile.am | 11 +++++
src/tests/ibus-desktop-testing-autostart | 55 +++++++++++++++++++++++
src/tests/ibus-desktop-testing-runner.in | 20 +++++++--
src/tests/ibus-desktop-testing.desktop.in | 11 +++++
4 files changed, 93 insertions(+), 4 deletions(-)
create mode 100755 src/tests/ibus-desktop-testing-autostart
create mode 100644 src/tests/ibus-desktop-testing.desktop.in
diff --git a/src/tests/Makefile.am b/src/tests/Makefile.am
index 13c06eb4..7d00f236 100644
--- a/src/tests/Makefile.am
+++ b/src/tests/Makefile.am
@@ -96,6 +96,7 @@ test_sourcesdir = $(datadir)/installed-tests/ibus
CLEANFILES += \
$(test_metas) \
ibus-desktop-testing-runner \
+ org.freedesktop.IBus.Desktop.Testing.desktop \
$(NULL)
test_execs_PROGRAMS = $(TESTS)
@@ -106,6 +107,14 @@ CLEANFILES += \
$(NULL)
endif
test_execsdir = $(libexecdir)/installed-tests/ibus
+libexec_SCRIPTS = ibus-desktop-testing-autostart
+
+test_frame_DATA = org.freedesktop.IBus.Desktop.Testing.desktop
+test_framedir = $(pkgdatadir)/tests
+org.freedesktop.IBus.Desktop.Testing.desktop: ibus-desktop-testing.desktop.in
+ $(AM_V_GEN) sed -e "s|\@libexecdir\@|$(libexecdir)|g" \
+ $< > $@.tmp && \
+ mv $@.tmp $@
endif
$(test_metas): $(test_metas_in) $(test_programs)
@@ -133,6 +142,8 @@ EXTRA_DIST = \
ibus-compose.emoji \
ibus-compose.env \
ibus-compose-locales.in \
+ ibus-desktop-testing.desktop.in \
+ ibus-desktop-testing-autostart \
ibus-desktop-testing-runner.in \
$(NULL)
diff --git a/src/tests/ibus-desktop-testing-autostart b/src/tests/ibus-desktop-testing-autostart
new file mode 100755
index 00000000..da22b64e
--- /dev/null
+++ b/src/tests/ibus-desktop-testing-autostart
@@ -0,0 +1,55 @@
+#!/bin/sh
+# -*- mode: C; c-basic-offset: 4; indent-tabs-mode: nil; -*-
+# vim:set noet ts=4:
+#
+# ibus - The Input Bus
+#
+# Copyright (c) 2021 Takao Fujiwara <takao.fujiwara1@gmail.com>
+# Copyright (c) 2021 Red Hat, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+TEST_LOG=
+COMMANDS='
+id
+echo $DISPLAY
+pwd
+pstree -asp $$
+gsettings list-recursively org.gnome.shell
+rpm -q gnome-shell-extension-no-overview gnome-shell gnome-session
+'
+
+if [ $# -gt 0 ] ; then
+ TEST_LOG=$1
+fi
+
+run_test()
+{
+while read cmd ; do
+ if [ x"$cmd" = x ] ; then
+ continue
+ fi
+ echo "# $cmd"
+ eval "$cmd"
+done << EOF_COMMANDS
+`echo "$COMMANDS"`
+EOF_COMMANDS
+}
+
+if [ x"$TEST_LOG" = x ] ; then
+ run_test
+else
+ run_test 2>>$TEST_LOG 1>>$TEST_LOG
+fi
diff --git a/src/tests/ibus-desktop-testing-runner.in b/src/tests/ibus-desktop-testing-runner.in
index c1016703..48528326 100755
--- a/src/tests/ibus-desktop-testing-runner.in
+++ b/src/tests/ibus-desktop-testing-runner.in
@@ -36,13 +36,14 @@
PROGNAME=`basename $0`
-VERSION=0.2
+VERSION=0.3
DISPLAY=:99.0
BUILDDIR="."
SRCDIR="."
TEST_LOG="test-suite.log"
TEST_LOG_STDOUT=0
RESULT_LOG=""
+SCREEN_LOG=""
HAVE_GRAPHICS=1
DESKTOP_COMMAND="dbus-launch --exit-with-session gnome-session"
PID_XORG=0
@@ -90,14 +91,15 @@ usage()
"-T, --timeout=TIMEOUT Set timeout (default TIMEOUT is 300 sec).\n" \
"-o, --output=OUTPUT_FILE OUtput the log to OUTPUT_FILE\n" \
"-O, --result=RESULT_FILE OUtput the result to RESULT_FILE\n" \
+"-S, --screendump=DUMP_FILE OUtput the screen to DUMP_FILE ('STDOUT' can be stdout)\n" \
""
}
parse_args()
{
# This is GNU getopt. "sudo port getopt" in BSD?
- ARGS=`getopt -o hvb:s:cd:t:r:T:o:O: --long \
- help,version,builddir:,srcdir:,no-graphics,desktop:,tests:,runner:,timeout:,output:,result:\
+ ARGS=`getopt -o hvb:s:cd:t:r:T:o:O:S: --long \
+ help,version,builddir:,srcdir:,no-graphics,desktop:,tests:,runner:,timeout:,output:,result:,screendump:\
-- "$@"`;
eval set -- "$ARGS"
while [ 1 ] ; do
@@ -113,6 +115,7 @@ parse_args()
-T | --timeout ) TIMEOUT="$2"; shift 2;;
-o | --output ) TEST_LOG="$2"; shift 2;;
-O | --result ) RESULT_LOG="$2"; shift 2;;
+ -S | --screendump ) SCREEN_LOG="$2"; shift 2;;
-- ) shift; break;;
* ) usage; exit 1;;
esac
@@ -259,6 +262,7 @@ run_desktop()
{
echo "$DESKTOP_COMMAND" | grep gnome-session > /dev/null
HAS_GNOME=$?
+ export DISPLAY=$DISPLAY
if test $HAVE_GRAPHICS -eq 1 ; then
/usr/libexec/Xorg.wrap -noreset +extension GLX +extension RANDR +extension RENDER -logfile ./xorg.log -config ./xorg.conf -configdir . $DISPLAY &
else
@@ -266,7 +270,6 @@ run_desktop()
fi
PID_XORG=$!
sleep 1
- export DISPLAY=$DISPLAY
# init_gnome need to be called with $DISPLAY before gnome-session is called
if [ $HAS_GNOME -eq 0 ] ; then
init_gnome
@@ -454,6 +457,15 @@ main()
init_desktop
run_dbus_daemon 2>>$TEST_LOG 1>>$TEST_LOG
run_desktop 2>>$TEST_LOG 1>>$TEST_LOG
+ if [ x"$SCREEN_LOG" != x ] ; then
+ SCREEN_PNG="`date '+%Y%m%d%H%M%S'`.png"
+ gnome-screenshot --file=$SCREEN_PNG
+ if [ x"$SCREEN_LOG" = xSTDOUT ] ; then
+ base64 $SCREEN_PNG
+ else
+ base64 $SCREEN_PNG > $SCREEN_LOG
+ fi
+ fi
run_test_suite
finit
}
diff --git a/src/tests/ibus-desktop-testing.desktop.in b/src/tests/ibus-desktop-testing.desktop.in
new file mode 100644
index 00000000..fa0c9b40
--- /dev/null
+++ b/src/tests/ibus-desktop-testing.desktop.in
@@ -0,0 +1,11 @@
+[Desktop Entry]
+Name=IBus Desktop Testing Runner
+GenericName=Input Method Desktop Testing Runner
+Comment=Test plugin for IBus Desktop Testing
+Exec=@ibexecdir@/ibus-desktop-testing-autostart /var/tmp/ibus-ci-autostart.log
+Terminal=false
+Type=Application
+Encoding=UTF-8
+Icon=ibus
+Categories=System
+Keywords=im;
--
2.28.0