diff --git a/ibus-HEAD.patch b/ibus-HEAD.patch index bbd872a..632c253 100644 --- a/ibus-HEAD.patch +++ b/ibus-HEAD.patch @@ -2755,3 +2755,401 @@ index 43990d5f..378388d9 100644 -- 2.21.0 +From bccf94d5ec1c5fc80d5aeac622f2ab8007d5a28a Mon Sep 17 00:00:00 2001 +From: fujiwarat +Date: Fri, 29 Nov 2019 20:28:49 +0900 +Subject: [PATCH] src/tests: RHEL codereview for ibus-desktop-testing-runner + +--- + src/tests/ibus-desktop-testing-runner.in | 16 ++++++++++------ + 1 file changed, 10 insertions(+), 6 deletions(-) + +diff --git a/src/tests/ibus-desktop-testing-runner.in b/src/tests/ibus-desktop-testing-runner.in +index 141e9b5b..72537cd4 100755 +--- a/src/tests/ibus-desktop-testing-runner.in ++++ b/src/tests/ibus-desktop-testing-runner.in +@@ -28,6 +28,10 @@ + # # /root/ibus/tests/test-console.sh --tests ibus-compose \ + # --builddir /root/ibus/src/tests --srcdir /root/ibus/src/tests + ++# POSIX sh has no 'echo -e' ++: ${ECHO:='/usr/bin/echo'} ++ ++ + PROGNAME=`basename $0` + VERSION=0.1 + DISPLAY=:99.0 +@@ -54,15 +58,15 @@ print_log() + shift + fi + NO_ESCAPE=`echo $@ | sed -e 's/\\\033\\[0;3.m//g' -e 's/\\\033\\[0m//g'` +- echo $NO_ESCAPE >> $RESULT_LOG ++ $ECHO $NO_ESCAPE >> $RESULT_LOG + else +- echo $@ ++ $ECHO $@ + fi + } + + usage() + { +- echo -e \ ++ $ECHO -e \ + "This test runs /usr/bin/ibus-daemon after install ibus\n" \ + "$PROGNAME [OPTIONS…]\n" \ + "\n" \ +@@ -92,7 +96,7 @@ parse_args() + while [ 1 ] ; do + case "$1" in + -h | --help ) usage; exit 0;; +- -v | --version ) echo -e "$VERSION"; exit 0;; ++ -v | --version ) $ECHO -e "$VERSION"; exit 0;; + -b | --builddir ) BUILDDIR="$2"; shift 2;; + -s | --srcdir ) SRCDIR="$2"; shift 2;; + -c | --no-graphics ) HAVE_GRAPHICS=0; shift;; +@@ -121,7 +125,7 @@ init_desktop() + fi + if [ "$TEST_LOG" = "" ] ; then + print_log -e "${RED}FAIL${NC}: ${RED}ERROR${NC}: a log file is required to get return value with 'read' command" +- exit -1 ++ exit 255 + elif [ -f $TEST_LOG ] ; then + rm $TEST_LOG + fi +@@ -291,7 +295,7 @@ EOF + done + child_pass=`grep '^PASS:' $TEST_LOG | wc -l` + child_fail=`grep '^FAIL:' $TEST_LOG | wc -l` +- if [ $child_pass -ne 0 -o $child_fail -ne 0 ] ; then ++ if [ $child_pass -ne 0 ] || [ $child_fail -ne 0 ] ; then + pass=$child_pass + if [ $child_fail -ne 0 ] ; then + fail=`expr $child_fail / 2` +-- +2.21.0 + +From d50627f0b7a000ee13ea6dcc02a4162be1fa853d Mon Sep 17 00:00:00 2001 +From: fujiwarat +Date: Tue, 3 Dec 2019 21:42:49 +0900 +Subject: [PATCH] src/tests: RHEL codereview #2 for ibus-desktop-testing-runner + +--- + src/tests/ibus-compose-locales.in | 21 +++++++-------- + src/tests/ibus-desktop-testing-runner.in | 33 ++++++++++++------------ + 2 files changed, 27 insertions(+), 27 deletions(-) + +diff --git a/src/tests/ibus-compose-locales.in b/src/tests/ibus-compose-locales.in +index f650b584..b36165fe 100755 +--- a/src/tests/ibus-compose-locales.in ++++ b/src/tests/ibus-compose-locales.in +@@ -7,27 +7,26 @@ BUILDDIR=`dirname $0` + export IBUS_COMPOSE_CACHE_DIR=$PWD + + retval=0 +-# Let for-loop notice '\n' as a delimiter +-IFS=$'\n' +-for var in `cat $SRCDIR/ibus-compose.env` ++# Deleted for var in `cat *.env` because IFS=$'\n' is not supported in POSIX sh ++while read var + do +- # Revert IFS to recognize env a=foo b=foo +- IFS=' ' + IS_COMMENT=`echo "$var" | grep "^#"` + if [ "x$IS_COMMENT" != x ] ; then + continue + fi +- echo "# Starting $var $BUILDDIR/ibus-compose $SRCDIR $@" +- env $var $BUILDDIR/ibus-compose $SRCDIR $@ ++ # Use $* instead of $@ not to mix strings and integers ++ echo "# Starting $var $BUILDDIR/ibus-compose $SRCDIR $*" ++ # Need to enclose $@ with double quotes not to split the array. ++ env $var $BUILDDIR/ibus-compose $SRCDIR "$@" + retval=`expr $retval + $?` +- echo "# Finished $var $BUILDDIR/ibus-compose $SRCDIR $@ with $retval" ++ echo "# Finished $var $BUILDDIR/ibus-compose $SRCDIR $* with $retval" + + CACHE_FILES=`ls *.cache` + if [ x"$CACHE_FILES" != x ] ; then + echo "Clean $CACHE_FILES" + rm $CACHE_FILES + fi +- IFS=$'\n' +-done +-IFS=' ' ++done << EOF_ENVS ++`cat $SRCDIR/ibus-compose.env` ++EOF_ENVS + exit $retval +diff --git a/src/tests/ibus-desktop-testing-runner.in b/src/tests/ibus-desktop-testing-runner.in +index 72537cd4..981941d5 100755 +--- a/src/tests/ibus-desktop-testing-runner.in ++++ b/src/tests/ibus-desktop-testing-runner.in +@@ -30,6 +30,8 @@ + + # POSIX sh has no 'echo -e' + : ${ECHO:='/usr/bin/echo'} ++# POSIX sh has $UID ++: ${UID:='`id -u`'} + + + PROGNAME=`basename $0` +@@ -57,10 +59,10 @@ print_log() + if [ x"$1" = x'-e' ] ; then + shift + fi +- NO_ESCAPE=`echo $@ | sed -e 's/\\\033\\[0;3.m//g' -e 's/\\\033\\[0m//g'` ++ NO_ESCAPE=`echo "$@" | sed -e 's/\\\033\\[0;3.m//g' -e 's/\\\033\\[0m//g'` + $ECHO $NO_ESCAPE >> $RESULT_LOG + else +- $ECHO $@ ++ $ECHO "$@" + fi + } + +@@ -231,9 +233,9 @@ run_direct_test_cases() + if test x"$ENVS" = x ; then + $BUILDDIR/$tst $SRCDIR 2>>$TEST_LOG 1>>$TEST_LOG + retval=$? +- read pass fail << EOF ++ read pass fail << EOF_COUNT + `count_case_result $retval $pass $fail` +-EOF ++EOF_COUNT + echo_case_result $retval $tst + CACHE_FILES=`ls *.cache` + if [ x"$CACHE_FILES" != x ] ; then +@@ -242,11 +244,9 @@ EOF + fi + else + i=1 +- # Let for-loop notice '\n' as a delimiter +- IFS=$'\n' +- for e in $ENVS; do +- # Revert IFS to recognize env a=foo b=foo +- IFS=' ' ++ # Deleted for var in "$ENVS" because IFS=$'\n' is not supported ++ # in POSIX sh ++ while read e ; do + first=`echo "$e" | grep '^#'` + if test x"$first" = x"#" ; then + continue +@@ -255,9 +255,9 @@ EOF + env $e $BUILDDIR/$tst $SRCDIR 2>>$TEST_LOG 1>>$TEST_LOG + retval=$? + echo "# Finished $e $BUILDDIR/$tst $SRCDIR with $retval" >>$TEST_LOG +- read pass fail << EOF ++ read pass fail << EOF_COUNT + `count_case_result $retval $pass $fail` +-EOF ++EOF_COUNT + echo_case_result $retval $tst $e + CACHE_FILES=`ls *.cache` + if [ x"$CACHE_FILES" != x ] ; then +@@ -265,9 +265,9 @@ EOF + rm $CACHE_FILES + fi + i=`expr $i + 1` +- IFS=$'\n' +- done +- IFS=' ' ++ done << EOF_ENVS ++ `echo "$ENVS"` ++EOF_ENVS + fi + done + echo $pass $fail +@@ -357,7 +357,7 @@ finit() + + main() + { +- parse_args $@ ++ parse_args "$@" + init_desktop + run_dbus_daemon 2>>$TEST_LOG 1>>$TEST_LOG + run_desktop 2>>$TEST_LOG 1>>$TEST_LOG +@@ -365,4 +365,5 @@ main() + finit + } + +-main $@ ++# Need to enclose $@ with double quotes not to split the array. ++main "$@" +-- +2.21.0 + +From 25d11f5cfd4c39e53be11a1348da29a61593cc4c Mon Sep 17 00:00:00 2001 +From: fujiwarat +Date: Wed, 11 Dec 2019 16:28:22 +0900 +Subject: [PATCH] client/gtk2: Fix to set use_button_press_event after signals + are connected + +_ibus_context_update_preedit_text_cb() can be called with reset signals +before ibus_im_context_set_client_window() is called. Then +use_button_press_event needs to be set only when the signals are connected. + +BUG=https://github.com/ibus/ibus/issues/1980 +--- + client/gtk2/ibusimcontext.c | 12 ++++++++---- + 1 file changed, 8 insertions(+), 4 deletions(-) + +diff --git a/client/gtk2/ibusimcontext.c b/client/gtk2/ibusimcontext.c +index 5e3457ba..ac5de809 100644 +--- a/client/gtk2/ibusimcontext.c ++++ b/client/gtk2/ibusimcontext.c +@@ -1074,8 +1074,9 @@ ibus_im_context_reset (GtkIMContext *context) + /* Commented out ibus_im_context_clear_preedit_text(). + * Hangul needs to receive the reset callback with button press + * but other IMEs should avoid to receive the reset callback +- * so the signal would need to be customized with GtkSetting. +- * IBus uses button-press-event instead. ++ * by themselves. ++ * IBus uses button-press-event instead until GTK is fixed. ++ * https://gitlab.gnome.org/GNOME/gtk/issues/1534 + */ + ibus_input_context_reset (ibusimcontext->ibuscontext); + } +@@ -1657,10 +1658,13 @@ _ibus_context_update_preedit_text_cb (IBusInputContext *ibuscontext, + if (!ibusimcontext->use_button_press_event && + mode == IBUS_ENGINE_PREEDIT_COMMIT) { + #if !GTK_CHECK_VERSION (3, 93, 0) +- if (ibusimcontext->client_window) ++ if (ibusimcontext->client_window) { + _connect_button_press_event (ibusimcontext, TRUE); +-#endif ++ ibusimcontext->use_button_press_event = TRUE; ++ } ++#else + ibusimcontext->use_button_press_event = TRUE; ++#endif + } + + str = text->text; +-- +2.21.0 + +From 7830673205140e901df354b80a00254f7c08f30d Mon Sep 17 00:00:00 2001 +From: fujiwarat +Date: Wed, 11 Dec 2019 19:10:24 +0900 +Subject: [PATCH] client/gtk2: Add IBUS_AUTO_PREEDIT_COMMIT_APPS env for + Hangul + +Firefox no longer connect "button-press-event" but uses +GtkGestureMultiPress in GtkWindowPrivate and connects "pressed" +instead and do not propagate the event with "button-press-event". + +We don't commit the preedit text in the client here for the +workaround and let firefox commit the preedit text to avoid the +double preedit text with mouse click. + +BUG=https://github.com/ibus/ibus/issues/1980 +--- + client/gtk2/ibusimcontext.c | 32 ++++++++++++++++++++++++++++---- + configure.ac | 13 ++++++++++++- + 2 files changed, 40 insertions(+), 5 deletions(-) + +diff --git a/client/gtk2/ibusimcontext.c b/client/gtk2/ibusimcontext.c +index ac5de809..df78ce48 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 +- * Copyright (C) 2015-2018 Takao Fujiwara +- * Copyright (C) 2008-2018 Red Hat, Inc. ++ * Copyright (C) 2015-2019 Takao Fujiwara ++ * Copyright (C) 2008-2019 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 +@@ -97,6 +97,9 @@ static gboolean _use_sync_mode = FALSE; + static const gchar *_discard_password_apps = ""; + static gboolean _use_discard_password = FALSE; + ++static const gchar *_auto_commit_apps = AUTO_PREEDIT_COMMIT_APPS; ++static gboolean _use_auto_commit = FALSE; ++ + static GtkIMContext *_focus_im_context = NULL; + static IBusInputContext *_fake_context = NULL; + static GdkWindow *_input_window = NULL; +@@ -636,6 +639,7 @@ ibus_im_context_class_init (IBusIMContextClass *class) + !(ENABLE_SNOOPER)); + _use_sync_mode = _get_boolean_env ("IBUS_ENABLE_SYNC_MODE", FALSE); + _use_discard_password = _get_boolean_env ("IBUS_DISCARD_PASSWORD", FALSE); ++ _use_auto_commit = _get_boolean_env ("IBUS_AUTO_PREEDIT_COMMIT", FALSE); + + #define CHECK_APP_IN_CSV_ENV_VARIABLES(retval, \ + env_apps, \ +@@ -672,6 +676,12 @@ ibus_im_context_class_init (IBusIMContextClass *class) + _discard_password_apps, + TRUE); + } ++ if (!_use_auto_commit) { ++ CHECK_APP_IN_CSV_ENV_VARIABLES (_use_auto_commit, ++ IBUS_AUTO_PREEDIT_COMMIT_APPS, ++ _auto_commit_apps, ++ TRUE); ++ } + + #undef CHECK_APP_IN_CSV_ENV_VARIABLES + +@@ -896,9 +906,23 @@ ibus_im_context_clear_preedit_text (IBusIMContext *ibusimcontext) + IBUS_ENGINE_PREEDIT_CLEAR, + ibusimcontext); + if (preedit_string) { +- g_signal_emit (ibusimcontext, _signal_commit_id, 0, preedit_string); ++ /* Firefox no longer connect "button-press-event" but uses ++ * GtkGestureMultiPress in GtkWindowPrivate and connects "pressed" ++ * instead and do not propagate the event with "button-press-event". ++ * We don't commit the preedit text in the client here for the ++ * workaround and let firefox commit the preedit text to avoid the ++ * double preedit text with mouse click. ++ * After we fix the GTK reset signal to always emit the reset signal ++ * with mouse click, also will try to fix the Firefox ++ * reset signal so that ibus clients receive the signal before Firefox ++ * composes the preedit text because the options of commit, clear, ++ * keep depends on each IBus engine but Firefox cannot know each engine. ++ */ ++ if (!_use_auto_commit) { ++ g_signal_emit (ibusimcontext, _signal_commit_id, 0, preedit_string); ++ _request_surrounding_text (ibusimcontext); ++ } + g_free (preedit_string); +- _request_surrounding_text (ibusimcontext); + } + } + +diff --git a/configure.ac b/configure.ac +index ab74a380..12642834 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -540,6 +540,16 @@ AC_ARG_WITH(no-snooper-apps, + AC_DEFINE_UNQUOTED(NO_SNOOPER_APPS, "$NO_SNOOPER_APPS", + [Does not enbale keyboard snooper in those applications]) + ++# Option for auto-preedit-commit applications. ++AC_ARG_WITH(auto-preedit-commit-apps, ++ AS_HELP_STRING([--with-auto-preedit-commit-apps[=regex1,regex2]], ++ [Applications have auto-commit of preedit with mouse click (like: .*chrome.*,firefox.*)]), ++ AUTO_PREEDIT_COMMIT_APPS=$with_auto_preedit_commit_apps, ++ AUTO_PREEDIT_COMMIT_APPS=[firefox.*,.*chrome.*,.*chromium.*] ++) ++AC_DEFINE_UNQUOTED(AUTO_PREEDIT_COMMIT_APPS, "$AUTO_PREEDIT_COMMIT_APPS", ++ [Applications have auto-commit of preedit with mouse click]) ++ + # GNOME 3 uses the theme's icon. + AC_ARG_WITH(panel-icon-keyboard, + AS_HELP_STRING([--with-panel-icon-keyboard[=icon_name]], +@@ -812,7 +822,8 @@ Build options: + Build UI $enable_ui + Build engine $enable_engine + Enable key snooper $enable_key_snooper +- No snooper regexes "$NO_SNOOPER_APPS" ++ No snooper apps "$NO_SNOOPER_APPS" ++ Auto preedit commit apps "$AUTO_PREEDIT_COMMIT_APPS" + Panel icon "$IBUS_ICON_KEYBOARD" + Enable surrounding-text $enable_surrounding_text + Enable Emoji dict $enable_emoji_dict +-- +2.21.0 + diff --git a/ibus.spec b/ibus.spec index 59e7a8a..c4fe6f6 100644 --- a/ibus.spec +++ b/ibus.spec @@ -35,7 +35,7 @@ Name: ibus Version: 1.5.21 -Release: 4%{?dist} +Release: 5%{?dist} Summary: Intelligent Input Bus for Linux OS License: LGPLv2+ URL: https://github.com/ibus/%name/wiki @@ -256,6 +256,7 @@ the functionality of the installed %{name} package. %prep %autosetup -S git # cp client/gtk2/ibusimcontext.c client/gtk3/ibusimcontext.c || : +cp client/gtk2/ibusimcontext.c client/gtk3/ibusimcontext.c || : # prep test @@ -463,6 +464,10 @@ dconf update || : %{_datadir}/installed-tests/ibus %changelog +* Wed Dec 11 2019 Takao Fujiwara - 1.5.21-5 +- Add RHEL code reviews +- Fix Hangul preedit with mouse click for RHEL 8 + * Mon Nov 18 2019 Takao Fujiwara - 1.5.21-4 - Replace push with cd for Posix SH - Use XDG_CONFIG_HOME for Unix socket directory