ibus/ibus-HEAD.patch

233 lines
9.6 KiB
Diff
Raw Normal View History

From b3b90f0e467ade81165d67638ca7c2541963a879 Mon Sep 17 00:00:00 2001
From: fujiwarat <takao.fujiwara1@gmail.com>
Date: Sat, 20 Mar 2021 20:28:42 +0900
Subject: [PATCH] src/tests: Change default session gnome-session to mutter
gnome-shell 40 now shows the overview mode by login and
gnome-desktop-testing-runner cannot get the focus.
Now the default session is changed to mutter from gnome-session.
The default may be changed to twm if mutter also will be changed
not to accept the application focus in the future.
Disable Tour dialog which prevent test application from getting the
input focus.
Don't output FAIL if the actual failure is 0 for Fedora CI.
BUG=https://discourse.gnome.org/t/focus-on-autostart-application-by-login/5863
---
src/tests/ibus-desktop-testing-runner.in | 31 +++++++++++++++++++-----
1 file changed, 25 insertions(+), 6 deletions(-)
diff --git a/src/tests/ibus-desktop-testing-runner.in b/src/tests/ibus-desktop-testing-runner.in
index 4232c549..23e3411e 100755
--- a/src/tests/ibus-desktop-testing-runner.in
+++ b/src/tests/ibus-desktop-testing-runner.in
@@ -4,7 +4,7 @@
#
# ibus - The Input Bus
#
-# Copyright (c) 2018-2020 Takao Fujiwara <takao.fujiwara1@gmail.com>
+# Copyright (c) 2018-2021 Takao Fujiwara <takao.fujiwara1@gmail.com>
# Copyright (c) 2018 Red Hat, Inc.
#
# This program is free software; you can redistribute it and/or modify
@@ -36,7 +36,7 @@
PROGNAME=`basename $0`
-VERSION=0.1
+VERSION=0.2
DISPLAY=:99.0
BUILDDIR="."
SRCDIR="."
@@ -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,7 +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=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" \
@@ -115,6 +117,12 @@ parse_args()
* ) usage; exit 1;;
esac
done
+ DL='$'
+ HAS_DBUS_SUFFIX=`echo "$DESKTOP_COMMAND" | grep "\-with\-dbus$DL"`
+ if [ x"$HAS_DBUS_SUFFIX" != x ] ; then
+ DESKTOP_COMMAND=`echo "$DESKTOP_COMMAND" | sed -e 's/-with-dbus$//'`
+ DESKTOP_COMMAND="dbus-launch --exit-with-session $DESKTOP_COMMAND"
+ fi
}
init_desktop()
@@ -221,6 +229,12 @@ run_desktop()
if [ x"$HAS_GNOME" = x ] ; then
ibus-daemon --daemonize --verbose
sleep 3
+ else
+ # Disable Tour dialog to get focus
+ V=`gsettings get org.gnome.shell welcome-dialog-last-shown-version`
+ if [ x"$V" = x ] ; then
+ gsettings set org.gnome.shell welcome-dialog-last-shown-version '100'
+ fi
fi
}
@@ -360,8 +374,13 @@ EOF_RUNNER
;;
esac
echo ""
- print_log -e "${GREEN}PASS${NC}: $pass"
- print_log -e "${RED}FAIL${NC}: $fail"
+ # Fedora CI assumes the test is failed even if $fail is 0.
+ if [ $pass -ne 0 ] ; then
+ print_log -e "${GREEN}PASS${NC}: $pass"
+ fi
+ if [ $fail -ne 0 ] ; then
+ print_log -e "${RED}FAIL${NC}: $fail"
+ fi
echo ""
if [ $TEST_LOG_STDOUT -eq 1 ] ; then
cat $TEST_LOG
--
2.28.0
From d105a3941aad53b0c7470a1e9c1033987b029fb8 Mon Sep 17 00:00:00 2001
From: fujiwarat <takao.fujiwara1@gmail.com>
Date: Wed, 12 May 2021 18:54:30 +0900
Subject: [PATCH] client/gtk2: Implement
ibus_im_context_set_surrounding_with_selection()
Selection bounds need to be re-calculated when pre-edit text is
inserted and the selection position is changed.
GTK4 has a new API GtkIMContext.set_surrounding_with_selection()
to fix this issue and now IBus GTK module inherits the API.
BUG=https://github.com/ibus/ibus/issues/2013
---
client/gtk2/ibusimcontext.c | 53 ++++++++++++++++++++++++++++++-------
1 file changed, 44 insertions(+), 9 deletions(-)
diff --git a/client/gtk2/ibusimcontext.c b/client/gtk2/ibusimcontext.c
index e153081d..61194816 100644
--- a/client/gtk2/ibusimcontext.c
+++ b/client/gtk2/ibusimcontext.c
@@ -2,8 +2,8 @@
/* vim:set et sts=4: */
/* ibus - The Input Bus
* Copyright (C) 2008-2013 Peng Huang <shawn.p.huang@gmail.com>
- * Copyright (C) 2015-2020 Takao Fujiwara <takao.fujiwara1@gmail.com>
- * Copyright (C) 2008-2020 Red Hat, Inc.
+ * Copyright (C) 2015-2021 Takao Fujiwara <takao.fujiwara1@gmail.com>
+ * Copyright (C) 2008-2021 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -165,11 +165,19 @@ static void ibus_im_context_set_cursor_location
static void ibus_im_context_set_use_preedit
(GtkIMContext *context,
gboolean use_preedit);
+#if !GTK_CHECK_VERSION (4, 1, 2)
static void ibus_im_context_set_surrounding
(GtkIMContext *slave,
const gchar *text,
- gint len,
- gint cursor_index);
+ int len,
+ int cursor_index);
+#endif
+static void ibus_im_context_set_surrounding_with_selection
+ (GtkIMContext *slave,
+ const gchar *text,
+ int len,
+ int cursor_index,
+ int anchor_index);
/* static methods*/
static void _ibus_context_update_preedit_text_cb
@@ -724,7 +732,12 @@ ibus_im_context_class_init (IBusIMContextClass *class)
#endif
im_context_class->set_cursor_location = ibus_im_context_set_cursor_location;
im_context_class->set_use_preedit = ibus_im_context_set_use_preedit;
+#if GTK_CHECK_VERSION (4, 1, 2)
+ im_context_class->set_surrounding_with_selection
+ = ibus_im_context_set_surrounding_with_selection;
+#else
im_context_class->set_surrounding = ibus_im_context_set_surrounding;
+#endif
gobject_class->notify = ibus_im_context_notify;
gobject_class->finalize = ibus_im_context_finalize;
@@ -1624,8 +1637,22 @@ get_selection_anchor_point (IBusIMContext *ibusimcontext,
static void
ibus_im_context_set_surrounding (GtkIMContext *context,
const gchar *text,
- gint len,
- gint cursor_index)
+ int len,
+ int cursor_index)
+{
+ ibus_im_context_set_surrounding_with_selection (context,
+ text,
+ len,
+ cursor_index,
+ cursor_index);
+}
+
+static void
+ibus_im_context_set_surrounding_with_selection (GtkIMContext *context,
+ const gchar *text,
+ int len,
+ int cursor_index,
+ int anchor_index)
{
g_return_if_fail (context != NULL);
g_return_if_fail (IBUS_IS_IM_CONTEXT (context));
@@ -1647,18 +1674,26 @@ ibus_im_context_set_surrounding (GtkIMContext *context,
ibustext = ibus_text_new_from_string (p);
g_free (p);
- guint anchor_pos = get_selection_anchor_point (ibusimcontext,
- cursor_pos,
- utf8_len);
+ gint anchor_pos = get_selection_anchor_point (ibusimcontext,
+ cursor_pos,
+ utf8_len);
ibus_input_context_set_surrounding_text (ibusimcontext->ibuscontext,
ibustext,
cursor_pos,
anchor_pos);
}
+#if GTK_CHECK_VERSION (4, 1, 2)
+ gtk_im_context_set_surrounding_with_selection (ibusimcontext->slave,
+ text,
+ len,
+ cursor_index,
+ anchor_index);
+#else
gtk_im_context_set_surrounding (ibusimcontext->slave,
text,
len,
cursor_index);
+#endif
}
static void
--
2.28.0