|
|
e1b0f3 |
From 8375f391e1b9bfc048ff14fd458f689d853064ac Mon Sep 17 00:00:00 2001
|
|
|
e1b0f3 |
From: fujiwarat <takao.fujiwara1@gmail.com>
|
|
|
e1b0f3 |
Date: Thu, 28 Feb 2019 15:26:11 +0900
|
|
|
e1b0f3 |
Subject: [PATCH] ui/gtk3: Do not add emojis in compose category to emoji
|
|
|
e1b0f3 |
variants
|
|
|
e1b0f3 |
|
|
|
e1b0f3 |
Any emojis in compose category have variants and should be shown by default.
|
|
|
e1b0f3 |
---
|
|
|
e1b0f3 |
bindings/vala/IBus-1.0-custom.vala | 4 ++
|
|
|
e1b0f3 |
ui/gtk3/emojier.vala | 74 ++++++++++++++++++++++++++----
|
|
|
e1b0f3 |
2 files changed, 68 insertions(+), 10 deletions(-)
|
|
|
e1b0f3 |
|
|
|
e1b0f3 |
diff --git a/bindings/vala/IBus-1.0-custom.vala b/bindings/vala/IBus-1.0-custom.vala
|
|
|
e1b0f3 |
index 7d34a8bd..ec46fc90 100644
|
|
|
e1b0f3 |
--- a/bindings/vala/IBus-1.0-custom.vala
|
|
|
e1b0f3 |
+++ b/bindings/vala/IBus-1.0-custom.vala
|
|
|
e1b0f3 |
@@ -17,4 +17,8 @@ namespace IBus {
|
|
|
e1b0f3 |
public class PanelService : IBus.Service {
|
|
|
e1b0f3 |
public void panel_extension_register_keys(string first_property_name, ...);
|
|
|
e1b0f3 |
}
|
|
|
e1b0f3 |
+ public class EmojiData : IBus.Serializable {
|
|
|
e1b0f3 |
+ [CCode (cname = "ibus_emoji_data_new", has_construct_function = true)]
|
|
|
e1b0f3 |
+ public EmojiData (string first_property_name, ...);
|
|
|
e1b0f3 |
+ }
|
|
|
e1b0f3 |
}
|
|
|
e1b0f3 |
diff --git a/ui/gtk3/emojier.vala b/ui/gtk3/emojier.vala
|
|
|
e1b0f3 |
index aedeb4cb..fc15cffe 100644
|
|
|
e1b0f3 |
--- a/ui/gtk3/emojier.vala
|
|
|
e1b0f3 |
+++ b/ui/gtk3/emojier.vala
|
|
|
e1b0f3 |
@@ -389,6 +389,14 @@ public class IBusEmojier : Gtk.ApplicationWindow {
|
|
|
e1b0f3 |
}
|
|
|
e1b0f3 |
make_emoji_dict(m_current_lang_id);
|
|
|
e1b0f3 |
}
|
|
|
e1b0f3 |
+ add_variants_to_component();
|
|
|
e1b0f3 |
+
|
|
|
e1b0f3 |
+ GLib.List<unowned string> annotations =
|
|
|
e1b0f3 |
+ m_annotation_to_emojis_dict.get_keys();
|
|
|
e1b0f3 |
+ foreach (unowned string annotation in annotations) {
|
|
|
e1b0f3 |
+ if (m_emoji_max_seq_len < annotation.length)
|
|
|
e1b0f3 |
+ m_emoji_max_seq_len = annotation.length;
|
|
|
e1b0f3 |
+ }
|
|
|
e1b0f3 |
update_favorite_emoji_dict();
|
|
|
e1b0f3 |
}
|
|
|
e1b0f3 |
|
|
|
e1b0f3 |
@@ -430,11 +438,54 @@ public class IBusEmojier : Gtk.ApplicationWindow {
|
|
|
e1b0f3 |
update_annotation_to_emojis_dict(data);
|
|
|
e1b0f3 |
update_category_to_emojis_dict(data, lang);
|
|
|
e1b0f3 |
}
|
|
|
e1b0f3 |
- GLib.List<unowned string> annotations =
|
|
|
e1b0f3 |
- m_annotation_to_emojis_dict.get_keys();
|
|
|
e1b0f3 |
- foreach (unowned string annotation in annotations) {
|
|
|
e1b0f3 |
- if (m_emoji_max_seq_len < annotation.length)
|
|
|
e1b0f3 |
- m_emoji_max_seq_len = annotation.length;
|
|
|
e1b0f3 |
+ }
|
|
|
e1b0f3 |
+
|
|
|
e1b0f3 |
+
|
|
|
e1b0f3 |
+ private static void add_variants_to_component() {
|
|
|
e1b0f3 |
+ string category = "Component";
|
|
|
e1b0f3 |
+ unowned GLib.SList<string> hits =
|
|
|
e1b0f3 |
+ m_category_to_emojis_dict.lookup(category);
|
|
|
e1b0f3 |
+ if (hits == null) {
|
|
|
e1b0f3 |
+ category = "component";
|
|
|
e1b0f3 |
+ hits = m_category_to_emojis_dict.lookup(category);
|
|
|
e1b0f3 |
+ }
|
|
|
e1b0f3 |
+ if (hits == null)
|
|
|
e1b0f3 |
+ return;
|
|
|
e1b0f3 |
+ GLib.SList<IBus.EmojiData> emoji_list =
|
|
|
e1b0f3 |
+ new GLib.SList<IBus.EmojiData>();
|
|
|
e1b0f3 |
+ GLib.SList<string> annotations = new GLib.SList<string>();
|
|
|
e1b0f3 |
+ annotations.append("zero");
|
|
|
e1b0f3 |
+ IBus.EmojiData _data;
|
|
|
e1b0f3 |
+ _data = new IBus.EmojiData("emoji", "\u200d",
|
|
|
e1b0f3 |
+ "annotations", annotations,
|
|
|
e1b0f3 |
+ "description",
|
|
|
e1b0f3 |
+ "ZERO WIDTH JOINER",
|
|
|
e1b0f3 |
+ "category", category);
|
|
|
e1b0f3 |
+ emoji_list.append(_data);
|
|
|
e1b0f3 |
+ annotations = null;
|
|
|
e1b0f3 |
+ annotations.append("text");
|
|
|
e1b0f3 |
+ annotations.append("variation");
|
|
|
e1b0f3 |
+ annotations.append("selector");
|
|
|
e1b0f3 |
+ _data = new IBus.EmojiData("emoji", "\ufe0e",
|
|
|
e1b0f3 |
+ "annotations", annotations,
|
|
|
e1b0f3 |
+ "description",
|
|
|
e1b0f3 |
+ "VARIATION SELECTOR-15",
|
|
|
e1b0f3 |
+ "category", category);
|
|
|
e1b0f3 |
+ emoji_list.append(_data);
|
|
|
e1b0f3 |
+ annotations = null;
|
|
|
e1b0f3 |
+ annotations.append("emoji");
|
|
|
e1b0f3 |
+ annotations.append("variation");
|
|
|
e1b0f3 |
+ annotations.append("selector");
|
|
|
e1b0f3 |
+ _data = new IBus.EmojiData("emoji", "\ufe0f",
|
|
|
e1b0f3 |
+ "annotations", annotations,
|
|
|
e1b0f3 |
+ "description",
|
|
|
e1b0f3 |
+ "VARIATION SELECTOR-16",
|
|
|
e1b0f3 |
+ "category", category);
|
|
|
e1b0f3 |
+ emoji_list.append(_data);
|
|
|
e1b0f3 |
+ foreach (IBus.EmojiData data in emoji_list) {
|
|
|
e1b0f3 |
+ update_emoji_to_data_dict(data, "en");
|
|
|
e1b0f3 |
+ update_annotation_to_emojis_dict(data);
|
|
|
e1b0f3 |
+ update_category_to_emojis_dict(data, "en");
|
|
|
e1b0f3 |
}
|
|
|
e1b0f3 |
}
|
|
|
e1b0f3 |
|
|
|
e1b0f3 |
@@ -583,10 +634,12 @@ public class IBusEmojier : Gtk.ApplicationWindow {
|
|
|
e1b0f3 |
category = EMOJI_CATEGORY_OTHERS;
|
|
|
e1b0f3 |
if (lang == "en") {
|
|
|
e1b0f3 |
bool has_variant = false;
|
|
|
e1b0f3 |
- foreach (unichar ch in EMOJI_VARIANT_LIST) {
|
|
|
e1b0f3 |
- if (emoji.index_of_char(ch) >= 0) {
|
|
|
e1b0f3 |
- has_variant = true;
|
|
|
e1b0f3 |
- break;
|
|
|
e1b0f3 |
+ if (category.ascii_casecmp("component") != 0) {
|
|
|
e1b0f3 |
+ foreach (unichar ch in EMOJI_VARIANT_LIST) {
|
|
|
e1b0f3 |
+ if (emoji.index_of_char(ch) >= 0) {
|
|
|
e1b0f3 |
+ has_variant = true;
|
|
|
e1b0f3 |
+ break;
|
|
|
e1b0f3 |
+ }
|
|
|
e1b0f3 |
}
|
|
|
e1b0f3 |
}
|
|
|
e1b0f3 |
// If emoji includes variants (skin colors and items),
|
|
|
e1b0f3 |
@@ -606,7 +659,8 @@ public class IBusEmojier : Gtk.ApplicationWindow {
|
|
|
e1b0f3 |
if (variants.find_custom(emoji, GLib.strcmp) == null) {
|
|
|
e1b0f3 |
if (variants == null)
|
|
|
e1b0f3 |
variants.append(base_emoji);
|
|
|
e1b0f3 |
- variants.append(emoji);
|
|
|
e1b0f3 |
+ if (base_emoji != emoji)
|
|
|
e1b0f3 |
+ variants.append(emoji);
|
|
|
e1b0f3 |
m_emoji_to_emoji_variants_dict.replace(
|
|
|
e1b0f3 |
base_emoji,
|
|
|
e1b0f3 |
variants.copy_deep(GLib.strdup));
|
|
|
e1b0f3 |
--
|
|
|
e1b0f3 |
2.21.0
|
|
|
e1b0f3 |
|