From 0432aa66b8728bc266da3c2cca84587bc44b3557 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Tue, 8 Mar 2016 11:16:24 +0900 Subject: [PATCH] Don't warn if DISPLAY is not set This is normal under Wayland, and not worth warning about. The warnings disrupt unit tests in GNOME continuous, which treat warnings as fatal. BUG=https://github.com/ibus/ibus/pull/1844 R=shawn.p.huang@gmail.com Review URL: https://codereview.appspot.com/289430043 Patch from Matthias Clasen . --- src/ibusshare.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/ibusshare.c b/src/ibusshare.c index 63800a6..b793a96 100644 --- a/src/ibusshare.c +++ b/src/ibusshare.c @@ -113,10 +113,7 @@ ibus_get_socket_path (void) display = g_strdup (_display); } - if (display == NULL) { - g_warning ("DISPLAY is empty! We use default DISPLAY (:0.0)"); - } - else { + if (display) { p = display; hostname = display; for (; *p != ':' && *p != '\0'; p++); -- 2.7.4 From 84c18f1d382548c52138822a11473d2dac79e485 Mon Sep 17 00:00:00 2001 From: Rui Matos Date: Wed, 25 May 2016 11:21:09 +0900 Subject: [PATCH] Install a DBus service file With the transition to user scoped DBus sessions (vs. login sessions) there's a need to start ibus-daemon via DBus activation so that the process gets properly tracked and disposed of when the login session ends. Otherwise the ibus-daemon process lingers on and keeps the whole login session up. We already connect and own a well known name on DBus. The remaining missing piece is the DBus service file which we introduce here. BUG=https://github.com/ibus/ibus/pull/1853 R=Shawn.P.Huang@gmail.com Review URL: https://codereview.appspot.com/295340043 Patch from Rui Matos . --- bus/Makefile.am | 11 +++++++++++ bus/org.freedesktop.IBus.service.in | 3 +++ 2 files changed, 14 insertions(+) create mode 100644 bus/org.freedesktop.IBus.service.in diff --git a/bus/Makefile.am b/bus/Makefile.am index 26cb2f8..4dabacf 100644 --- a/bus/Makefile.am +++ b/bus/Makefile.am @@ -174,4 +174,15 @@ man_onedir = $(mandir)/man1 %.1.gz: %.1 $(AM_V_GEN) gzip -c $< > $@.tmp && mv $@.tmp $@ + +dbusservice_in_files = org.freedesktop.IBus.service.in +dbusservice_DATA = $(dbusservice_in_files:.service.in=.service) +dbusservicedir=${datadir}/dbus-1/services + +org.freedesktop.IBus.service: org.freedesktop.IBus.service.in + $(AM_V_GEN) sed -e "s|\@bindir\@|$(bindir)|" $< > $@.tmp && mv $@.tmp $@ + +EXTRA_DIST += $(dbusservice_in_files) +CLEANFILES += $(dbusservice_DATA) + -include $(top_srcdir)/git.mk diff --git a/bus/org.freedesktop.IBus.service.in b/bus/org.freedesktop.IBus.service.in new file mode 100644 index 0000000..cc88834 --- /dev/null +++ b/bus/org.freedesktop.IBus.service.in @@ -0,0 +1,3 @@ +[D-BUS Service] +Name=org.freedesktop.IBus +Exec=@bindir@/ibus-daemon --replace --xim --panel disable -- 2.7.4 From 3ef21fef0135f7b4fe9611d201f15611734f6c51 Mon Sep 17 00:00:00 2001 From: fujiwarat Date: Fri, 3 Jun 2016 11:52:29 +0900 Subject: [PATCH] client/gtk2: Fix SEGV with Wayland display Delete gdk_display_get_name() in GTK clients because ibus-daemon does not use gdk_display_get_name(). GdkX11Dislay and GdkX11Window does not work with Wayland. BUG=https://github.com/ibus/ibus/issues/1859 R=Shawn.P.Huang@gmail.com Review URL: https://codereview.appspot.com/301760043 --- client/gtk2/ibusimcontext.c | 5 ----- setup/main.py | 7 +++++-- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/client/gtk2/ibusimcontext.c b/client/gtk2/ibusimcontext.c index 9d927e6..0df0062 100644 --- a/client/gtk2/ibusimcontext.c +++ b/client/gtk2/ibusimcontext.c @@ -583,11 +583,6 @@ ibus_im_context_class_init (IBusIMContextClass *class) /* init bus object */ if (_bus == NULL) { - const gchar *dname = gdk_display_get_name (gdk_display_get_default ()); - /* ibus-daemon uses DISPLAY variable. */ - if (g_strcmp0 (dname, "Wayland") == 0) - dname = g_getenv ("DISPLAY"); - ibus_set_display (dname); _bus = ibus_bus_new_async (); /* init the global fake context */ diff --git a/setup/main.py b/setup/main.py index 26c2b0f..e1f7a9d 100644 --- a/setup/main.py +++ b/setup/main.py @@ -275,8 +275,11 @@ class Setup(object): self.__init_general() def __gdk_window_set_cb(self, object, pspec): - str = '%u' % GdkX11.X11Window.get_xid(object.get_window()) - GLib.setenv('IBUS_SETUP_XID', str, True) + window = object.get_window() + if type(window) != GdkX11.X11Window: + return + s = '%u' % GdkX11.X11Window.get_xid(window) + GLib.setenv('IBUS_SETUP_XID', s, True) def __combobox_notify_active_engine_cb(self, combobox, property): engine = self.__combobox.get_active_engine() -- 2.7.4 From a598ae29223d1ca25e76bf7d7de9703f63ea337e Mon Sep 17 00:00:00 2001 From: fujiwarat Date: Fri, 3 Jun 2016 19:44:11 +0900 Subject: [PATCH] ui/gtk3: Fix panel CSS format for GTK 3.20 CSS node names have been changed since GTK 3.20 and the font size and widget color no longer work with the previous node names. BUG=https://github.com/ibus/ibus/issues/1856 Review URL: https://codereview.appspot.com/297380043 --- ui/gtk3/candidatearea.vala | 16 +++++++++++++--- ui/gtk3/handle.vala | 10 ++++++++-- ui/gtk3/panel.vala | 9 +++++++-- 3 files changed, 28 insertions(+), 7 deletions(-) diff --git a/ui/gtk3/candidatearea.vala b/ui/gtk3/candidatearea.vala index c969312..3848f0d 100644 --- a/ui/gtk3/candidatearea.vala +++ b/ui/gtk3/candidatearea.vala @@ -3,7 +3,7 @@ * ibus - The Input Bus * * Copyright(c) 2011-2015 Peng Huang - * Copyright(c) 2015 Takao Fujiwara + * Copyright(c) 2015-2016 Takao Fujiwara * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -31,6 +31,10 @@ class CandidateArea : Gtk.Box { private uint m_focus_candidate; private bool m_show_cursor; + private bool m_use_latest_css_format = + ((Gtk.MAJOR_VERSION > 3) || + (Gtk.MAJOR_VERSION == 3) && (Gtk.MINOR_VERSION >= 20)); + private const string LABELS[] = { "1.", "2.", "3.", "4.", "5.", "6.", "7.", "8.", "9.", "0.", "a.", "b.", "c.", "d.", "e.", "f." @@ -103,7 +107,8 @@ class CandidateArea : Gtk.Box { Pango.AttrList attrs = get_pango_attr_list_from_ibus_text(candidates[i]); if (i == focus_candidate && show_cursor) { Gtk.StyleContext context = m_candidates[i].get_style_context(); - Gdk.RGBA color = context.get_color(Gtk.StateFlags.SELECTED); + Gdk.RGBA *color = null; + context.get(Gtk.StateFlags.SELECTED, "color", out color); Pango.Attribute pango_attr = Pango.attr_foreground_new( (uint16)(color.red * uint16.MAX), (uint16)(color.green * uint16.MAX), @@ -112,7 +117,12 @@ class CandidateArea : Gtk.Box { pango_attr.end_index = candidates[i].get_text().length; attrs.insert((owned)pango_attr); - color = context.get_background_color(Gtk.StateFlags.SELECTED); + color = null; + string bg_prop = + m_use_latest_css_format + ? "-gtk-secondary-caret-color" + : "background-color"; + context.get(Gtk.StateFlags.SELECTED, bg_prop, out color); pango_attr = Pango.attr_background_new( (uint16)(color.red * uint16.MAX), (uint16)(color.green * uint16.MAX), diff --git a/ui/gtk3/handle.vala b/ui/gtk3/handle.vala index 1edb537..bef5e8b 100644 --- a/ui/gtk3/handle.vala +++ b/ui/gtk3/handle.vala @@ -2,7 +2,8 @@ * * ibus - The Input Bus * - * Copyright(c) 2011-2015 Peng Huang + * Copyright(c) 2011-2016 Peng Huang + * Copyright(c) 2016 Takao Fujiwara * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -29,6 +30,11 @@ class Handle : Gtk.EventBox { public signal void move_end(); public Handle() { + // Call base class constructor + GLib.Object( + name : "IBusHandle" + ); + set_size_request(6, -1); Gdk.EventMask mask = Gdk.EventMask.EXPOSURE_MASK | Gdk.EventMask.BUTTON_PRESS_MASK | @@ -42,7 +48,7 @@ class Handle : Gtk.EventBox { Gtk.CssProvider css_provider = new Gtk.CssProvider(); try { css_provider.load_from_data( - "GtkEventBox { background-color: gray }", -1); + "#IBusHandle { background-color: gray }", -1); } catch (GLib.Error error) { warning("Parse error in Handle: %s", error.message); } diff --git a/ui/gtk3/panel.vala b/ui/gtk3/panel.vala index 2ca3a5e..cc19350 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 - * Copyright(c) 2015 Takao Fujwiara + * Copyright(c) 2015-2016 Takao Fujwiara * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -543,7 +543,12 @@ class Panel : IBus.PanelService { return; } - string data_format = "GtkLabel { font: %s; }"; + string data_format = "label { font: %s; }"; + if (Gtk.MAJOR_VERSION < 3 || + (Gtk.MAJOR_VERSION == 3 && Gtk.MINOR_VERSION < 20)) { + data_format = "GtkLabel { font: %s; }"; + } + string data = data_format.printf(font_name); m_css_provider = new Gtk.CssProvider(); -- 2.7.4 From 52b7272d97a881a8a6c872e28c1970ec47cb4337 Mon Sep 17 00:00:00 2001 From: Peng Wu Date: Wed, 12 Oct 2016 15:17:24 +0900 Subject: [PATCH 1/3] 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 . --- 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