Fixed font settings for GTK 3.22

- support scroll event in candidates panel
- Fixed Bug 1403985 - Emoji typing is enabled during Unicode typing
- Fixed Bug 1402494 - Font settings of ibus are ignored on non-Gnome
This commit is contained in:
Takao Fujiwara 2017-01-11 15:04:25 +09:00
parent dfae6e5bbe
commit 042884aa82
2 changed files with 242 additions and 1 deletions

View File

@ -392,3 +392,239 @@ index 23e1c9d..65c33a0 100644
--
2.7.4
From 52b7272d97a881a8a6c872e28c1970ec47cb4337 Mon Sep 17 00:00:00 2001
From: Peng Wu <alexepico@gmail.com>
Date: Wed, 12 Oct 2016 15:17:24 +0900
Subject: [PATCH] ui/gtk3: support scroll event in candidates panel
When press scroll button of mouse on candidates,
automatically cursor up/cursor down.
BUG=
R=takao.fujiwara1@gmail.com
Review URL: https://codereview.appspot.com/302700043
Patch from Peng Wu <alexepico@gmail.com>.
---
ui/gtk3/candidatearea.vala | 33 +++++++++++++++++++++++++++++----
ui/gtk3/panel.vala | 2 ++
2 files changed, 31 insertions(+), 4 deletions(-)
diff --git a/ui/gtk3/candidatearea.vala b/ui/gtk3/candidatearea.vala
index 3848f0d..88db268 100644
--- a/ui/gtk3/candidatearea.vala
+++ b/ui/gtk3/candidatearea.vala
@@ -61,6 +61,18 @@ class CandidateArea : Gtk.Box {
set_vertical(vertical, true);
}
+ public bool candidate_scrolled(Gdk.EventScroll event) {
+ switch (event.direction) {
+ case Gdk.ScrollDirection.UP:
+ cursor_up();
+ break;
+ case Gdk.ScrollDirection.DOWN:
+ cursor_down();
+ break;
+ }
+ return true;
+ }
+
public bool get_vertical() {
return m_vertical;
}
@@ -167,9 +179,17 @@ class CandidateArea : Gtk.Box {
next_button.set_relief(Gtk.ReliefStyle.NONE);
if (m_vertical) {
+ Gtk.EventBox container_ebox = new Gtk.EventBox();
+ container_ebox.add_events(Gdk.EventMask.SCROLL_MASK);
+ container_ebox.scroll_event.connect(candidate_scrolled);
+ add(container_ebox);
+
+ Gtk.Box vbox = new Gtk.Box(Gtk.Orientation.VERTICAL, 0);
+ container_ebox.add(vbox);
+
// Add Candidates
Gtk.Box candidates_hbox = new Gtk.Box(Gtk.Orientation.HORIZONTAL, 0);
- pack_start(candidates_hbox, false, false, 0);
+ vbox.pack_start(candidates_hbox, false, false, 0);
Gtk.Box labels_vbox = new Gtk.Box(Gtk.Orientation.VERTICAL, 0);
labels_vbox.set_homogeneous(true);
Gtk.Box candidates_vbox = new Gtk.Box(Gtk.Orientation.VERTICAL, 0);
@@ -179,7 +199,7 @@ class CandidateArea : Gtk.Box {
candidates_hbox.pack_start(candidates_vbox, true, true, 4);
// Add HSeparator
- pack_start(new HSeparator(), false, false, 0);
+ vbox.pack_start(new HSeparator(), false, false, 0);
// Add buttons
Gtk.Box buttons_hbox = new Gtk.Box(Gtk.Orientation.HORIZONTAL, 0);
@@ -188,7 +208,7 @@ class CandidateArea : Gtk.Box {
buttons_hbox.pack_start(state_label, true, true, 0);
buttons_hbox.pack_start(prev_button, false, false, 0);
buttons_hbox.pack_start(next_button, false, false, 0);
- pack_start(buttons_hbox, false, false, 0);
+ vbox.pack_start(buttons_hbox, false, false, 0);
m_labels = {};
m_candidates = {};
@@ -234,8 +254,13 @@ class CandidateArea : Gtk.Box {
m_widgets += candidate_ebox;
}
} else {
+ Gtk.EventBox container_ebox = new Gtk.EventBox();
+ container_ebox.add_events(Gdk.EventMask.SCROLL_MASK);
+ container_ebox.scroll_event.connect(candidate_scrolled);
+ add(container_ebox);
+
Gtk.Box hbox = new Gtk.Box(Gtk.Orientation.HORIZONTAL, 0);
- add(hbox);
+ container_ebox.add(hbox);
m_labels = {};
m_candidates = {};
diff --git a/ui/gtk3/panel.vala b/ui/gtk3/panel.vala
index cc19350..ee08c59 100644
--- a/ui/gtk3/panel.vala
+++ b/ui/gtk3/panel.vala
@@ -111,6 +111,8 @@ class Panel : IBus.PanelService {
m_candidate_panel = new CandidatePanel();
m_candidate_panel.page_up.connect((w) => this.page_up());
m_candidate_panel.page_down.connect((w) => this.page_down());
+ m_candidate_panel.cursor_up.connect((w) => this.cursor_up());
+ m_candidate_panel.cursor_down.connect((w) => this.cursor_down());
m_candidate_panel.candidate_clicked.connect(
(w, i, b, s) => this.candidate_clicked(i, b, s));
--
2.7.4
From f80dcc978fdc9a3d7853434e86f4ee02c2a92b33 Mon Sep 17 00:00:00 2001
From: fujiwarat <takao.fujiwara1@gmail.com>
Date: Wed, 11 Jan 2017 12:11:22 +0900
Subject: [PATCH] src: Avoid emoji typing during Unicode typing
If 'sk' layout is used, digit keys need Shift key and
Unicode typing of U+1AE requires Shift key after Ctrl-Shift-u.
This patch does not enable the emoji typing with Ctrl-Shift-e
during Unicode typing.
BUG=rhbz#1403985
Review URL: https://codereview.appspot.com/311510043
---
src/ibusenginesimple.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/src/ibusenginesimple.c b/src/ibusenginesimple.c
index 65c33a0..2a98d58 100644
--- a/src/ibusenginesimple.c
+++ b/src/ibusenginesimple.c
@@ -2,8 +2,8 @@
/* vim:set et sts=4: */
/* ibus - The Input Bus
* Copyright (C) 2014 Peng Huang <shawn.p.huang@gmail.com>
- * Copyright (C) 2015-2016 Takao Fujiwara <takao.fujiwara1@gmail.com>
- * Copyright (C) 2014-2016 Red Hat, Inc.
+ * Copyright (C) 2015-2017 Takao Fujiwara <takao.fujiwara1@gmail.com>
+ * Copyright (C) 2014-2017 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
@@ -1187,7 +1187,8 @@ ibus_engine_simple_process_key_event (IBusEngine *engine,
}
/* Check for hex sequence start */
- if (!priv->in_hex_sequence && have_hex_mods && is_hex_start) {
+ if (!priv->in_hex_sequence && !priv->in_emoji_sequence &&
+ have_hex_mods && is_hex_start) {
priv->compose_buffer[0] = 0;
priv->in_hex_sequence = TRUE;
priv->in_emoji_sequence = FALSE;
@@ -1200,7 +1201,8 @@ ibus_engine_simple_process_key_event (IBusEngine *engine,
ibus_engine_simple_update_preedit_text (simple);
return TRUE;
- } else if (!priv->in_emoji_sequence && have_hex_mods && is_emoji_start) {
+ } else if (!priv->in_hex_sequence && !priv->in_emoji_sequence &&
+ have_hex_mods && is_emoji_start) {
priv->compose_buffer[0] = 0;
priv->in_hex_sequence = FALSE;
priv->in_emoji_sequence = TRUE;
--
2.7.4
From aacf5adbba9b9b34a1ec07005e670d209513fb5b Mon Sep 17 00:00:00 2001
From: fujiwarat <takao.fujiwara1@gmail.com>
Date: Wed, 11 Jan 2017 12:16:59 +0900
Subject: [PATCH] ui/gtk3: Fix panel CSS format for GTK 3.22
GtkCssProvider no longer works with the Pango format in GTK 3.22 and
need to use the CSS format.
BUG=https://github.com/ibus/ibus/issues/1879
Review URL: https://codereview.appspot.com/319960043
---
ui/gtk3/panel.vala | 21 ++++++++++++++-------
1 file changed, 14 insertions(+), 7 deletions(-)
diff --git a/ui/gtk3/panel.vala b/ui/gtk3/panel.vala
index ee08c59..4fb7555 100644
--- a/ui/gtk3/panel.vala
+++ b/ui/gtk3/panel.vala
@@ -3,7 +3,7 @@
* ibus - The Input Bus
*
* Copyright(c) 2011-2014 Peng Huang <shawn.p.huang@gmail.com>
- * Copyright(c) 2015-2016 Takao Fujwiara <takao.fujiwara1@gmail.com>
+ * Copyright(c) 2015-2017 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
@@ -538,26 +538,33 @@ class Panel : IBus.PanelService {
return;
}
- string font_name = m_settings_panel.get_string("custom-font");
+ string custom_font = m_settings_panel.get_string("custom-font");
- if (font_name == null) {
+ if (custom_font == null) {
warning("No config panel:custom-font.");
return;
}
- string data_format = "label { font: %s; }";
+ Pango.FontDescription font_desc =
+ Pango.FontDescription.from_string(custom_font);
+ string font_family = font_desc.get_family();
+ int font_size = font_desc.get_size() / Pango.SCALE;
+ string data;
+
if (Gtk.MAJOR_VERSION < 3 ||
(Gtk.MAJOR_VERSION == 3 && Gtk.MINOR_VERSION < 20)) {
- data_format = "GtkLabel { font: %s; }";
+ data = "GtkLabel { font: %s; }".printf(custom_font);
+ } else {
+ data = "label { font-family: %s; font-size: %dpt; }"
+ .printf(font_family, font_size);
}
- string data = data_format.printf(font_name);
m_css_provider = new Gtk.CssProvider();
try {
m_css_provider.load_from_data(data, -1);
} catch (GLib.Error e) {
- warning("Failed css_provider_from_data: %s: %s", font_name,
+ warning("Failed css_provider_from_data: %s: %s", custom_font,
e.message);
return;
}
--
2.7.4

View File

@ -28,7 +28,7 @@
Name: ibus
Version: 1.5.14
Release: 4%{?dist}
Release: 5%{?dist}
Summary: Intelligent Input Bus for Linux OS
License: LGPLv2+
Group: System Environment/Libraries
@ -424,6 +424,11 @@ gtk-query-immodules-3.0-%{__isa_bits} --update-cache &> /dev/null || :
%{_datadir}/gtk-doc/html/*
%changelog
* Wed Jan 11 2017 Takao Fujiwara <tfujiwar@redhat.com> - 1.5.14-5
- support scroll event in candidates panel
- Fixed Bug 1403985 - Emoji typing is enabled during Unicode typing
- Fixed Bug 1402494 - Font settings of ibus are ignored on non-Gnome
* Mon Dec 19 2016 Miro Hrončok <mhroncok@redhat.com> - 1.5.14-4
- Rebuild for Python 3.6