ibus/ibus-HEAD.patch
2018-03-30 12:52:30 +09:00

157 lines
6.2 KiB
Diff

From c6439d74d5472c95de4d5c2cdc6487bfd508e3d8 Mon Sep 17 00:00:00 2001
From: fujiwarat <takao.fujiwara1@gmail.com>
Date: Thu, 15 Mar 2018 16:57:02 +0900
Subject: [PATCH] ui/gtk3: Add num pad Enter, Down, Up, Left, Right on Emojier
BUG=rhbz#1554813
R=Shawn.P.Huang@gmail.com
Review URL: https://codereview.appspot.com/337690043
---
ui/gtk3/emojier.vala | 25 +++++++++++++++++--------
1 file changed, 17 insertions(+), 8 deletions(-)
diff --git a/ui/gtk3/emojier.vala b/ui/gtk3/emojier.vala
index 8707e432..24029703 100644
--- a/ui/gtk3/emojier.vala
+++ b/ui/gtk3/emojier.vala
@@ -1918,6 +1918,7 @@ public class IBusEmojier : Gtk.ApplicationWindow {
return true;
break;
case Gdk.Key.Return:
+ case Gdk.Key.KP_Enter:
key_press_enter();
return true;
case Gdk.Key.BackSpace:
@@ -1959,29 +1960,37 @@ public class IBusEmojier : Gtk.ApplicationWindow {
}
return true;
case Gdk.Key.Right:
- key_press_cursor_horizontal(keyval, modifiers);
+ case Gdk.Key.KP_Right:
+ key_press_cursor_horizontal(Gdk.Key.Right, modifiers);
return true;
case Gdk.Key.Left:
- key_press_cursor_horizontal(keyval, modifiers);
+ case Gdk.Key.KP_Left:
+ key_press_cursor_horizontal(Gdk.Key.Left, modifiers);
return true;
case Gdk.Key.Down:
- key_press_cursor_vertical(keyval, modifiers);
+ case Gdk.Key.KP_Down:
+ key_press_cursor_vertical(Gdk.Key.Down, modifiers);
return true;
case Gdk.Key.Up:
- key_press_cursor_vertical(keyval, modifiers);
+ case Gdk.Key.KP_Up:
+ key_press_cursor_vertical(Gdk.Key.Up, modifiers);
return true;
case Gdk.Key.Page_Down:
- key_press_cursor_vertical(keyval, modifiers);
+ case Gdk.Key.KP_Page_Down:
+ key_press_cursor_vertical(Gdk.Key.Page_Down, modifiers);
return true;
case Gdk.Key.Page_Up:
- key_press_cursor_vertical(keyval, modifiers);
+ case Gdk.Key.KP_Page_Up:
+ key_press_cursor_vertical(Gdk.Key.Page_Up, modifiers);
return true;
case Gdk.Key.Home:
- if (key_press_cursor_home_end(keyval, modifiers))
+ case Gdk.Key.KP_Home:
+ if (key_press_cursor_home_end(Gdk.Key.Home, modifiers))
return true;
break;
case Gdk.Key.End:
- if (key_press_cursor_home_end(keyval, modifiers))
+ case Gdk.Key.KP_End:
+ if (key_press_cursor_home_end(Gdk.Key.End, modifiers))
return true;
break;
case Gdk.Key.Insert:
--
2.14.3
From b184861396279d903e62bf6aad271a2205a79832 Mon Sep 17 00:00:00 2001
From: fujiwarat <takao.fujiwara1@gmail.com>
Date: Fri, 30 Mar 2018 12:33:59 +0900
Subject: [PATCH] ui/gtk3: Sort Unicode candidates
BUG=rhbz#1554714
R=Shawn.P.Huang@gmail.com
Review URL: https://codereview.appspot.com/339430043
---
ui/gtk3/emojier.vala | 26 +++++++++++++++++++++++---
1 file changed, 23 insertions(+), 3 deletions(-)
diff --git a/ui/gtk3/emojier.vala b/ui/gtk3/emojier.vala
index 24029703..0c0865f1 100644
--- a/ui/gtk3/emojier.vala
+++ b/ui/gtk3/emojier.vala
@@ -1144,9 +1144,11 @@ public class IBusEmojier : Gtk.ApplicationWindow {
lookup_emojis_from_annotation(string annotation) {
GLib.SList<string>? total_emojis = null;
unowned GLib.SList<string>? sub_emojis = null;
+ unowned GLib.SList<unichar>? sub_exact_unicodes = null;
unowned GLib.SList<unichar>? sub_unicodes = null;
int length = annotation.length;
if (m_has_partial_match && length >= m_partial_match_length) {
+ GLib.SList<string>? sorted_emojis = null;
foreach (unowned string key in
m_annotation_to_emojis_dict.get_keys()) {
if (key.length < length)
@@ -1173,16 +1175,29 @@ public class IBusEmojier : Gtk.ApplicationWindow {
sub_emojis = m_annotation_to_emojis_dict.lookup(key);
foreach (unowned string emoji in sub_emojis) {
if (total_emojis.find_custom(emoji, GLib.strcmp) == null) {
- total_emojis.append(emoji);
+ sorted_emojis.insert_sorted(emoji, GLib.strcmp);
}
}
}
+ foreach (string emoji in sorted_emojis) {
+ if (total_emojis.find_custom(emoji, GLib.strcmp) == null) {
+ total_emojis.append(emoji);
+ }
+ }
} else {
sub_emojis = m_annotation_to_emojis_dict.lookup(annotation);
foreach (unowned string emoji in sub_emojis)
total_emojis.append(emoji);
}
+ sub_exact_unicodes = m_name_to_unicodes_dict.lookup(annotation);
+ foreach (unichar code in sub_exact_unicodes) {
+ string ch = code.to_string();
+ if (total_emojis.find_custom(ch, GLib.strcmp) == null) {
+ total_emojis.append(ch);
+ }
+ }
if (length >= m_partial_match_length) {
+ GLib.SList<string>? sorted_unicodes = null;
foreach (unowned string key in m_name_to_unicodes_dict.get_keys()) {
bool matched = false;
if (key.index_of(annotation) >= 0)
@@ -1192,11 +1207,16 @@ public class IBusEmojier : Gtk.ApplicationWindow {
sub_unicodes = m_name_to_unicodes_dict.lookup(key);
foreach (unichar code in sub_unicodes) {
string ch = code.to_string();
- if (total_emojis.find_custom(ch, GLib.strcmp) == null) {
- total_emojis.append(ch);
+ if (sorted_unicodes.find_custom(ch, GLib.strcmp) == null) {
+ sorted_unicodes.insert_sorted(ch, GLib.strcmp);
}
}
}
+ foreach (string ch in sorted_unicodes) {
+ if (total_emojis.find_custom(ch, GLib.strcmp) == null) {
+ total_emojis.append(ch);
+ }
+ }
}
return total_emojis;
}
--
2.14.3