Bug 1876877 - Fix to pull the correct language with no iso639 variants

- Accept xdigits only for Unicode typing
This commit is contained in:
Takao Fujiwara 2020-09-09 19:25:51 +09:00
parent cb699f2a5b
commit 36d4212fc2
4 changed files with 296 additions and 3 deletions

1
.gitignore vendored
View File

@ -57,3 +57,4 @@ ibus-1.3.6.tar.gz
/ibus-1.5.21.tar.gz /ibus-1.5.21.tar.gz
/ibus-1.5.22.tar.gz /ibus-1.5.22.tar.gz
/ibus-simple-1.5.22.20200827.xml.gz /ibus-simple-1.5.22.20200827.xml.gz
/ibus-simple-1.5.22.20200909.xml.gz

View File

@ -2368,3 +2368,291 @@ index 11bcc6c2..a6e4194b 100755
-- --
2.24.1 2.24.1
From 00adea6d16939e2da35ede7f2ecf3fe0a2156fa6 Mon Sep 17 00:00:00 2001
From: "ntfs.hard" <ntfs.hard@gmail.com>
Date: Thu, 3 Sep 2020 14:59:35 +0900
Subject: [PATCH] Fix for several error spotted by static analyzer
- ibuscomposetable.c, ibusxml.c:
Check size before memory access
- inputcontext.c:
Use logical operator for bool type variables
- config.c:
Extra break removed
BUG=https://github.com/ibus/ibus/pull/2242
---
bus/inputcontext.c | 6 +++---
src/ibuscomposetable.c | 2 +-
src/ibusxml.c | 2 +-
4 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/bus/inputcontext.c b/bus/inputcontext.c
index ceea4b60..8d84fd05 100644
--- a/bus/inputcontext.c
+++ b/bus/inputcontext.c
@@ -2842,11 +2842,11 @@ bus_input_context_update_preedit_text (BusInputContext *context,
context->preedit_text = (IBusText *) g_object_ref_sink (text ? text :
text_empty);
context->preedit_cursor_pos = cursor_pos;
- if (use_extension)
+ if (use_extension) {
context->preedit_visible = visible;
- if (use_extension)
context->preedit_mode = mode;
- extension_visible = context->preedit_visible |
+ }
+ extension_visible = context->preedit_visible ||
(context->emoji_extension != NULL);
if (use_extension && context->emoji_extension) {
diff --git a/src/ibuscomposetable.c b/src/ibuscomposetable.c
index c50be2b3..ef20469c 100644
--- a/src/ibuscomposetable.c
+++ b/src/ibuscomposetable.c
@@ -382,7 +382,7 @@ ibus_compose_list_check_duplicated (GList *compose_list,
if (n_outputs == unichar_length (output_chars)) {
int j = 0;
- while (compose_data->values[j] && j < n_outputs) {
+ while (j < n_outputs && compose_data->values[j]) {
if (compose_data->values[j] != output_chars[j])
break;
++j;
diff --git a/src/ibusxml.c b/src/ibusxml.c
index 266a8207..b6d0feb8 100644
--- a/src/ibusxml.c
+++ b/src/ibusxml.c
@@ -148,7 +148,7 @@ _is_space (const gchar *text,
{
gsize i = 0;
- for (i = 0; text[i] != '\0' && i < text_len; i++) {
+ for (i = 0; i < text_len && text[i] != '\0'; i++) {
switch (text[i]) {
case '\t':
case ' ':
--
2.24.1
From 7caead10d3698ef1ecaa97e6e122e27a720d612e Mon Sep 17 00:00:00 2001
From: fujiwarat <takao.fujiwara1@gmail.com>
Date: Thu, 3 Sep 2020 21:21:31 +0900
Subject: [PATCH] Fix string formats in translatable strings
---
data/dconf/org.freedesktop.ibus.gschema.xml | 2 +-
setup/enginetreeview.py | 6 +++---
setup/main.py | 6 +++---
tools/main.vala | 4 ++--
6 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/data/dconf/org.freedesktop.ibus.gschema.xml b/data/dconf/org.freedesktop.ibus.gschema.xml
index 11a179a6..a79e9296 100644
--- a/data/dconf/org.freedesktop.ibus.gschema.xml
+++ b/data/dconf/org.freedesktop.ibus.gschema.xml
@@ -195,7 +195,7 @@
<key name="lang" type="s">
<default>'en'</default>
<summary>Default language for emoji dictionary</summary>
- <description>Choose a default language of emoji dictionaries on the emoji dialog. The value $lang is applied to /usr/share/ibus/dicts/emoji-$lang.dict</description>
+ <description>Choose a default language of emoji dictionaries on the emoji dialog. The value $lang is applied to /usr/share/ibus/dicts/emoji-$lang.dict .</description>
</key>
<key name="favorites" type="as">
<default>[]</default>
diff --git a/setup/enginetreeview.py b/setup/enginetreeview.py
index aea84593..8534de5e 100644
--- a/setup/enginetreeview.py
+++ b/setup/enginetreeview.py
@@ -3,8 +3,8 @@
# ibus - The Input Bus
#
# Copyright (c) 2007-2015 Peng Huang <shawn.p.huang@gmail.com>
-# Copyright (c) 2014-2018 Takao Fujiwara <takao.fujiwara1@gmail.com>
-# Copyright (c) 2007-2018 Red Hat, Inc.
+# Copyright (c) 2014-2020 Takao Fujiwara <takao.fujiwara1@gmail.com>
+# Copyright (c) 2007-2020 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
@@ -93,7 +93,7 @@ class EngineTreeView(Gtk.TreeView):
renderer.set_property("has-entry", False)
renderer.set_property("editable", True)
- column = Gtk.TreeViewColumn(_("Kbd"))
+ column = Gtk.TreeViewColumn("Kbd")
column.set_expand(False)
column.set_fixed_width(32)
column.set_sizing(Gtk.TreeViewColumnSizing.FIXED)
diff --git a/setup/main.py b/setup/main.py
index 8c8d7a47..673c8cde 100644
--- a/setup/main.py
+++ b/setup/main.py
@@ -4,8 +4,8 @@
# ibus - The Input Bus
#
# Copyright (c) 2007-2016 Peng Huang <shawn.p.huang@gmail.com>
-# Copyright (c) 2010-2018 Takao Fujiwara <takao.fujiwara1@gmail.com>
-# Copyright (c) 2007-2016 Red Hat, Inc.
+# Copyright (c) 2010-2020 Takao Fujiwara <takao.fujiwara1@gmail.com>
+# Copyright (c) 2007-2020 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
@@ -547,7 +547,7 @@ class Setup(object):
self.__flush_gtk_events()
else:
# Translators: %d == 5 currently
- message = _("IBus daemon could not be started in %d seconds")
+ 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)
diff --git a/tools/main.vala b/tools/main.vala
index bf9c0fc9..26e7fd88 100644
--- a/tools/main.vala
+++ b/tools/main.vala
@@ -3,7 +3,7 @@
* ibus - The Input Bus
*
* Copyright(c) 2013 Peng Huang <shawn.p.huang@gmail.com>
- * Copyright(c) 2015-2018 Takao Fujiwara <takao.fujiwara1@gmail.com>
+ * Copyright(c) 2015-2020 Takao Fujiwara <takao.fujiwara1@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -453,7 +453,7 @@ const CommandEntry commands[] = {
{ "read-config", N_("Show the configuration values"), read_config },
{ "reset-config", N_("Reset the configuration values"), reset_config },
#if EMOJI_DICT
- { "emoji", N_("Save emoji on dialog to clipboard "), emoji_dialog },
+ { "emoji", N_("Save emoji on dialog to clipboard"), emoji_dialog },
#endif
{ "help", N_("Show this information"), print_help }
};
--
2.24.1
From a440942a62c46578377a8679c48146f597e338a4 Mon Sep 17 00:00:00 2001
From: fujiwarat <takao.fujiwara1@gmail.com>
Date: Wed, 9 Sep 2020 18:36:18 +0900
Subject: [PATCH] ui/gtk3: Accept xdigits only for Unicode typing
Ctrl-Shift-u behavior now follows GTK's one.
BUG=https://github.com/ibus/ibus/issues/2249
---
ui/gtk3/panelbinding.vala | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/ui/gtk3/panelbinding.vala b/ui/gtk3/panelbinding.vala
index 01c43b0d..861255b1 100644
--- a/ui/gtk3/panelbinding.vala
+++ b/ui/gtk3/panelbinding.vala
@@ -3,7 +3,7 @@
* ibus - The Input Bus
*
* Copyright(c) 2018 Peng Huang <shawn.p.huang@gmail.com>
- * Copyright(c) 2018 Takao Fujwiara <takao.fujiwara1@gmail.com>
+ * Copyright(c) 2018-2020 Takao Fujwiara <takao.fujiwara1@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -190,7 +190,7 @@ class Preedit : Gtk.Window {
public IBus.Text get_commit_text() {
string extension_text = m_extension_preedit_emoji.get_text();
- if (extension_text.length == 0)
+ if (extension_text.length == 0 && m_prefix != "u")
extension_text = m_extension_preedit_text.get_text();
return new IBus.Text.from_string(extension_text);
}
@@ -556,8 +556,10 @@ class PanelBinding : IBus.PanelService {
private bool key_press_keyval(uint keyval) {
unichar ch = IBus.keyval_to_unicode(keyval);
+ if (m_extension_name == "unicode" && !ch.isxdigit())
+ return false;
if (ch.iscntrl())
- return false;
+ return false;
string str = ch.to_string();
m_preedit.append_text(str);
string annotation = m_preedit.get_text();
--
2.24.1
From 3aa670e9f8319fe064ce7c45ce56304ca5af94dc Mon Sep 17 00:00:00 2001
From: fujiwarat <takao.fujiwara1@gmail.com>
Date: Wed, 9 Sep 2020 18:42:10 +0900
Subject: [PATCH] engine: Fix to pull the correct language with no iso639
variants
Some variants have iso639 but others do not in evdev.xml and
gensimple.py have to fallback to the layout iso639.
BUG=rhbz#1876877
---
engine/gensimple.py | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
diff --git a/engine/gensimple.py b/engine/gensimple.py
index 18f7dc8c..de6d7ff5 100755
--- a/engine/gensimple.py
+++ b/engine/gensimple.py
@@ -90,6 +90,7 @@ class EvdevXML(XMLFilterBase):
self.__description = ''
self.__variant = ''
self.__list_iso639 = []
+ self.__list_iso639_for_variant = []
def startDocument(self):
if self.__downstream:
self.__downstream.startDocument()
@@ -106,7 +107,10 @@ class EvdevXML(XMLFilterBase):
elif name == 'configItem':
self.__is_config_item = True
elif name == 'languageList':
- self.__list_iso639 = []
+ if self.__is_variant and self.__is_config_item:
+ self.__list_iso639_for_variant = []
+ elif self.__is_layout and self.__is_config_item:
+ self.__list_iso639 = []
elif name == 'iso639Id':
self.__is_iso639 = True
elif name == 'variant':
@@ -129,6 +133,7 @@ class EvdevXML(XMLFilterBase):
self.__is_iso639 = False
elif name == 'variant':
self.__is_variant = False
+ self.__list_iso639_for_variant = []
elif name == 'name':
self.__is_name = False
def characters(self, text):
@@ -140,11 +145,21 @@ class EvdevXML(XMLFilterBase):
elif self.__is_layout and self.__is_config_item:
self.__layout = text
elif self.__is_iso639:
+ if self.__is_variant and self.__is_config_item:
+ self.__list_iso639_for_variant.append(text)
+ elif self.__is_layout and self.__is_config_item:
self.__list_iso639.append(text)
def save(self):
if not self.__downstream:
return
- for iso in self.__list_iso639:
+ list_iso639 = []
+ if self.__is_variant and self.__is_config_item:
+ list_iso639 = self.__list_iso639_for_variant
+ if len(list_iso639) == 0:
+ list_iso639 = self.__list_iso639
+ elif self.__is_layout and self.__is_config_item:
+ list_iso639 = self.__list_iso639
+ for iso in list_iso639:
do_deny = False
for [xkb, layout, variant, lang] in self.__denylist:
if xkb == 'xkb' \
--
2.24.1

View File

@ -26,14 +26,14 @@
Name: ibus Name: ibus
Version: 1.5.22 Version: 1.5.22
Release: 15%{?dist} Release: 16%{?dist}
Summary: Intelligent Input Bus for Linux OS Summary: Intelligent Input Bus for Linux OS
License: LGPLv2+ License: LGPLv2+
URL: https://github.com/ibus/%name/wiki URL: https://github.com/ibus/%name/wiki
Source0: https://github.com/ibus/%name/releases/download/%{version}/%{name}-%{version}.tar.gz Source0: https://github.com/ibus/%name/releases/download/%{version}/%{name}-%{version}.tar.gz
Source1: %{name}-xinput Source1: %{name}-xinput
Source2: %{name}.conf.5 Source2: %{name}.conf.5
Source3: https://fujiwara.fedorapeople.org/ibus/po/%{name}-simple-1.5.22.20200827.xml.gz Source3: https://fujiwara.fedorapeople.org/ibus/po/%{name}-simple-1.5.22.20200909.xml.gz
Source4: https://fujiwara.fedorapeople.org/ibus/po/%{name}-po-1.5.22-20200827.tar.gz Source4: https://fujiwara.fedorapeople.org/ibus/po/%{name}-po-1.5.22-20200827.tar.gz
# Patch0: %%{name}-HEAD.patch # Patch0: %%{name}-HEAD.patch
Patch0: %{name}-HEAD.patch Patch0: %{name}-HEAD.patch
@ -461,6 +461,10 @@ dconf update || :
%{_datadir}/installed-tests/ibus %{_datadir}/installed-tests/ibus
%changelog %changelog
* Wed Sep 09 2020 Takao Fujiwara <tfujiwar@redhat.com> - 1.5.22-16
- Bug 1876877 - Fix to pull the correct language with no iso639 variants
- Accept xdigits only for Unicode typing
* Thu Aug 27 2020 Takao Fujiwara <tfujiwar@redhat.com> - 1.5.22-15 * Thu Aug 27 2020 Takao Fujiwara <tfujiwar@redhat.com> - 1.5.22-15
- Rename simple.xml to simple.xml.in - Rename simple.xml to simple.xml.in

View File

@ -1,3 +1,3 @@
SHA512 (ibus-1.5.22.tar.gz) = 0abe89acc6da8cea484a6b9f807c08e94869072f374f9e8f4541a426636f818f1c3cb8b9237f97245771f9e4bf19184983d8ac924177dc4824ca6e8b5304425d SHA512 (ibus-1.5.22.tar.gz) = 0abe89acc6da8cea484a6b9f807c08e94869072f374f9e8f4541a426636f818f1c3cb8b9237f97245771f9e4bf19184983d8ac924177dc4824ca6e8b5304425d
SHA512 (ibus-simple-1.5.22.20200827.xml.gz) = d97a0228507741ddbb06b17690694db900c0d983e00c86bed0537a825d90d951ff1287f3f7e72a706856ecb11c2172070d9eb9168f9e0a4ec28b6783862e742b SHA512 (ibus-simple-1.5.22.20200909.xml.gz) = bfa809b70dc55f293b9c766b8dfbb8d75ef66c055a6634d42e8b76df7bbbad241ba6a6ef0c38eb453ac547725b6368aa0ccc3e1bea45cb5f843f255630e919d9
SHA512 (ibus-po-1.5.22-20200827.tar.gz) = 87bcade0166744e186af81747d5f3c38e223a85f6bef859f714a8dc9912789def2bc41c67b78a2743455be3c53df31953ca382f0d23ac115a0a42deea7675de3 SHA512 (ibus-po-1.5.22-20200827.tar.gz) = 87bcade0166744e186af81747d5f3c38e223a85f6bef859f714a8dc9912789def2bc41c67b78a2743455be3c53df31953ca382f0d23ac115a0a42deea7675de3