From 38194ccce1416f338e922d156b2c77450b105f05 Mon Sep 17 00:00:00 2001 From: Takao Fujiwara Date: Feb 17 2011 07:30:49 +0000 Subject: Fixed Bug 677856 - left ibus snooper when im client is switched. --- diff --git a/ibus-530711-preload-sys.patch b/ibus-530711-preload-sys.patch index 86d9bb0..a30d069 100644 --- a/ibus-530711-preload-sys.patch +++ b/ibus-530711-preload-sys.patch @@ -40,7 +40,7 @@ index cbcf7f4..1bb159e 100644 static void bus_ibus_impl_set_use_sys_layout (BusIBusImpl *ibus, GVariant *value); -@@ -270,6 +273,123 @@ _panel_destroy_cb (BusPanelProxy *panel, +@@ -270,6 +273,126 @@ _panel_destroy_cb (BusPanelProxy *panel, g_object_unref (panel); } @@ -131,7 +131,10 @@ index cbcf7f4..1bb159e 100644 + + g_assert (BUS_IS_IBUS_IMPL (ibus)); + -+ lang = g_strdup (setlocale (LC_ALL, NULL)); ++ lang = g_strdup (setlocale (LC_CTYPE, NULL)); ++ if (lang == NULL) { ++ return; ++ } + p = index (lang, '.'); + if (p) { + *p = '\0'; @@ -164,7 +167,7 @@ index cbcf7f4..1bb159e 100644 static void bus_ibus_impl_set_hotkey (BusIBusImpl *ibus, GQuark hotkey, -@@ -354,34 +474,32 @@ static void +@@ -354,34 +477,32 @@ static void bus_ibus_impl_set_preload_engines (BusIBusImpl *ibus, GVariant *value) { @@ -218,7 +221,7 @@ index cbcf7f4..1bb159e 100644 } /** -@@ -459,82 +577,48 @@ bus_ibus_impl_set_use_global_engine (BusIBusImpl *ibus, +@@ -459,82 +580,48 @@ bus_ibus_impl_set_use_global_engine (BusIBusImpl *ibus, } } @@ -324,7 +327,7 @@ index cbcf7f4..1bb159e 100644 #endif } -@@ -548,6 +632,7 @@ const static struct { +@@ -548,6 +635,7 @@ const static struct { { "general/hotkey", "next_engine_in_menu", bus_ibus_impl_set_next_engine_in_menu }, { "general/hotkey", "previous_engine", bus_ibus_impl_set_previous_engine }, { "general", "preload_engines", bus_ibus_impl_set_preload_engines }, diff --git a/ibus-HEAD.patch b/ibus-HEAD.patch index 1955588..cdb4df4 100644 --- a/ibus-HEAD.patch +++ b/ibus-HEAD.patch @@ -94,3 +94,50 @@ index 88357af..9f593ab 100644 -- 1.7.3.2 +From 6575fab67eaf6f8e483a001f26dbfd61c3258e0a Mon Sep 17 00:00:00 2001 +From: fujiwarat +Date: Thu, 17 Feb 2011 14:46:45 +0900 +Subject: [PATCH] Call gtk_key_snooper_remove when GTK IM client is switched. + +--- + client/gtk2/ibusimcontext.c | 10 ++++++++++ + 1 files changed, 10 insertions(+), 0 deletions(-) + +diff --git a/client/gtk2/ibusimcontext.c b/client/gtk2/ibusimcontext.c +index bb5ae5c..bb9cb3d 100644 +--- a/client/gtk2/ibusimcontext.c ++++ b/client/gtk2/ibusimcontext.c +@@ -258,6 +258,8 @@ _key_snooper_cb (GtkWidget *widget, + IBusIMContext *ibusimcontext = (IBusIMContext *) _focus_im_context; + IBusInputContext *ibuscontext = NULL; + ++ g_return_val_if_fail (IBUS_IS_IM_CONTEXT (ibusimcontext), FALSE); ++ + if (ibusimcontext != NULL && + ibusimcontext->has_focus == TRUE) { + /* has IC with focus and use_key_snooper is true */ +@@ -620,6 +622,12 @@ ibus_im_context_finalize (GObject *obj) + pango_attr_list_unref (ibusimcontext->preedit_attrs); + } + ++ if (_key_snooper_id != 0) { ++ IDEBUG ("snooper is terminated."); ++ gtk_key_snooper_remove (_key_snooper_id); ++ _key_snooper_id = 0; ++ } ++ + G_OBJECT_CLASS(parent_class)->finalize (obj); + } + +@@ -631,6 +639,8 @@ ibus_im_context_filter_keypress (GtkIMContext *context, + + IBusIMContext *ibusimcontext = IBUS_IM_CONTEXT (context); + ++ g_return_val_if_fail (IBUS_IS_IM_CONTEXT (ibusimcontext), FALSE); ++ + if (G_LIKELY (ibusimcontext->ibuscontext && ibusimcontext->has_focus)) { + /* If context does not have focus, ibus will process key event in sync mode. + * It is a workaround for increase search in treeview. +-- +1.7.4 + diff --git a/ibus-xx-gtk-legacy-icon.patch b/ibus-xx-gtk-legacy-icon.patch new file mode 100644 index 0000000..22b354f --- /dev/null +++ b/ibus-xx-gtk-legacy-icon.patch @@ -0,0 +1,133 @@ +From e2b07deb05182355f7bdecdd69a731a566ad832c Mon Sep 17 00:00:00 2001 +From: fujiwarat +Date: Thu, 17 Feb 2011 15:16:21 +0900 +Subject: [PATCH] Use gtk_icon_factory_lookup_default for GTK stock + +gtk_icon_theme_load_icon doesn't load GTK legacy stock ids because +The stock legacy symlinks are removed in the latst GTK. +--- + ui/gtk/engineabout.py | 13 ++++++++++--- + ui/gtk/icon.py | 40 ++++++++++++++++++++++++++++++++++++---- + ui/gtk/panel.py | 4 ++-- + 3 files changed, 48 insertions(+), 9 deletions(-) + +diff --git a/ui/gtk/engineabout.py b/ui/gtk/engineabout.py +index a34e930..1af806c 100644 +--- a/ui/gtk/engineabout.py ++++ b/ui/gtk/engineabout.py +@@ -24,6 +24,7 @@ import gtk + from gtk import gdk + import pango + import ibus ++import icon as _icon + + from i18n import _, N_ + +@@ -35,7 +36,9 @@ class EngineAbout(gtk.Dialog): + self.__init_ui() + + def __init_ui(self): +- self.set_icon_name("gtk-about") ++ # Gtk stock symlink is legacy. ++ pixbufs = _icon.icon_set_get_pixbufs_default(None, gtk.STOCK_ABOUT) ++ self.set_icon_list(*pixbufs) + sw = gtk.ScrolledWindow() + sw.set_shadow_type(gtk.SHADOW_ETCHED_IN) + sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) +@@ -96,6 +99,10 @@ class EngineAbout(gtk.Dialog): + theme = gtk.icon_theme_get_default() + icon = theme.lookup_icon("ibus-engine", 48, 0) + if icon == None: +- icon = theme.lookup_icon("gtk-missing-image", 48, 0) +- pixbuf = icon.load_icon() ++ # Gtk stock symlink is legacy. ++ pixbuf = _icon.icon_set_get_pixbuf_default(None, ++ gtk.STOCK_MISSING_IMAGE, ++ 48) ++ else: ++ pixbuf = icon.load_icon() + return pixbuf +diff --git a/ui/gtk/icon.py b/ui/gtk/icon.py +index 5b5f97f..d91fe4a 100644 +--- a/ui/gtk/icon.py ++++ b/ui/gtk/icon.py +@@ -22,6 +22,32 @@ + + import gtk + import gtk.gdk as gdk ++import sys ++ ++def icon_set_get_pixbuf_default(icon_set, stock_id, size, state=gtk.STATE_NORMAL): ++ if icon_set == None: ++ icon_set = gtk.icon_factory_lookup_default(stock_id) ++ if icon_set == None: ++ return None ++ return icon_set.render_icon(gtk.widget_get_default_style(), ++ gtk.widget_get_default_direction(), ++ state, ++ size, ++ None, None) ++ ++def icon_set_get_pixbufs_default(icon_set, stock_id, state=gtk.STATE_NORMAL): ++ if icon_set == None: ++ icon_set = gtk.icon_factory_lookup_default(stock_id) ++ pixbufs = [] ++ if icon_set == None: ++ return [] ++ for size in icon_set.get_sizes(): ++ pixbufs.append(icon_set.render_icon(gtk.widget_get_default_style(), ++ gtk.widget_get_default_direction(), ++ state, ++ size, ++ None, None)) ++ return pixbufs + + class IconWidget(gtk.Image): + def __init__(self, icon, size): +@@ -31,11 +57,17 @@ class IconWidget(gtk.Image): + if icon.startswith("/"): + pixbuf = gdk.pixbuf_new_from_file(icon) + else: +- theme = gtk.icon_theme_get_default() +- pixbuf = theme.load_icon(icon, size, 0) ++ # Gtk stock symlink is legacy. ++ icon_set = gtk.icon_factory_lookup_default(icon) ++ if icon_set != None: ++ pixbuf = icon_set_get_pixbuf_default(icon_set, icon, size) ++ else: ++ theme = gtk.icon_theme_get_default() ++ pixbuf = theme.load_icon(icon, size, 0) + except: +- theme = gtk.icon_theme_get_default() +- pixbuf = theme.load_icon(gtk.STOCK_MISSING_IMAGE, size, 0) ++ print >> sys.stderr, "Not Found Icon", icon, size ++ # Gtk stock symlink is legacy. ++ pixbuf = icon_set_get_pixbuf_default(None, gtk.STOCK_MISSING_IMAGE, size) + + width = pixbuf.get_width() + height = pixbuf.get_height() +diff --git a/ui/gtk/panel.py b/ui/gtk/panel.py +index 07b0fa2..2244455 100644 +--- a/ui/gtk/panel.py ++++ b/ui/gtk/panel.py +@@ -412,7 +412,7 @@ class Panel(ibus.PanelBase): + menu.add(item) + + item = gtk.ImageMenuItem(_("Turn off input method")) +- item.set_image(_icon.IconWidget("gtk-close", size[0])) ++ item.set_image(_icon.IconWidget(gtk.STOCK_CLOSE, size[0])) + item.connect("activate", self.__im_menu_item_activate_cb, None) + if self.__focus_ic == None or not self.__focus_ic.is_enabled(): + item.set_sensitive(False) +@@ -452,7 +452,7 @@ class Panel(ibus.PanelBase): + menu = gtk.Menu() + item = gtk.ImageMenuItem(_("No input window")) + size = gtk.icon_size_lookup(gtk.ICON_SIZE_MENU) +- item.set_image(_icon.IconWidget("gtk-info", size[0])) ++ item.set_image(_icon.IconWidget(gtk.STOCK_INFO, size[0])) + menu.add(item) + menu.show_all() + else: +-- +1.7.4 + diff --git a/ibus.spec b/ibus.spec index 44f458e..0946fb0 100644 --- a/ibus.spec +++ b/ibus.spec @@ -12,7 +12,7 @@ Name: ibus Version: 1.3.99.20110206 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Intelligent Input Bus for Linux OS License: LGPLv2+ Group: System Environment/Libraries @@ -29,6 +29,8 @@ Patch4: ibus-657165-panel-libs.patch Patch5: ibus-657165-gjs-plugins.patch # This will be removed after the new gnome-shell is integrated. Patch99: ibus-675503-gnome-shell-workaround.patch +# The latest gnome-icon-theme removes the legacy gtk-stock symlinks. +Patch100: ibus-xx-gtk-legacy-icon.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) @@ -141,6 +143,7 @@ The ibus-devel-docs package contains developer documentation for ibus bzcat %SOURCE2 | tar xf - %patch0 -p1 %patch99 -p1 -b .g-s-typo +%patch100 -p1 -b .legacy-stock # start surrounding patch %patch1 -p1 -b .surrounding cp client/gtk2/ibusimcontext.c client/gtk3/ibusimcontext.c @@ -311,6 +314,10 @@ fi %{_datadir}/gtk-doc/html/* %changelog +* Thu Feb 17 2011 Takao Fujiwara - 1.3.99.20110206-2 +- Fixed Bug 677856 - left ibus snooper when im client is switched. +- Added ibus-xx-gtk-legacy-icon.patch to work without legacy gtk stock. + * Mon Feb 14 2011 Takao Fujiwara - 1.3.99.20110206-1 - Integrated the part of gjs in Bug 657165 ibus for gnome-shell. Added ibus-ui-gjs-plugins-20110214.tar.bz2