Added ibus-HEAD.patch to get upstream patches
Fixed ibus_emojier_run() SIGABRT with `ibus emoji` Enhanced theme color on emoji candidates
This commit is contained in:
parent
85f1bc922b
commit
4f9f822080
674
ibus-HEAD.patch
674
ibus-HEAD.patch
@ -1 +1,675 @@
|
||||
From 7e477d5e0ffe19b6c52558c5b37fdd9cb82c097a Mon Sep 17 00:00:00 2001
|
||||
From: fujiwarat <takao.fujiwara1@gmail.com>
|
||||
Date: Thu, 9 Mar 2017 11:31:21 +0900
|
||||
Subject: [PATCH] tools: Fix `ibus emoji` SEGV when language is changed.
|
||||
|
||||
BUG=rhbz#1430290
|
||||
|
||||
Review URL: https://codereview.appspot.com/317410043
|
||||
---
|
||||
tools/main.vala | 3 +++
|
||||
1 file changed, 3 insertions(+)
|
||||
|
||||
diff --git a/tools/main.vala b/tools/main.vala
|
||||
index 73c6f57..fd9fd0e 100644
|
||||
--- a/tools/main.vala
|
||||
+++ b/tools/main.vala
|
||||
@@ -353,6 +353,9 @@ int emoji_dialog(string[] argv) {
|
||||
} else {
|
||||
GLib.MainLoop loop = new GLib.MainLoop();
|
||||
emojier.loaded_emoji_dict.connect(() => {
|
||||
+ // The signal is called when the language is changed.
|
||||
+ if (emojier.is_running())
|
||||
+ return;
|
||||
run_dialog(emojier);
|
||||
loop.quit();
|
||||
});
|
||||
--
|
||||
2.7.4
|
||||
|
||||
From 9dbea347050ae2ad79d1b53f2ad62a7a2cafadc6 Mon Sep 17 00:00:00 2001
|
||||
From: fujiwarat <takao.fujiwara1@gmail.com>
|
||||
Date: Thu, 9 Mar 2017 12:45:20 +0900
|
||||
Subject: [PATCH] ui/gtk3: Get emoji colors from the theme
|
||||
|
||||
Get selected and normal text color from the theme.
|
||||
Implement to activate an emoji with mouse motion.
|
||||
Create back button on emoji language chooser dialog.
|
||||
Set row_homogeneous on emoji table.
|
||||
|
||||
R=Shawn.P.Huang@gmail.com
|
||||
|
||||
Review URL: https://codereview.appspot.com/319470043
|
||||
---
|
||||
ui/gtk3/Makefile.am | 3 +
|
||||
ui/gtk3/candidatearea.vala | 186 +++++++++++++++++++++++++------------------
|
||||
ui/gtk3/emojier.vala | 192 ++++++++++++++++++++++++++++++++-------------
|
||||
3 files changed, 251 insertions(+), 130 deletions(-)
|
||||
|
||||
diff --git a/ui/gtk3/Makefile.am b/ui/gtk3/Makefile.am
|
||||
index d5ddc42..4e7fd1b 100644
|
||||
--- a/ui/gtk3/Makefile.am
|
||||
+++ b/ui/gtk3/Makefile.am
|
||||
@@ -172,8 +172,11 @@ libibus_emoji_dialog_1_0_la_LDFLAGS = \
|
||||
-version-info @LT_VERSION_INFO@ \
|
||||
$(NULL)
|
||||
libibus_emoji_dialog_1_0_la_SOURCES = \
|
||||
+ candidatearea.c \
|
||||
emojier.c \
|
||||
iconwidget.c \
|
||||
+ pango.c \
|
||||
+ separator.c \
|
||||
$(NULL)
|
||||
|
||||
-include $(INTROSPECTION_MAKEFILE)
|
||||
diff --git a/ui/gtk3/candidatearea.vala b/ui/gtk3/candidatearea.vala
|
||||
index a095e76..e162a96 100644
|
||||
--- a/ui/gtk3/candidatearea.vala
|
||||
+++ b/ui/gtk3/candidatearea.vala
|
||||
@@ -21,6 +21,108 @@
|
||||
* USA
|
||||
*/
|
||||
|
||||
+class ThemedRGBA {
|
||||
+ public Gdk.RGBA *normal_fg { get; set; }
|
||||
+ public Gdk.RGBA *normal_bg { get; set; }
|
||||
+ public Gdk.RGBA *selected_fg { get; set; }
|
||||
+ public Gdk.RGBA *selected_bg { get; set; }
|
||||
+
|
||||
+ private Gtk.StyleContext m_style_context;
|
||||
+
|
||||
+ public ThemedRGBA(Gtk.Widget widget) {
|
||||
+ this.normal_fg = null;
|
||||
+ this.normal_bg = null;
|
||||
+ this.selected_fg = null;
|
||||
+ this.selected_bg = null;
|
||||
+
|
||||
+ /* Use the color of Gtk.TextView instead of Gtk.Label
|
||||
+ * because the selected label "color" is not configured
|
||||
+ * in "Adwaita" theme and the selected label "background-color"
|
||||
+ * is not configured in "Maia" theme.
|
||||
+ * https://github.com/ibus/ibus/issues/1871
|
||||
+ */
|
||||
+ Gtk.WidgetPath widget_path = new Gtk.WidgetPath();
|
||||
+ widget_path.append_type(typeof(Gtk.TextView));
|
||||
+ m_style_context = new Gtk.StyleContext();
|
||||
+ m_style_context.set_path(widget_path);
|
||||
+ m_style_context.add_class(Gtk.STYLE_CLASS_VIEW);
|
||||
+
|
||||
+ /* "-gtk-secondary-caret-color" value is different
|
||||
+ * if the parent widget is set in "Menta" theme.
|
||||
+ */
|
||||
+ m_style_context.set_parent(widget.get_style_context());
|
||||
+
|
||||
+ get_rgba();
|
||||
+
|
||||
+ m_style_context.changed.connect(() => { get_rgba(); });
|
||||
+ }
|
||||
+
|
||||
+ ~ThemedRGBA() {
|
||||
+ reset_rgba();
|
||||
+ }
|
||||
+
|
||||
+ private void reset_rgba() {
|
||||
+ if (this.normal_fg != null) {
|
||||
+ this.normal_fg.free();
|
||||
+ this.normal_fg = null;
|
||||
+ }
|
||||
+ if (this.normal_bg != null) {
|
||||
+ this.normal_bg.free();
|
||||
+ this.normal_bg = null;
|
||||
+ }
|
||||
+ if (this.selected_fg != null) {
|
||||
+ this.selected_fg.free();
|
||||
+ this.selected_fg = null;
|
||||
+ }
|
||||
+ if (this.selected_bg != null) {
|
||||
+ this.selected_bg.free();
|
||||
+ this.selected_bg = null;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private void get_rgba() {
|
||||
+ reset_rgba();
|
||||
+ Gdk.RGBA *normal_fg = null;
|
||||
+ Gdk.RGBA *normal_bg = null;
|
||||
+ Gdk.RGBA *selected_fg = null;
|
||||
+ Gdk.RGBA *selected_bg = null;
|
||||
+ m_style_context.get(Gtk.StateFlags.NORMAL,
|
||||
+ "color",
|
||||
+ out normal_fg);
|
||||
+ m_style_context.get(Gtk.StateFlags.SELECTED,
|
||||
+ "color",
|
||||
+ out selected_fg);
|
||||
+
|
||||
+ string bg_prop = "background-color";
|
||||
+ m_style_context.get(Gtk.StateFlags.NORMAL,
|
||||
+ bg_prop,
|
||||
+ out normal_bg);
|
||||
+ m_style_context.get(Gtk.StateFlags.SELECTED,
|
||||
+ bg_prop,
|
||||
+ out selected_bg);
|
||||
+ if (normal_bg.red == selected_bg.red &&
|
||||
+ normal_bg.green == selected_bg.green &&
|
||||
+ normal_bg.blue == selected_bg.blue &&
|
||||
+ normal_bg.alpha == selected_bg.alpha) {
|
||||
+ normal_bg.free();
|
||||
+ normal_bg = null;
|
||||
+ normal_bg.free();
|
||||
+ normal_bg = null;
|
||||
+ bg_prop = "-gtk-secondary-caret-color";
|
||||
+ m_style_context.get(Gtk.StateFlags.NORMAL,
|
||||
+ bg_prop,
|
||||
+ out normal_bg);
|
||||
+ m_style_context.get(Gtk.StateFlags.SELECTED,
|
||||
+ bg_prop,
|
||||
+ out selected_bg);
|
||||
+ }
|
||||
+ this.normal_fg = normal_fg;
|
||||
+ this.normal_bg = normal_bg;
|
||||
+ this.selected_fg = selected_fg;
|
||||
+ this.selected_bg = selected_bg;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
class CandidateArea : Gtk.Box {
|
||||
private bool m_vertical;
|
||||
private Gtk.Label[] m_labels;
|
||||
@@ -30,9 +132,7 @@ class CandidateArea : Gtk.Box {
|
||||
private IBus.Text[] m_ibus_candidates;
|
||||
private uint m_focus_candidate;
|
||||
private bool m_show_cursor;
|
||||
- Gtk.StyleContext m_style_context;
|
||||
- private Gdk.RGBA *m_selected_fg_color = null;
|
||||
- private Gdk.RGBA *m_selected_bg_color = null;
|
||||
+ private ThemedRGBA m_rgba;
|
||||
|
||||
private const string LABELS[] = {
|
||||
"1.", "2.", "3.", "4.", "5.", "6.", "7.", "8.",
|
||||
@@ -58,38 +158,7 @@ class CandidateArea : Gtk.Box {
|
||||
public CandidateArea(bool vertical) {
|
||||
GLib.Object();
|
||||
set_vertical(vertical, true);
|
||||
-
|
||||
- /* Use the color of Gtk.TextView instead of Gtk.Label
|
||||
- * because the selected label "color" is not configured
|
||||
- * in "Adwaita" theme and the selected label "background-color"
|
||||
- * is not configured in "Maia" theme.
|
||||
- * https://github.com/ibus/ibus/issues/1871
|
||||
- */
|
||||
- Gtk.WidgetPath widget_path = new Gtk.WidgetPath();
|
||||
- widget_path.append_type(typeof(Gtk.TextView));
|
||||
- m_style_context = new Gtk.StyleContext();
|
||||
- m_style_context.set_path(widget_path);
|
||||
- m_style_context.add_class(Gtk.STYLE_CLASS_VIEW);
|
||||
-
|
||||
- /* "-gtk-secondary-caret-color" value is different
|
||||
- * if the parent widget is set in "Menta" theme.
|
||||
- */
|
||||
- m_style_context.set_parent(get_style_context());
|
||||
-
|
||||
- get_selected_color();
|
||||
-
|
||||
- m_style_context.changed.connect(() => { get_selected_color(); });
|
||||
- }
|
||||
-
|
||||
- ~CandidateArea() {
|
||||
- if (m_selected_bg_color != null) {
|
||||
- m_selected_bg_color.free();
|
||||
- m_selected_bg_color = null;
|
||||
- }
|
||||
- if (m_selected_bg_color != null) {
|
||||
- m_selected_bg_color.free();
|
||||
- m_selected_bg_color = null;
|
||||
- }
|
||||
+ m_rgba = new ThemedRGBA(this);
|
||||
}
|
||||
|
||||
public bool candidate_scrolled(Gdk.EventScroll event) {
|
||||
@@ -150,17 +219,17 @@ class CandidateArea : Gtk.Box {
|
||||
Pango.AttrList attrs = get_pango_attr_list_from_ibus_text(candidates[i]);
|
||||
if (i == focus_candidate && show_cursor) {
|
||||
Pango.Attribute pango_attr = Pango.attr_foreground_new(
|
||||
- (uint16)(m_selected_fg_color.red * uint16.MAX),
|
||||
- (uint16)(m_selected_fg_color.green * uint16.MAX),
|
||||
- (uint16)(m_selected_fg_color.blue * uint16.MAX));
|
||||
+ (uint16)(m_rgba.selected_fg.red * uint16.MAX),
|
||||
+ (uint16)(m_rgba.selected_fg.green * uint16.MAX),
|
||||
+ (uint16)(m_rgba.selected_fg.blue * uint16.MAX));
|
||||
pango_attr.start_index = 0;
|
||||
pango_attr.end_index = candidates[i].get_text().length;
|
||||
attrs.insert((owned)pango_attr);
|
||||
|
||||
pango_attr = Pango.attr_background_new(
|
||||
- (uint16)(m_selected_bg_color.red * uint16.MAX),
|
||||
- (uint16)(m_selected_bg_color.green * uint16.MAX),
|
||||
- (uint16)(m_selected_bg_color.blue * uint16.MAX));
|
||||
+ (uint16)(m_rgba.selected_bg.red * uint16.MAX),
|
||||
+ (uint16)(m_rgba.selected_bg.green * uint16.MAX),
|
||||
+ (uint16)(m_rgba.selected_bg.blue * uint16.MAX));
|
||||
pango_attr.start_index = 0;
|
||||
pango_attr.end_index = candidates[i].get_text().length;
|
||||
attrs.insert((owned)pango_attr);
|
||||
@@ -181,41 +250,6 @@ class CandidateArea : Gtk.Box {
|
||||
}
|
||||
}
|
||||
|
||||
- private void get_selected_color() {
|
||||
- if (m_selected_fg_color != null) {
|
||||
- m_selected_fg_color.free();
|
||||
- m_selected_fg_color = null;
|
||||
- }
|
||||
- m_style_context.get(Gtk.StateFlags.SELECTED,
|
||||
- "color",
|
||||
- out m_selected_fg_color);
|
||||
-
|
||||
- string bg_prop = "background-color";
|
||||
- Gdk.RGBA *normal_color = null;
|
||||
- if (m_selected_bg_color != null) {
|
||||
- m_selected_bg_color.free();
|
||||
- m_selected_bg_color = null;
|
||||
- }
|
||||
- m_style_context.get(Gtk.StateFlags.NORMAL,
|
||||
- bg_prop,
|
||||
- out normal_color);
|
||||
- m_style_context.get(Gtk.StateFlags.SELECTED,
|
||||
- bg_prop,
|
||||
- out m_selected_bg_color);
|
||||
- if (normal_color.red == m_selected_bg_color.red &&
|
||||
- normal_color.green == m_selected_bg_color.green &&
|
||||
- normal_color.blue == m_selected_bg_color.blue &&
|
||||
- normal_color.alpha == m_selected_bg_color.alpha) {
|
||||
- m_selected_bg_color.free();
|
||||
- m_selected_bg_color = null;
|
||||
- bg_prop = "-gtk-secondary-caret-color";
|
||||
- m_style_context.get(Gtk.StateFlags.SELECTED,
|
||||
- bg_prop,
|
||||
- out m_selected_bg_color);
|
||||
- }
|
||||
- normal_color.free();
|
||||
- }
|
||||
-
|
||||
private void recreate_ui() {
|
||||
foreach (Gtk.Widget w in get_children()) {
|
||||
w.destroy();
|
||||
diff --git a/ui/gtk3/emojier.vala b/ui/gtk3/emojier.vala
|
||||
index 5496c4e..bc1eff4 100644
|
||||
--- a/ui/gtk3/emojier.vala
|
||||
+++ b/ui/gtk3/emojier.vala
|
||||
@@ -72,12 +72,31 @@ class IBusEmojier : Gtk.Window {
|
||||
private class EGrid : Gtk.Grid {
|
||||
public EGrid() {
|
||||
GLib.Object(
|
||||
+ row_homogeneous : false,
|
||||
vexpand : true,
|
||||
halign : Gtk.Align.FILL,
|
||||
valign : Gtk.Align.FILL
|
||||
);
|
||||
}
|
||||
}
|
||||
+ private class EWhiteLabel : Gtk.Label {
|
||||
+ public EWhiteLabel(string text) {
|
||||
+ GLib.Object(
|
||||
+ name : "IBusEmojierWhiteLabel"
|
||||
+ );
|
||||
+ if (text != "")
|
||||
+ set_label(text);
|
||||
+ }
|
||||
+ }
|
||||
+ private class ESelectedLabel : Gtk.Label {
|
||||
+ public ESelectedLabel(string text) {
|
||||
+ GLib.Object(
|
||||
+ name : "IBusEmojierSelectedLabel"
|
||||
+ );
|
||||
+ if (text != "")
|
||||
+ set_label(text);
|
||||
+ }
|
||||
+ }
|
||||
private class EPaddedLabel : Gtk.Box {
|
||||
public EPaddedLabel(string text,
|
||||
Gtk.Align align,
|
||||
@@ -161,6 +180,7 @@ class IBusEmojier : Gtk.Window {
|
||||
}
|
||||
|
||||
private const uint EMOJI_GRID_PAGE = 10;
|
||||
+ private ThemedRGBA m_rgba;
|
||||
private Gtk.Box m_vbox;
|
||||
private ETitleLabel m_title;
|
||||
private EEntry m_entry;
|
||||
@@ -174,7 +194,8 @@ class IBusEmojier : Gtk.Window {
|
||||
private GLib.MainLoop? m_loop;
|
||||
private string? m_result;
|
||||
private GLib.SList<string> m_lang_list;
|
||||
- private string m_current_lang = "en";
|
||||
+ private string m_current_lang_id = "en";
|
||||
+ private string m_current_language = "English";
|
||||
private string? m_unicode_point = null;
|
||||
private bool m_candidate_panel_is_visible;
|
||||
private GLib.HashTable<string, GLib.SList>?
|
||||
@@ -189,11 +210,8 @@ class IBusEmojier : Gtk.Window {
|
||||
private Gtk.Label[] m_candidates;
|
||||
private string m_emoji_font = "Monospace 16";
|
||||
private string[] m_favorites = {};
|
||||
- // TODO: Get the selected color from CandidateArea
|
||||
- private Gdk.RGBA m_selected_fg_color = Gdk.RGBA(){
|
||||
- red = 1.0, green = 1.0, blue = 1.0, alpha = 1.0 };
|
||||
- private Gdk.RGBA m_selected_bg_color = Gdk.RGBA(){
|
||||
- red = 0.300, green = 0.565, blue = 0.851, alpha = 1.0 };
|
||||
+ private bool m_enter_notify_enable = true;
|
||||
+ private uint m_entry_notify_show_id;
|
||||
|
||||
public signal void candidate_clicked(uint index, uint button, uint state);
|
||||
public signal void loaded_emoji_dict();
|
||||
@@ -220,7 +238,33 @@ class IBusEmojier : Gtk.Window {
|
||||
warning("Could not open display.");
|
||||
return;
|
||||
}
|
||||
- string data = "grid { background-color: #ffffff; }";
|
||||
+ m_rgba = new ThemedRGBA(this);
|
||||
+ uint bg_red = (uint)(m_rgba.normal_bg.red * 255);
|
||||
+ uint bg_green = (uint)(m_rgba.normal_bg.green * 255);
|
||||
+ uint bg_blue = (uint)(m_rgba.normal_bg.blue * 255);
|
||||
+ double bg_alpha = m_rgba.normal_bg.alpha;
|
||||
+ string data =
|
||||
+ "#IBusEmojierWhiteLabel { background-color: " +
|
||||
+ "rgba(%u, %u, %u, %lf); ".printf(
|
||||
+ bg_red, bg_green, bg_blue, bg_alpha) +
|
||||
+ "border-width: 4px; border-radius: 3px; } ";
|
||||
+
|
||||
+ uint fg_red = (uint)(m_rgba.selected_fg.red * 255);
|
||||
+ uint fg_green = (uint)(m_rgba.selected_fg.green * 255);
|
||||
+ uint fg_blue = (uint)(m_rgba.selected_fg.blue * 255);
|
||||
+ double fg_alpha = m_rgba.selected_fg.alpha;
|
||||
+ bg_red = (uint)(m_rgba.selected_bg.red * 255);
|
||||
+ bg_green = (uint)(m_rgba.selected_bg.green * 255);
|
||||
+ bg_blue = (uint)(m_rgba.selected_bg.blue * 255);
|
||||
+ bg_alpha = m_rgba.selected_bg.alpha;
|
||||
+ data += "#IBusEmojierSelectedLabel { color: " +
|
||||
+ "rgba(%u, %u, %u, %lf); ".printf(
|
||||
+ fg_red, fg_green, fg_blue, fg_alpha) +
|
||||
+ "background-color: " +
|
||||
+ "rgba(%u, %u, %u, %lf); ".printf(
|
||||
+ bg_red, bg_green, bg_blue, bg_alpha) +
|
||||
+ "border-width: 4px; border-radius: 3px; }";
|
||||
+
|
||||
Gtk.CssProvider css_provider = new Gtk.CssProvider();
|
||||
try {
|
||||
css_provider.load_from_data(data, -1);
|
||||
@@ -317,6 +361,8 @@ class IBusEmojier : Gtk.Window {
|
||||
lang_list.sort((a, b) => {
|
||||
string a_lang = IBus.get_language_name(a);
|
||||
string b_lang = IBus.get_language_name(b);
|
||||
+ a_lang = "%s (%s)".printf(a_lang, a);
|
||||
+ b_lang = "%s (%s)".printf(b_lang, b);
|
||||
return GLib.strcmp(a_lang, b_lang);
|
||||
});
|
||||
return lang_list;
|
||||
@@ -325,8 +371,8 @@ class IBusEmojier : Gtk.Window {
|
||||
private void reload_emoji_dict() {
|
||||
init_emoji_dict();
|
||||
make_emoji_dict("en");
|
||||
- if (m_current_lang != "en")
|
||||
- make_emoji_dict(m_current_lang);
|
||||
+ if (m_current_lang_id != "en")
|
||||
+ make_emoji_dict(m_current_lang_id);
|
||||
loaded_emoji_dict();
|
||||
}
|
||||
|
||||
@@ -458,22 +504,50 @@ class IBusEmojier : Gtk.Window {
|
||||
}
|
||||
}
|
||||
|
||||
+ private void activated_language(EBoxRow row) {
|
||||
+ m_category_active_index = 0;
|
||||
+ if (m_current_lang_id != row.id) {
|
||||
+ m_current_lang_id = row.id;
|
||||
+ m_current_language = row.text;
|
||||
+ reload_emoji_dict();
|
||||
+ }
|
||||
+ m_current_category_type = CategoryType.EMOJI;
|
||||
+ show_category_list();
|
||||
+ }
|
||||
+
|
||||
private void show_category_list() {
|
||||
remove_all_children();
|
||||
m_scrolled_window = new EScrolledWindow();
|
||||
set_fixed_size();
|
||||
- string language = IBus.get_language_name(m_current_lang);
|
||||
- EPaddedLabel label = new EPaddedLabel(language, Gtk.Align.CENTER);
|
||||
+ EPaddedLabel label;
|
||||
+ if (m_current_category_type == CategoryType.EMOJI) {
|
||||
+ label = new EPaddedLabel(m_current_language, Gtk.Align.CENTER);
|
||||
+ } else if (m_current_category_type == CategoryType.LANG) {
|
||||
+ label = new EPaddedLabel(m_current_language,
|
||||
+ Gtk.Align.CENTER,
|
||||
+ TravelDirection.BACKWARD);
|
||||
+ } else {
|
||||
+ label = new EPaddedLabel("", Gtk.Align.CENTER);
|
||||
+ }
|
||||
Gtk.Button button = new Gtk.Button();
|
||||
button.add(label);
|
||||
m_vbox.add(button);
|
||||
button.show_all();
|
||||
- button.button_press_event.connect((e) => {
|
||||
- m_category_active_index = 0;
|
||||
- m_current_category_type = CategoryType.LANG;
|
||||
- show_category_list();
|
||||
- return true;
|
||||
- });
|
||||
+ if (m_current_category_type == CategoryType.EMOJI) {
|
||||
+ button.button_press_event.connect((e) => {
|
||||
+ m_category_active_index = 0;
|
||||
+ m_current_category_type = CategoryType.LANG;
|
||||
+ show_category_list();
|
||||
+ return true;
|
||||
+ });
|
||||
+ } else if (m_current_category_type == CategoryType.LANG) {
|
||||
+ button.button_press_event.connect((e) => {
|
||||
+ m_category_active_index = 0;
|
||||
+ m_current_category_type = CategoryType.EMOJI;
|
||||
+ show_category_list();
|
||||
+ return true;
|
||||
+ });
|
||||
+ }
|
||||
|
||||
m_vbox.add(m_scrolled_window);
|
||||
Gtk.Viewport viewport = new Gtk.Viewport(null, null);
|
||||
@@ -523,21 +597,19 @@ class IBusEmojier : Gtk.Window {
|
||||
}
|
||||
} else if (m_current_category_type == CategoryType.LANG) {
|
||||
m_list_box.row_activated.connect((box, gtkrow) => {
|
||||
- m_category_active_index = 0;
|
||||
- EBoxRow row = gtkrow as EBoxRow;
|
||||
- if (m_current_lang != row.id) {
|
||||
- m_current_lang = row.id;
|
||||
- reload_emoji_dict();
|
||||
- }
|
||||
- m_current_category_type = CategoryType.EMOJI;
|
||||
- show_category_list();
|
||||
+ activated_language(gtkrow as EBoxRow);
|
||||
});
|
||||
uint n = 1;
|
||||
+ string prev_language = null;
|
||||
foreach (unowned string id in m_lang_list) {
|
||||
- string selected_language = IBus.get_language_name(id);
|
||||
- EBoxRow row = new EBoxRow("", id);
|
||||
+ string language = IBus.get_language_name(id);
|
||||
+ if (prev_language == language)
|
||||
+ language = "%s (%s)".printf(language, id);
|
||||
+ else
|
||||
+ prev_language = language;
|
||||
+ EBoxRow row = new EBoxRow(language, id);
|
||||
EPaddedLabel widget =
|
||||
- new EPaddedLabel(selected_language, Gtk.Align.CENTER);
|
||||
+ new EPaddedLabel(language, Gtk.Align.CENTER);
|
||||
row.add(widget);
|
||||
m_list_box.add(row);
|
||||
if (n++ == m_category_active_index)
|
||||
@@ -573,27 +645,6 @@ class IBusEmojier : Gtk.Window {
|
||||
show_candidate_panel();
|
||||
}
|
||||
|
||||
- private void label_set_active_color(Gtk.Label label) {
|
||||
- unowned string text = label.get_text();
|
||||
- Pango.AttrList attrs = new Pango.AttrList();
|
||||
- Pango.Attribute pango_attr = Pango.attr_foreground_new(
|
||||
- (uint16)(m_selected_fg_color.red * uint16.MAX),
|
||||
- (uint16)(m_selected_fg_color.green * uint16.MAX),
|
||||
- (uint16)(m_selected_fg_color.blue * uint16.MAX));
|
||||
- pango_attr.start_index = 0;
|
||||
- pango_attr.end_index = text.char_count();
|
||||
- attrs.insert((owned)pango_attr);
|
||||
-
|
||||
- pango_attr = Pango.attr_background_new(
|
||||
- (uint16)(m_selected_bg_color.red * uint16.MAX),
|
||||
- (uint16)(m_selected_bg_color.green * uint16.MAX),
|
||||
- (uint16)(m_selected_bg_color.blue * uint16.MAX));
|
||||
- pango_attr.start_index = 0;
|
||||
- pango_attr.end_index = text.char_count();
|
||||
- attrs.insert((owned)pango_attr);
|
||||
- label.set_attributes(attrs);
|
||||
- }
|
||||
-
|
||||
private void show_arrow_buttons() {
|
||||
Gtk.Button next_button = new Gtk.Button();
|
||||
next_button.clicked.connect(() => {
|
||||
@@ -709,10 +760,17 @@ class IBusEmojier : Gtk.Window {
|
||||
});
|
||||
}
|
||||
EGrid grid = new EGrid();
|
||||
+ grid.set_row_spacing(5);
|
||||
+ grid.set_column_spacing(5);
|
||||
+ grid.set_border_width(2);
|
||||
int n = 0;
|
||||
for (uint i = page_start_pos; i < page_end_pos; i++) {
|
||||
IBus.Text candidate = m_lookup_table.get_candidate(i);
|
||||
- Gtk.Label label = new Gtk.Label(candidate.text);
|
||||
+ Gtk.Label label;
|
||||
+ if (i == cursor)
|
||||
+ label = new ESelectedLabel(candidate.text) as Gtk.Label;
|
||||
+ else
|
||||
+ label = new EWhiteLabel(candidate.text) as Gtk.Label;
|
||||
string emoji_font = m_emoji_font;
|
||||
if (candidate.text.char_count() > 2) {
|
||||
Pango.FontDescription font_desc =
|
||||
@@ -726,9 +784,6 @@ class IBusEmojier : Gtk.Window {
|
||||
label.set_markup(markup);
|
||||
label.set_halign(Gtk.Align.FILL);
|
||||
label.set_valign(Gtk.Align.FILL);
|
||||
- if (i == cursor) {
|
||||
- label_set_active_color(label);
|
||||
- }
|
||||
Gtk.EventBox candidate_ebox = new Gtk.EventBox();
|
||||
candidate_ebox.add(label);
|
||||
// Make a copy of i to workaround a bug in vala.
|
||||
@@ -738,6 +793,23 @@ class IBusEmojier : Gtk.Window {
|
||||
candidate_clicked(index, e.button, e.state);
|
||||
return true;
|
||||
});
|
||||
+ // m_enter_notify_enable is added because
|
||||
+ // enter_notify_event conflicts with keyboard operations.
|
||||
+ if (m_enter_notify_enable) {
|
||||
+ candidate_ebox.enter_notify_event.connect((e) => {
|
||||
+ m_lookup_table.set_cursor_pos(index);
|
||||
+ if (m_entry_notify_show_id > 0) {
|
||||
+ GLib.Source.remove(m_entry_notify_show_id);
|
||||
+ }
|
||||
+ // If timeout is not added, memory leak happens and
|
||||
+ // button_press_event signal does not work above.
|
||||
+ m_entry_notify_show_id = GLib.Timeout.add(100, () => {
|
||||
+ show_candidate_panel();
|
||||
+ return false;
|
||||
+ });
|
||||
+ return true;
|
||||
+ });
|
||||
+ }
|
||||
grid.attach(candidate_ebox,
|
||||
n % (int)EMOJI_GRID_PAGE, n / (int)EMOJI_GRID_PAGE,
|
||||
1, 1);
|
||||
@@ -797,6 +869,7 @@ class IBusEmojier : Gtk.Window {
|
||||
}
|
||||
|
||||
private void hide_candidate_panel() {
|
||||
+ m_enter_notify_enable = true;
|
||||
m_candidate_panel_is_visible = false;
|
||||
if (m_loop.is_running())
|
||||
show_category_list();
|
||||
@@ -841,6 +914,7 @@ class IBusEmojier : Gtk.Window {
|
||||
}
|
||||
|
||||
private void candidate_panel_cursor_down() {
|
||||
+ m_enter_notify_enable = false;
|
||||
uint ncandidates = m_lookup_table.get_number_of_candidates();
|
||||
uint cursor = m_lookup_table.get_cursor_pos();
|
||||
if ((cursor + EMOJI_GRID_PAGE) < ncandidates) {
|
||||
@@ -854,6 +928,7 @@ class IBusEmojier : Gtk.Window {
|
||||
}
|
||||
|
||||
private void candidate_panel_cursor_up() {
|
||||
+ m_enter_notify_enable = false;
|
||||
int ncandidates = (int)m_lookup_table.get_number_of_candidates();
|
||||
int cursor = (int)m_lookup_table.get_cursor_pos();
|
||||
int highest_pos =
|
||||
@@ -891,6 +966,7 @@ class IBusEmojier : Gtk.Window {
|
||||
m_input_context_path = input_context_path;
|
||||
m_candidate_panel_is_visible = false;
|
||||
m_result = null;
|
||||
+ m_enter_notify_enable = true;
|
||||
|
||||
/* Let gtk recalculate the window size. */
|
||||
resize(1, 1);
|
||||
@@ -1011,7 +1087,10 @@ class IBusEmojier : Gtk.Window {
|
||||
} else if (m_category_active_index > 0) {
|
||||
Gtk.ListBoxRow gtkrow = m_list_box.get_selected_row();
|
||||
EBoxRow row = gtkrow as EBoxRow;
|
||||
- show_emoji_for_category(row);
|
||||
+ if (m_current_category_type == CategoryType.EMOJI)
|
||||
+ show_emoji_for_category(row);
|
||||
+ else if (m_current_category_type == CategoryType.LANG)
|
||||
+ activated_language(row);
|
||||
}
|
||||
return true;
|
||||
case Gdk.Key.BackSpace:
|
||||
@@ -1026,6 +1105,7 @@ class IBusEmojier : Gtk.Window {
|
||||
break;
|
||||
}
|
||||
if (m_candidate_panel_is_visible) {
|
||||
+ m_enter_notify_enable = false;
|
||||
m_lookup_table.cursor_down();
|
||||
show_candidate_panel();
|
||||
}
|
||||
@@ -1035,6 +1115,7 @@ class IBusEmojier : Gtk.Window {
|
||||
return true;
|
||||
case Gdk.Key.Right:
|
||||
if (m_candidate_panel_is_visible) {
|
||||
+ m_enter_notify_enable = false;
|
||||
m_lookup_table.cursor_down();
|
||||
show_candidate_panel();
|
||||
return true;
|
||||
@@ -1042,6 +1123,7 @@ class IBusEmojier : Gtk.Window {
|
||||
break;
|
||||
case Gdk.Key.Left:
|
||||
if (m_candidate_panel_is_visible) {
|
||||
+ m_enter_notify_enable = false;
|
||||
m_lookup_table.cursor_up();
|
||||
show_candidate_panel();
|
||||
return true;
|
||||
@@ -1061,6 +1143,7 @@ class IBusEmojier : Gtk.Window {
|
||||
return true;
|
||||
case Gdk.Key.Page_Down:
|
||||
if (m_candidate_panel_is_visible) {
|
||||
+ m_enter_notify_enable = false;
|
||||
m_lookup_table.page_down();
|
||||
show_candidate_panel();
|
||||
return true;
|
||||
@@ -1068,6 +1151,7 @@ class IBusEmojier : Gtk.Window {
|
||||
break;
|
||||
case Gdk.Key.Page_Up:
|
||||
if (m_candidate_panel_is_visible) {
|
||||
+ m_enter_notify_enable = false;
|
||||
m_lookup_table.page_up();
|
||||
show_candidate_panel();
|
||||
return true;
|
||||
--
|
||||
2.7.4
|
||||
|
||||
|
18
ibus.spec
18
ibus.spec
@ -25,12 +25,10 @@
|
||||
%endif
|
||||
|
||||
%global dbus_python_version 0.83.0
|
||||
%global annotation_name cldr-emoji-annotation
|
||||
%global annotation_version 30.0.3_2
|
||||
|
||||
Name: ibus
|
||||
Version: 1.5.15
|
||||
Release: 1%{?dist}
|
||||
Release: 2%{?dist}
|
||||
Summary: Intelligent Input Bus for Linux OS
|
||||
License: LGPLv2+
|
||||
Group: System Environment/Libraries
|
||||
@ -39,9 +37,9 @@ Source0: https://github.com/ibus/%name/releases/download/%{version}/%{nam
|
||||
Source1: %{name}-xinput
|
||||
Source2: %{name}.conf.5
|
||||
# Will remove the annotation tarball once the rpm is available on Fedora
|
||||
Source3: https://github.com/fujiwarat/%annotation_name/releases/download/%{annotation_version}/%{annotation_name}-%{annotation_version}.tar.gz
|
||||
# Upstreamed patches.
|
||||
# Patch0: %%{name}-HEAD.patch
|
||||
Patch0: %{name}-HEAD.patch
|
||||
|
||||
BuildRequires: gettext-devel
|
||||
BuildRequires: libtool
|
||||
@ -74,6 +72,7 @@ BuildRequires: qt5-qtbase-devel
|
||||
BuildRequires: nodejs-emojione-json
|
||||
BuildRequires: json-glib-devel
|
||||
%endif
|
||||
BuildRequires: cldr-emoji-annotation
|
||||
|
||||
Requires: %{name}-libs%{?_isa} = %{version}-%{release}
|
||||
Requires: %{name}-gtk2%{?_isa} = %{version}-%{release}
|
||||
@ -232,11 +231,12 @@ The ibus-devel-docs package contains developer documentation for IBus
|
||||
%setup -q
|
||||
# %%patch0 -p1
|
||||
# cp client/gtk2/ibusimcontext.c client/gtk3/ibusimcontext.c ||
|
||||
zcat %SOURCE3 | tar xfvp -
|
||||
%patch0 -p1
|
||||
|
||||
%build
|
||||
#autoreconf -f -i -v
|
||||
#make -C ui/gtk3 maintainer-clean-generic
|
||||
#make -C tools maintainer-clean-generic
|
||||
%configure \
|
||||
--disable-static \
|
||||
--enable-gtk2 \
|
||||
@ -256,9 +256,10 @@ zcat %SOURCE3 | tar xfvp -
|
||||
%ifnarch %{nodejs_arches}
|
||||
--disable-emoji-dict \
|
||||
%endif
|
||||
--with-emoji-annotation-dir=$PWD/%annotation_name-%annotation_version/annotations \
|
||||
%{nil}
|
||||
|
||||
make -C ui/gtk3 maintainer-clean-generic
|
||||
make -C tools maintainer-clean-generic
|
||||
make %{?_smp_mflags}
|
||||
|
||||
%install
|
||||
@ -425,6 +426,11 @@ gtk-query-immodules-3.0-%{__isa_bits} --update-cache &> /dev/null || :
|
||||
%{_datadir}/gtk-doc/html/*
|
||||
|
||||
%changelog
|
||||
* Thu Mar 09 2017 Takao Fujiwara <tfujiwar@redhat.com> - 1.5.15-2
|
||||
- Added ibus-HEAD.patch to get upstream patches
|
||||
Fixed ibus_emojier_run() SIGABRT with `ibus emoji`
|
||||
Enhanced theme color on emoji candidates
|
||||
|
||||
* Mon Mar 06 2017 Takao Fujiwara <tfujiwar@redhat.com> - 1.5.15-1
|
||||
- Bumped to 1.5.15
|
||||
|
||||
|
1
sources
1
sources
@ -1,2 +1 @@
|
||||
SHA512 (ibus-1.5.15.tar.gz) = 4e588acf2ca0172b365630dcfe2d9062e7583e50a44d435ec05c8e3976c6caf54c4708733f1f7dce5ef7724254469ee5c7ab3b086f0cbea18775c894863b0c3e
|
||||
SHA512 (cldr-emoji-annotation-30.0.3_2.tar.gz) = 1694fcef63be75f80a2d760696422b591fdfeca28186f2c10414cb7549911378fab2ee992eb578c43c5ac2da62bfa0e846810fdf1d756f15184a44f040f111c1
|
||||
|
Loading…
Reference in New Issue
Block a user