ibus/ibus-HEAD.patch

1991 lines
66 KiB
Diff
Raw Normal View History

From cb519c852dfc7a652df1768c81974d750ef48f58 Mon Sep 17 00:00:00 2001
From: Daiki Ueno <ueno@unixuser.org>
Date: Thu, 29 Sep 2011 12:24:53 +0900
Subject: [PATCH] Fix hiding button items in GTK panel.
BUG=none
TEST=manual
Review URL: http://codereview.appspot.com/5148041
---
ui/gtk/toolitem.py | 12 ++++--------
1 files changed, 4 insertions(+), 8 deletions(-)
diff --git a/ui/gtk/toolitem.py b/ui/gtk/toolitem.py
index 4bdffba..4f4f97d 100644
--- a/ui/gtk/toolitem.py
+++ b/ui/gtk/toolitem.py
@@ -73,11 +73,9 @@ class ToolButton(gtk.ToolButton, PropItem):
self.set_icon_name(self._prop.icon)
if self._prop.visible:
- self.set_no_show_all(False)
- self.show_all()
+ self.show()
else:
- self.set_no_show_all(True)
- self.hide_all()
+ self.hide()
def do_clicked(self):
self.emit("property-activate", self._prop.key, self._prop.state)
@@ -128,11 +126,9 @@ class ToggleToolButton(gtk.ToggleToolButton, PropItem):
self.set_active(self._prop.state == ibus.PROP_STATE_CHECKED)
self.set_sensitive(self._prop.sensitive)
if self._prop.visible:
- self.set_no_show_all(False)
- self.show_all()
+ self.show()
else:
- self.set_no_show_all(True)
- self.hide_all()
+ self.hide()
def do_toggled(self):
# Do not send property-activate to engine in case the event is
--
1.7.6.4
From d19018b8709847009d2e0836c942dd9f1385e7cb Mon Sep 17 00:00:00 2001
From: Yusuke Sato <yusukes@chromium.org>
Date: Sun, 9 Oct 2011 13:52:42 +0900
Subject: [PATCH] Always consume a hotkey press
BUG=1324
Review URL: http://codereview.appspot.com/5242044
---
bus/ibusimpl.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/bus/ibusimpl.c b/bus/ibusimpl.c
index 1942504..1494f5f 100644
--- a/bus/ibusimpl.c
+++ b/bus/ibusimpl.c
@@ -2066,21 +2066,21 @@ bus_ibus_impl_filter_keyboard_shortcuts (BusIBusImpl *ibus,
else {
bus_input_context_enable (context);
}
- return (enabled != bus_input_context_is_enabled (context));
+ return TRUE;
}
if (event == enable_unconditional) {
gboolean enabled = bus_input_context_is_enabled (context);
if (!enabled) {
bus_input_context_enable (context);
}
- return bus_input_context_is_enabled (context);
+ return TRUE;
}
if (event == disable_unconditional) {
gboolean enabled = bus_input_context_is_enabled (context);
if (enabled) {
bus_input_context_disable (context);
}
- return !bus_input_context_is_enabled (context);
+ return TRUE;
}
if (event == next) {
if (bus_input_context_is_enabled (context)) {
--
1.7.6.4
From ee966e327cc3b1b4bba40379bc0fbb3d46c38239 Mon Sep 17 00:00:00 2001
From: fujiwarat <takao.fujiwara1@gmail.com>
Date: Tue, 25 Oct 2011 10:37:22 +0900
Subject: [PATCH] Add ibusutil.h in ibus.h
BUG=http://code.google.com/p/ibus/issues/detail?id=1338
TEST=Linux desktop
Review URL: http://codereview.appspot.com/5294054
---
src/ibus.h | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/src/ibus.h b/src/ibus.h
index 0765799..addc531 100644
--- a/src/ibus.h
+++ b/src/ibus.h
@@ -52,6 +52,7 @@
#include <ibusconfig.h>
#include <ibusconfigservice.h>
#include <ibuspanelservice.h>
+#include <ibusutil.h>
#undef __IBUS_H_INSIDE__
--
1.7.6.4
From 910f8a64098d89b04c50056f621ec1a49dd3e7ea Mon Sep 17 00:00:00 2001
From: fujiwarat <takao.fujiwara1@gmail.com>
Date: Tue, 25 Oct 2011 10:50:34 +0900
Subject: [PATCH] Fix previous_engine without global engine.
BUG=http://code.google.com/p/ibus/issues/detail?id=1331
TEST=Linux desktop
Review URL: http://codereview.appspot.com/5297047
---
bus/ibusimpl.c | 31 +++++++++++++++++++------------
1 files changed, 19 insertions(+), 12 deletions(-)
diff --git a/bus/ibusimpl.c b/bus/ibusimpl.c
index 1494f5f..0a4f3fb 100644
--- a/bus/ibusimpl.c
+++ b/bus/ibusimpl.c
@@ -1044,13 +1044,14 @@ bus_ibus_impl_get_engine_desc (BusIBusImpl *ibus,
}
/**
- * bus_ibus_impl_context_request_next_engine_in_menu:
+ * bus_ibus_impl_context_request_rotate_engine_in_menu:
*
- * Process the "next_engine_in_menu" hotkey.
+ * Process the "next_engine_in_menu" or "previous_engine" hotkey.
*/
static void
-bus_ibus_impl_context_request_next_engine_in_menu (BusIBusImpl *ibus,
- BusInputContext *context)
+bus_ibus_impl_context_request_rotate_engine_in_menu (BusIBusImpl *ibus,
+ BusInputContext *context,
+ gboolean is_next)
{
BusEngineProxy *engine;
IBusEngineDesc *desc;
@@ -1071,12 +1072,20 @@ bus_ibus_impl_context_request_next_engine_in_menu (BusIBusImpl *ibus,
p = g_list_find (ibus->register_engine_list, desc);
if (p != NULL) {
- p = p->next;
+ if (is_next) {
+ p = p->next;
+ } else if (p->prev) {
+ p = p->prev;
+ }
}
if (p == NULL) {
p = g_list_find (ibus->engine_list, desc);
if (p != NULL) {
- p = p->next;
+ if (is_next) {
+ p = p->next;
+ } else if (p->prev) {
+ p = p->prev;
+ }
}
}
@@ -1126,12 +1135,9 @@ bus_ibus_impl_context_request_previous_engine (BusIBusImpl *ibus,
}
}
- /*
- * If the previous engine name is not found, switch to the next engine
- * in the menu. This behavior is better than doing nothing.
- */
if (!engine_name) {
- bus_ibus_impl_context_request_next_engine_in_menu (ibus, context);
+ bus_ibus_impl_context_request_rotate_engine_in_menu (ibus, context,
+ FALSE);
return;
}
@@ -2084,7 +2090,8 @@ bus_ibus_impl_filter_keyboard_shortcuts (BusIBusImpl *ibus,
}
if (event == next) {
if (bus_input_context_is_enabled (context)) {
- bus_ibus_impl_context_request_next_engine_in_menu (ibus, context);
+ bus_ibus_impl_context_request_rotate_engine_in_menu (ibus, context,
+ TRUE);
}
else {
bus_input_context_enable (context);
--
1.7.6.4
From cca4fd8993613a6993965c3120323e43c4647ef5 Mon Sep 17 00:00:00 2001
From: Daiki Ueno <ueno@unixuser.org>
Date: Fri, 28 Oct 2011 15:42:08 +0900
Subject: [PATCH] Don't set focus on GTK password entry.
For an old bug:
https://bugzilla.redhat.com/show_bug.cgi?id=484643
Input method should be disabled on password entry for security reason.
BUG=none
TEST=manually with gtk-demo "Entry Buffer" example
Review URL: http://codereview.appspot.com/5319053
---
client/gtk2/ibusimcontext.c | 13 +++++++++++++
1 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/client/gtk2/ibusimcontext.c b/client/gtk2/ibusimcontext.c
index 327a5d9..b6ca12e 100644
--- a/client/gtk2/ibusimcontext.c
+++ b/client/gtk2/ibusimcontext.c
@@ -734,6 +734,19 @@ ibus_im_context_focus_in (GtkIMContext *context)
if (ibusimcontext->has_focus)
return;
+ /* don't set focus on password entry */
+ if (ibusimcontext->client_window != NULL) {
+ GtkWidget *widget;
+
+ gdk_window_get_user_data (ibusimcontext->client_window,
+ (gpointer *)&widget);
+
+ if (GTK_IS_ENTRY (widget) &&
+ !gtk_entry_get_visibility (GTK_ENTRY (widget))) {
+ return;
+ }
+ }
+
if (_focus_im_context != NULL) {
g_assert (_focus_im_context != context);
gtk_im_context_focus_out (_focus_im_context);
--
1.7.6.4
From 02893693fc0a8692a6242b0be6dc8f09e14c1c54 Mon Sep 17 00:00:00 2001
From: fujiwarat <takao.fujiwara1@gmail.com>
Date: Wed, 2 Nov 2011 14:17:50 +0900
Subject: [PATCH] Rerotate next/previous engines without global engine.
BUG=http://code.google.com/p/ibus/issues/detail?id=1331
TEST=Linux desktop
Review URL: http://codereview.appspot.com/5321067
---
bus/ibusimpl.c | 31 ++++++++++++++++++++++++++++---
1 files changed, 28 insertions(+), 3 deletions(-)
diff --git a/bus/ibusimpl.c b/bus/ibusimpl.c
index 0a4f3fb..059d660 100644
--- a/bus/ibusimpl.c
+++ b/bus/ibusimpl.c
@@ -1056,7 +1056,7 @@ bus_ibus_impl_context_request_rotate_engine_in_menu (BusIBusImpl *ibus,
BusEngineProxy *engine;
IBusEngineDesc *desc;
IBusEngineDesc *next_desc = NULL;
- GList *p;
+ GList *p = NULL;
engine = bus_input_context_get_engine (context);
if (engine == NULL) {
@@ -1074,21 +1074,46 @@ bus_ibus_impl_context_request_rotate_engine_in_menu (BusIBusImpl *ibus,
if (p != NULL) {
if (is_next) {
p = p->next;
- } else if (p->prev) {
+ } else {
p = p->prev;
}
}
+
+ /* Rotate register_engine_list and engine_list. */
+ if (p == NULL && g_list_find (ibus->register_engine_list, desc) != NULL) {
+ if (is_next) {
+ p = ibus->engine_list;
+ } else {
+ p = g_list_last (ibus->engine_list);
+ }
+ }
+
if (p == NULL) {
p = g_list_find (ibus->engine_list, desc);
if (p != NULL) {
if (is_next) {
p = p->next;
- } else if (p->prev) {
+ } else {
p = p->prev;
}
}
}
+ /* Rerotate register_engine_list and engine_list. */
+ if (p == NULL && g_list_find (ibus->engine_list, desc) != NULL) {
+ if (is_next) {
+ p = ibus->register_engine_list;
+ if (p == NULL) {
+ p = ibus->engine_list;
+ }
+ } else {
+ p = g_list_last (ibus->register_engine_list);
+ if (p == NULL) {
+ p = g_list_last (ibus->engine_list);
+ }
+ }
+ }
+
if (p != NULL) {
next_desc = (IBusEngineDesc*) p->data;
}
--
1.7.6.4
From 613e01520f27a53c947fed476d99aeb8ae1ae39b Mon Sep 17 00:00:00 2001
From: fujiwarat <takao.fujiwara1@gmail.com>
Date: Tue, 8 Nov 2011 10:48:42 +0900
Subject: [PATCH] Fixed fallback icons.
1. Set 'ibus-keyboard' icon for IME off in non-GNOME theme.
People would think the application icon for non-GNONE classic desktop.
The themed icon is applied for GNOME icon theme only.
2. Set gtk-fallback-icon-theme as 'gnome'
ibus gtk panel needs gtk stock icons but some desktop does not load GNOME
icon theme. I assigned 'gnome' for gtk-fallback-icon-theme if it's none.
3. Use 'gtk-dialog-info' if 'gtk-info' is not found.
It seems the latest gtk2 does not have 'gtk-info' icon via pygtk2.
BUG=RH#711632
TEST=Linux desktop
Review URL: http://codereview.appspot.com/5320066
---
ibus/_config.py.in | 8 ++++++--
ui/gtk/main.py | 3 +++
ui/gtk/panel.py | 2 +-
3 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/ibus/_config.py.in b/ibus/_config.py.in
index a830136..098d805 100644
--- a/ibus/_config.py.in
+++ b/ibus/_config.py.in
@@ -45,10 +45,14 @@ def get_license():
def get_ICON_KEYBOARD():
import gtk
- theme = gtk.icon_theme_get_default()
icon = '@IBUS_ICON_KEYBOARD@'
+ fallback_icon = 'ibus-keyboard'
+ settings = gtk.settings_get_default()
+ if settings.get_property('gtk-icon-theme-name') != 'gnome':
+ return fallback_icon
+ theme = gtk.icon_theme_get_default()
if not theme.lookup_icon(icon, 18, 0):
- icon = 'ibus-keyboard'
+ return fallback_icon
return icon
ISOCODES_PREFIX='@ISOCODES_PREFIX@'
diff --git a/ui/gtk/main.py b/ui/gtk/main.py
index 0412aea..cadcc96 100644
--- a/ui/gtk/main.py
+++ b/ui/gtk/main.py
@@ -86,6 +86,9 @@ class UIApplication:
pass
def launch_panel(replace):
+ settings = gtk.settings_get_default()
+ if settings.get_property('gtk-fallback-icon-theme') == None:
+ settings.set_property('gtk-fallback-icon-theme', 'gnome')
# gtk.settings_get_default().props.gtk_theme_name = "/home/phuang/.themes/aud-Default/gtk-2.0/gtkrc"
# gtk.rc_parse("./themes/default/gtkrc")
UIApplication(replace).run()
diff --git a/ui/gtk/panel.py b/ui/gtk/panel.py
index 90be1d5..f71a36d 100644
--- a/ui/gtk/panel.py
+++ b/ui/gtk/panel.py
@@ -477,7 +477,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-dialog-info", size[0]))
menu.add(item)
menu.show_all()
else:
--
1.7.6.4
From c73b2d449e21ae0cb87845e34abadd2e54e1e423 Mon Sep 17 00:00:00 2001
From: fujiwarat <takao.fujiwara1@gmail.com>
Date: Mon, 21 Nov 2011 11:00:09 +0900
Subject: [PATCH] Use ibus_input_context_process_key_event_async in
ibus-x11
---
client/x11/main.c | 113 ++++++++++++++++++++++++++++++++++++++++++++---------
1 files changed, 94 insertions(+), 19 deletions(-)
diff --git a/client/x11/main.c b/client/x11/main.c
index 0ba826c..58069fc 100644
--- a/client/x11/main.c
+++ b/client/x11/main.c
@@ -116,6 +116,8 @@ static gint g_debug_level = 0;
static IBusBus *_bus = NULL;
+static gboolean _use_sync_mode = FALSE;
+
static void
_xim_preedit_start (XIMS xims, const X11IC *x11ic)
{
@@ -443,6 +445,31 @@ xim_unset_ic_focus (XIMS xims, IMChangeFocusStruct *call_data)
}
+static void
+_process_key_event_done (GObject *object,
+ GAsyncResult *res,
+ gpointer user_data)
+{
+ IBusInputContext *context = (IBusInputContext *)object;
+ IMForwardEventStruct *pfe = (IMForwardEventStruct*) user_data;
+
+ GError *error = NULL;
+ gboolean retval = ibus_input_context_process_key_event_async_finish (
+ context,
+ res,
+ &error);
+
+ if (error != NULL) {
+ g_warning ("Process Key Event failed: %s.", error->message);
+ g_error_free (error);
+ }
+
+ if (retval == FALSE) {
+ IMForwardEvent (_xims, (XPointer) pfe);
+ }
+ g_slice_free (IMForwardEventStruct, pfe);
+}
+
static int
xim_forward_event (XIMS xims, IMForwardEventStruct *call_data)
{
@@ -469,30 +496,57 @@ xim_forward_event (XIMS xims, IMForwardEventStruct *call_data)
if (event.type == GDK_KEY_RELEASE) {
event.state |= IBUS_RELEASE_MASK;
}
- retval = ibus_input_context_process_key_event (x11ic->context,
- event.keyval,
- event.hardware_keycode - 8,
- event.state);
- if (retval) {
- if (! x11ic->has_preedit_area) {
- _xim_set_cursor_location (x11ic);
+
+ if (_use_sync_mode) {
+ retval = ibus_input_context_process_key_event (
+ x11ic->context,
+ event.keyval,
+ event.hardware_keycode - 8,
+ event.state);
+ if (retval) {
+ if (! x11ic->has_preedit_area) {
+ _xim_set_cursor_location (x11ic);
+ }
+ return 1;
}
- return 1;
- }
- IMForwardEventStruct fe;
- memset (&fe, 0, sizeof (fe));
+ IMForwardEventStruct fe;
+ memset (&fe, 0, sizeof (fe));
- fe.major_code = XIM_FORWARD_EVENT;
- fe.icid = x11ic->icid;
- fe.connect_id = x11ic->connect_id;
- fe.sync_bit = 0;
- fe.serial_number = 0L;
- fe.event = call_data->event;
+ fe.major_code = XIM_FORWARD_EVENT;
+ fe.icid = x11ic->icid;
+ fe.connect_id = x11ic->connect_id;
+ fe.sync_bit = 0;
+ fe.serial_number = 0L;
+ fe.event = call_data->event;
- IMForwardEvent (_xims, (XPointer) &fe);
+ IMForwardEvent (_xims, (XPointer) &fe);
- return 1;
+ retval = 1;
+ }
+ else {
+ IMForwardEventStruct *pfe;
+
+ pfe = g_slice_new0 (IMForwardEventStruct);
+ pfe->major_code = XIM_FORWARD_EVENT;
+ pfe->icid = x11ic->icid;
+ pfe->connect_id = x11ic->connect_id;
+ pfe->sync_bit = 0;
+ pfe->serial_number = 0L;
+ pfe->event = call_data->event;
+
+ ibus_input_context_process_key_event_async (
+ x11ic->context,
+ event.keyval,
+ event.hardware_keycode - 8,
+ event.state,
+ -1,
+ NULL,
+ _process_key_event_done,
+ pfe);
+ retval = 1;
+ }
+ return retval;
}
@@ -897,6 +951,25 @@ _context_disabled_cb (IBusInputContext *context,
_xim_preedit_end (_xims, x11ic);
}
+static gboolean
+_get_boolean_env(const gchar *name,
+ gboolean defval)
+{
+ const gchar *value = g_getenv (name);
+
+ if (value == NULL)
+ return defval;
+
+ if (g_strcmp0 (value, "") == 0 ||
+ g_strcmp0 (value, "0") == 0 ||
+ g_strcmp0 (value, "false") == 0 ||
+ g_strcmp0 (value, "False") == 0 ||
+ g_strcmp0 (value, "FALSE") == 0)
+ return FALSE;
+
+ return TRUE;
+}
+
static void
_init_ibus (void)
{
@@ -909,6 +982,8 @@ _init_ibus (void)
g_signal_connect (_bus, "disconnected",
G_CALLBACK (_bus_disconnected_cb), NULL);
+
+ _use_sync_mode = _get_boolean_env ("IBUS_ENABLE_SYNC_MODE", FALSE);
}
static void
--
1.7.6.4
From 5d2ac19e1524b1802f5298eedff1ba52423c847f Mon Sep 17 00:00:00 2001
From: Daiki Ueno <ueno@unixuser.org>
Date: Wed, 30 Nov 2011 09:40:15 +0900
Subject: [PATCH] Disable surrounding-text when retrieve-surrounding
signal is not handled in GTK.
BUG=https://code.google.com/p/ibus/issues/detail?id=1358
TEST=On Fedora with ibus-m17n tis820
Review URL: http://codereview.appspot.com/5431086
---
client/gtk2/ibusimcontext.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/client/gtk2/ibusimcontext.c b/client/gtk2/ibusimcontext.c
index b6ca12e..5ae5cfc 100644
--- a/client/gtk2/ibusimcontext.c
+++ b/client/gtk2/ibusimcontext.c
@@ -278,6 +278,11 @@ _request_surrounding_text (IBusIMContext *context)
IDEBUG ("requesting surrounding text");
g_signal_emit (context, _signal_retrieve_surrounding_id, 0,
&return_value);
+ if (!return_value) {
+ context->caps &= ~IBUS_CAP_SURROUNDING_TEXT;
+ ibus_input_context_set_capabilities (context->ibuscontext,
+ context->caps);
+ }
}
}
--
1.7.6.4
From 5236e2159f2e6184c18df9a9ecbb05bfb09106d4 Mon Sep 17 00:00:00 2001
From: fujiwarat <takao.fujiwara1@gmail.com>
Date: Wed, 30 Nov 2011 12:28:22 +0900
Subject: [PATCH] Add the engine preference button on ibus-setup
The new preference button launches $libexecdir/ibus-setup- + engine.name
by default. The engine is IBusEngineDesc.
If engine.setup has a value, the button launches it instead.
BUG=RH#618229
TEST=Linux desktop
Review URL: http://codereview.appspot.com/5437062
---
ibus/enginedesc.py | 11 +++++++++--
setup/ibus-setup.in | 2 ++
setup/main.py | 46 ++++++++++++++++++++++++++++++++++++++++++++++
setup/setup.ui | 16 ++++++++++++++++
src/ibusenginedesc.c | 31 +++++++++++++++++++++++++++++++
src/ibusenginedesc.h | 12 ++++++++++--
6 files changed, 114 insertions(+), 4 deletions(-)
diff --git a/ibus/enginedesc.py b/ibus/enginedesc.py
index 3ca7f24..055a3a0 100644
--- a/ibus/enginedesc.py
+++ b/ibus/enginedesc.py
@@ -31,7 +31,7 @@ from serializable import *
class EngineDesc(Serializable):
__gtype_name__ = "PYIBusEngineDesc"
__NAME__ = "IBusEngineDesc"
- def __init__(self, name="", longname="", description="", language="", license="", author="", icon="", layout="", hotkeys="", rank=0, symbol=""):
+ def __init__(self, name="", longname="", description="", language="", license="", author="", icon="", layout="", hotkeys="", rank=0, symbol="", setup=""):
super(EngineDesc, self).__init__()
self.__name = name
self.__longname = longname
@@ -44,6 +44,7 @@ class EngineDesc(Serializable):
self.__rank = rank
self.__hotkeys = hotkeys
self.__symbol = symbol
+ self.__setup = setup
def get_name(self):
return self.__name
@@ -78,6 +79,9 @@ class EngineDesc(Serializable):
def get_symbol(self):
return self.__symbol
+ def get_setup(self):
+ return self.__setup
+
name = property(get_name)
longname = property(get_longname)
description = property(get_description)
@@ -89,6 +93,7 @@ class EngineDesc(Serializable):
rank = property(get_rank)
hotkeys = property(get_hotkeys)
symbol = property(get_symbol)
+ setup = property(get_setup)
def serialize(self, struct):
super(EngineDesc, self).serialize(struct)
@@ -103,6 +108,7 @@ class EngineDesc(Serializable):
struct.append(dbus.UInt32(self.__rank))
struct.append(dbus.String(self.__hotkeys))
struct.append(dbus.String(self.__symbol))
+ struct.append(dbus.String(self.__setup))
def deserialize(self, struct):
super(EngineDesc, self).deserialize(struct)
@@ -117,9 +123,10 @@ class EngineDesc(Serializable):
self.__rank = struct.pop(0)
self.__hotkeys = struct.pop(0)
self.__symbol = struct.pop(0)
+ self.__setup = struct.pop(0)
def test():
- engine = EngineDesc("Hello", "", "", "", "", "", "", "", "", 0, "")
+ engine = EngineDesc("Hello", "", "", "", "", "", "", "", "", 0, "", "")
value = serialize_object(engine)
engine = deserialize_object(value)
diff --git a/setup/ibus-setup.in b/setup/ibus-setup.in
index 72bc1a4..f3c3730 100644
--- a/setup/ibus-setup.in
+++ b/setup/ibus-setup.in
@@ -23,8 +23,10 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
datarootdir=@datarootdir@
+libexecdir=@libexecdir@
export IBUS_PREFIX=@prefix@
export IBUS_DATAROOTDIR=@datarootdir@
export IBUS_LOCALEDIR=@localedir@
+export IBUS_LIBEXECDIR=${libexecdir}
exec @PYTHON@ @prefix@/share/ibus/setup/main.py $@
diff --git a/setup/main.py b/setup/main.py
index a22bb0c..6c0fb0e 100644
--- a/setup/main.py
+++ b/setup/main.py
@@ -238,6 +238,10 @@ class Setup(object):
button = self.__builder.get_object("button_engine_about")
button.connect("clicked", self.__button_engine_about_cb)
+ self.__engine_setup_exec_list = {}
+ button = self.__builder.get_object("button_engine_preferences")
+ button.connect("clicked", self.__button_engine_preferences_cb)
+
self.__combobox.connect("notify::active-engine", self.__combobox_notify_active_engine_cb)
self.__treeview.connect("notify", self.__treeview_notify_cb)
@@ -246,6 +250,24 @@ class Setup(object):
button = self.__builder.get_object("button_engine_add")
button.set_sensitive(engine != None and engine not in self.__treeview.get_engines())
+ def __get_engine_setup_exec_args(self, engine):
+ args = []
+ if engine == None:
+ return args
+ setup = str(engine.setup)
+ if len(setup) != 0:
+ args = setup.split()
+ args.insert(1, path.basename(args[0]))
+ return args
+ name = str(engine.name)
+ libexecdir = os.environ['IBUS_LIBEXECDIR']
+ setup_path = (libexecdir + '/' + 'ibus-setup-' if libexecdir != None \
+ else 'ibus-setup-') + name.split(':')[0]
+ if path.exists(setup_path):
+ args.append(setup_path)
+ args.append(path.basename(setup_path))
+ return args
+
def __treeview_notify_cb(self, treeview, property):
if property.name != "active-engine" and property.name != "engines":
return
@@ -258,6 +280,12 @@ class Setup(object):
self.__builder.get_object("button_engine_up").set_sensitive(engine not in engines[:1])
self.__builder.get_object("button_engine_down").set_sensitive(engine not in engines[-1:])
+ obj = self.__builder.get_object("button_engine_preferences")
+ if len(self.__get_engine_setup_exec_args(engine)) != 0:
+ obj.set_sensitive(True)
+ else:
+ obj.set_sensitive(False)
+
if property.name == "engines":
engine_names = map(lambda e: e.name, engines)
self.__config.set_list("general", "preload_engines", engine_names, "s")
@@ -273,6 +301,24 @@ class Setup(object):
about.run()
about.destroy()
+ def __button_engine_preferences_cb(self, button):
+ engine = self.__treeview.get_active_engine()
+ args = self.__get_engine_setup_exec_args(engine)
+ if len(args) == 0:
+ return
+ name = engine.name
+ if name in self.__engine_setup_exec_list.keys():
+ try:
+ wpid, sts = os.waitpid(self.__engine_setup_exec_list[name],
+ os.WNOHANG)
+ # the setup is still running.
+ if wpid == 0:
+ return
+ except OSError:
+ pass
+ del self.__engine_setup_exec_list[name]
+ self.__engine_setup_exec_list[name] = os.spawnl(os.P_NOWAIT, *args)
+
def __init_bus(self):
try:
self.__bus = ibus.Bus()
diff --git a/setup/setup.ui b/setup/setup.ui
index 0a69df8..c7ff564 100644
--- a/setup/setup.ui
+++ b/setup/setup.ui
@@ -726,6 +726,22 @@
<property name="position">4</property>
</packing>
</child>
+ <child>
+ <object class="GtkButton" id="button_engine_preferences">
+ <property name="label">gtk-preferences</property>
+ <property name="visible">True</property>
+ <property name="sensitive">False</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="tooltip_text" translatable="yes">Show setup of the selected input method</property>
+ <property name="use_stock">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">5</property>
+ </packing>
+ </child>
</object>
</child>
</object>
diff --git a/src/ibusenginedesc.c b/src/ibusenginedesc.c
index fa3a768..48ecb07 100644
--- a/src/ibusenginedesc.c
+++ b/src/ibusenginedesc.c
@@ -40,6 +40,7 @@ enum {
PROP_RANK,
PROP_HOTKEYS,
PROP_SYMBOL,
+ PROP_SETUP,
};
@@ -56,6 +57,7 @@ struct _IBusEngineDescPrivate {
guint rank;
gchar *hotkeys;
gchar *symbol;
+ gchar *setup;
};
#define IBUS_ENGINE_DESC_GET_PRIVATE(o) \
@@ -247,6 +249,19 @@ ibus_engine_desc_class_init (IBusEngineDescClass *class)
"The icon symbol chars of engine description",
"",
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+
+ /**
+ * IBusEngineDesc:setup:
+ *
+ * The exec lists of the engine setup command
+ */
+ g_object_class_install_property (gobject_class,
+ PROP_SETUP,
+ g_param_spec_string ("setup",
+ "setup args",
+ "The exec lists of the engine setup command",
+ "",
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
}
static void
@@ -265,6 +280,7 @@ ibus_engine_desc_init (IBusEngineDesc *desc)
desc->priv->rank = 0;
desc->priv->hotkeys = NULL;
desc->priv->symbol = NULL;
+ desc->priv->setup = NULL;
}
static void
@@ -280,6 +296,7 @@ ibus_engine_desc_destroy (IBusEngineDesc *desc)
g_free (desc->priv->layout);
g_free (desc->priv->hotkeys);
g_free (desc->priv->symbol);
+ g_free (desc->priv->setup);
IBUS_OBJECT_CLASS (ibus_engine_desc_parent_class)->destroy (IBUS_OBJECT (desc));
}
@@ -334,6 +351,10 @@ ibus_engine_desc_set_property (IBusEngineDesc *desc,
g_assert (desc->priv->symbol == NULL);
desc->priv->symbol = g_value_dup_string (value);
break;
+ case PROP_SETUP:
+ g_assert (desc->priv->setup == NULL);
+ desc->priv->setup = g_value_dup_string (value);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (desc, prop_id, pspec);
}
@@ -379,6 +400,9 @@ ibus_engine_desc_get_property (IBusEngineDesc *desc,
case PROP_SYMBOL:
g_value_set_string (value, ibus_engine_desc_get_symbol (desc));
break;
+ case PROP_SETUP:
+ g_value_set_string (value, ibus_engine_desc_get_setup (desc));
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (desc, prop_id, pspec);
}
@@ -410,6 +434,7 @@ ibus_engine_desc_serialize (IBusEngineDesc *desc,
g_variant_builder_add (builder, "u", desc->priv->rank);
g_variant_builder_add (builder, "s", NOTNULL (desc->priv->hotkeys));
g_variant_builder_add (builder, "s", NOTNULL (desc->priv->symbol));
+ g_variant_builder_add (builder, "s", NOTNULL (desc->priv->setup));
#undef NOTNULL
return TRUE;
@@ -439,6 +464,7 @@ ibus_engine_desc_deserialize (IBusEngineDesc *desc,
g_variant_get_child (variant, retval++, "u", &desc->priv->rank);
g_variant_get_child (variant, retval++, "s", &desc->priv->hotkeys);
g_variant_get_child (variant, retval++, "s", &desc->priv->symbol);
+ g_variant_get_child (variant, retval++, "s", &desc->priv->setup);
return retval;
}
@@ -464,6 +490,7 @@ ibus_engine_desc_copy (IBusEngineDesc *dest,
dest->priv->rank = src->priv->rank;
dest->priv->hotkeys = g_strdup (src->priv->hotkeys);
dest->priv->symbol = g_strdup (src->priv->symbol);
+ dest->priv->setup = g_strdup (src->priv->setup);
return TRUE;
}
@@ -502,6 +529,7 @@ ibus_engine_desc_output (IBusEngineDesc *desc,
OUTPUT_ENTRY_1(layout);
OUTPUT_ENTRY_1(hotkeys);
OUTPUT_ENTRY_1(symbol);
+ OUTPUT_ENTRY_1(setup);
g_string_append_indent (output, indent + 1);
g_string_append_printf (output, "<rank>%u</rank>\n", desc->priv->rank);
#undef OUTPUT_ENTRY
@@ -536,6 +564,7 @@ ibus_engine_desc_parse_xml_node (IBusEngineDesc *desc,
PARSE_ENTRY_1(layout);
PARSE_ENTRY_1(hotkeys);
PARSE_ENTRY_1(symbol);
+ PARSE_ENTRY_1(setup);
#undef PARSE_ENTRY
#undef PARSE_ENTRY_1
if (g_strcmp0 (sub_node->name , "rank") == 0) {
@@ -565,6 +594,7 @@ IBUS_ENGINE_DESC_GET_PROPERTY (layout, const gchar *)
IBUS_ENGINE_DESC_GET_PROPERTY (rank, guint)
IBUS_ENGINE_DESC_GET_PROPERTY (hotkeys, const gchar *)
IBUS_ENGINE_DESC_GET_PROPERTY (symbol, const gchar *)
+IBUS_ENGINE_DESC_GET_PROPERTY (setup, const gchar *)
#undef IBUS_ENGINE_DESC_GET_PROPERTY
IBusEngineDesc *
@@ -613,6 +643,7 @@ ibus_engine_desc_new_varargs (const gchar *first_property_name, ...)
g_assert (desc->priv->layout);
g_assert (desc->priv->hotkeys);
g_assert (desc->priv->symbol);
+ g_assert (desc->priv->setup);
return desc;
}
diff --git a/src/ibusenginedesc.h b/src/ibusenginedesc.h
index 76a7adc..928743e 100644
--- a/src/ibusenginedesc.h
+++ b/src/ibusenginedesc.h
@@ -255,8 +255,16 @@ const gchar *ibus_engine_desc_get_hotkeys (IBusEngineDesc *info);
*
* Return the symbol property in IBusEngineDesc. It should not be freed.
*/
-const gchar *ibus_engine_desc_get_symbol
- (IBusEngineDesc *info);
+const gchar *ibus_engine_desc_get_symbol (IBusEngineDesc *info);
+
+/**
+ * ibus_engine_desc_get_setup:
+ * @info: An IBusEngineDesc
+ * @returns: setup property in IBusEngineDesc
+ *
+ * Return the setup property in IBusEngineDesc. It should not be freed.
+ */
+const gchar *ibus_engine_desc_get_setup (IBusEngineDesc *info);
/**
* ibus_engine_desc_output:
--
1.7.6.4
From fd07a5a761fe1c242ba8babaab1060d5679a3618 Mon Sep 17 00:00:00 2001
From: fujiwarat <takao.fujiwara1@gmail.com>
Date: Tue, 20 Dec 2011 13:46:45 +0900
Subject: [PATCH] Fix a SEGV if ibusimcontext->ibuscontext is null.
BUG=
TEST=Linux desktop
Review URL: http://codereview.appspot.com/5489086
---
client/gtk2/ibusimcontext.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/client/gtk2/ibusimcontext.c b/client/gtk2/ibusimcontext.c
index 5ae5cfc..72db581 100644
--- a/client/gtk2/ibusimcontext.c
+++ b/client/gtk2/ibusimcontext.c
@@ -273,6 +273,7 @@ _request_surrounding_text (IBusIMContext *context)
{
if (context && context->enable &&
(context->caps & IBUS_CAP_SURROUNDING_TEXT) != 0 &&
+ context->ibuscontext != NULL &&
ibus_input_context_needs_surrounding_text (context->ibuscontext)) {
gboolean return_value;
IDEBUG ("requesting surrounding text");
--
1.7.7
From ee9c4fba4535e85bd1f02743cab8914dd84e6178 Mon Sep 17 00:00:00 2001
From: Peng Huang <shawn.p.huang@gmail.com>
Date: Thu, 22 Dec 2011 09:57:01 -0500
Subject: [PATCH] Make all fields of IBusProperty as gobject property.
BUG=http://code.google.com/p/ibus/issues/detail?id=1383
TEST=Linux desktop
Review URL: http://codereview.appspot.com/5500066
---
src/ibusproperty.c | 471 +++++++++++++++++++++++++++++++++++++++------------
src/ibusproperty.h | 41 ++---
2 files changed, 376 insertions(+), 136 deletions(-)
diff --git a/src/ibusproperty.c b/src/ibusproperty.c
index 5a2dd78..e5480fa 100644
--- a/src/ibusproperty.c
+++ b/src/ibusproperty.c
@@ -21,8 +21,52 @@
*/
#include "ibusproperty.h"
#include "ibusproplist.h"
+#include "ibusenumtypes.h"
+
+enum {
+ LAST_SIGNAL,
+};
+
+enum {
+ PROP_0 = 0,
+ PROP_KEY,
+ PROP_ICON,
+ PROP_LABEL,
+ PROP_TOOLTIP,
+ PROP_SENSITIVE,
+ PROP_VISIBLE,
+ PROP_PROP_TYPE,
+ PROP_STATE,
+ PROP_SUB_PROPS,
+};
+
+/* _IBusPropertyPrivate */
+struct _IBusPropertyPrivate {
+ gchar *key;
+ gchar *icon;
+ IBusText *label;
+ IBusText *tooltip;
+
+ gboolean sensitive;
+ gboolean visible;
+ IBusPropType type;
+ IBusPropState state;
+
+ IBusPropList *sub_props;
+};
+
+#define IBUS_PROPERTY_GET_PRIVATE(o) \
+ (G_TYPE_INSTANCE_GET_PRIVATE ((o), IBUS_TYPE_PROPERTY, IBusPropertyPrivate))
/* functions prototype */
+static void ibus_property_set_property (IBusProperty *prop,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec);
+static void ibus_property_get_property (IBusProperty *prop,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec);
static void ibus_property_destroy (IBusProperty *prop);
static gboolean ibus_property_serialize (IBusProperty *prop,
GVariantBuilder *builder);
@@ -36,53 +80,253 @@ G_DEFINE_TYPE (IBusProperty, ibus_property, IBUS_TYPE_SERIALIZABLE)
static void
ibus_property_class_init (IBusPropertyClass *class)
{
+ GObjectClass *gobject_class = G_OBJECT_CLASS (class);
IBusObjectClass *object_class = IBUS_OBJECT_CLASS (class);
IBusSerializableClass *serializable_class = IBUS_SERIALIZABLE_CLASS (class);
+ g_type_class_add_private (class, sizeof (IBusPropertyPrivate));
+
+ gobject_class->set_property = (GObjectSetPropertyFunc) ibus_property_set_property;
+ gobject_class->get_property = (GObjectGetPropertyFunc) ibus_property_get_property;
+
object_class->destroy = (IBusObjectDestroyFunc) ibus_property_destroy;
serializable_class->serialize = (IBusSerializableSerializeFunc) ibus_property_serialize;
serializable_class->deserialize = (IBusSerializableDeserializeFunc) ibus_property_deserialize;
serializable_class->copy = (IBusSerializableCopyFunc) ibus_property_copy;
+
+ /* install properties */
+ /**
+ * IBusPropert:key:
+ *
+ * The key of property
+ */
+ g_object_class_install_property (gobject_class,
+ PROP_KEY,
+ g_param_spec_string ("key",
+ "key",
+ "The key of property",
+ "",
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+
+ /**
+ * IBusPropert:icon:
+ *
+ * The icon of property
+ */
+ g_object_class_install_property (gobject_class,
+ PROP_ICON,
+ g_param_spec_string ("icon",
+ "icon",
+ "The icon of property",
+ "",
+ G_PARAM_READWRITE));
+
+ /**
+ * IBusPropert:label:
+ *
+ * The label of property
+ */
+ g_object_class_install_property (gobject_class,
+ PROP_LABEL,
+ g_param_spec_object("label",
+ "label",
+ "The label of property",
+ IBUS_TYPE_TEXT,
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
+
+ /**
+ * IBusPropert:tooltip:
+ *
+ * The tooltip of property
+ */
+ g_object_class_install_property (gobject_class,
+ PROP_TOOLTIP,
+ g_param_spec_object("tooltip",
+ "tooltip",
+ "The tooltip of property",
+ IBUS_TYPE_TEXT,
+ G_PARAM_READWRITE));
+
+ /**
+ * IBusPropert:sensitive:
+ *
+ * The sensitive of property
+ */
+ g_object_class_install_property (gobject_class,
+ PROP_SENSITIVE,
+ g_param_spec_boolean("sensitive",
+ "sensitive",
+ "The sensitive of property",
+ TRUE,
+ G_PARAM_READWRITE));
+
+ /**
+ * IBusPropert:visible:
+ *
+ * The visible of property
+ */
+ g_object_class_install_property (gobject_class,
+ PROP_VISIBLE,
+ g_param_spec_boolean("visible",
+ "visible",
+ "The visible of property",
+ TRUE,
+ G_PARAM_READWRITE));
+
+ /**
+ * IBusPropert:type:
+ *
+ * The type of property
+ */
+ g_object_class_install_property (gobject_class,
+ PROP_PROP_TYPE,
+ g_param_spec_enum("prop-type",
+ "prop-type",
+ "The type of property",
+ IBUS_TYPE_PROP_TYPE,
+ PROP_TYPE_NORMAL,
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+ /**
+ * IBusPropert:state:
+ *
+ * The state of property
+ */
+ g_object_class_install_property (gobject_class,
+ PROP_STATE,
+ g_param_spec_enum("state",
+ "state",
+ "The state of property",
+ IBUS_TYPE_PROP_STATE,
+ PROP_STATE_UNCHECKED,
+ G_PARAM_READWRITE));
+
+ /**
+ * IBusPropert:sub-props:
+ *
+ * The sub properties of property
+ */
+ g_object_class_install_property (gobject_class,
+ PROP_SUB_PROPS,
+ g_param_spec_object("sub-props",
+ "sub properties",
+ "The sub properties of property",
+ IBUS_TYPE_PROP_LIST,
+ G_PARAM_READWRITE));
}
static void
ibus_property_init (IBusProperty *prop)
{
- prop->key = NULL;
- prop->type = 0;
- prop->label = NULL;
- prop->icon = NULL;
- prop->tooltip = NULL;
- prop->sensitive = FALSE;
- prop->visible = FALSE;
- prop->state = 0;
-
- prop->sub_props = NULL;
+ prop->priv = IBUS_PROPERTY_GET_PRIVATE (prop);
+
+ ibus_property_set_label (prop, NULL);
+ ibus_property_set_tooltip (prop, NULL);
+ ibus_property_set_sub_props (prop, NULL);
+
+}
+static void
+ibus_property_set_property (IBusProperty *prop,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ switch (prop_id) {
+ case PROP_KEY:
+ g_assert (prop->priv->key == NULL);
+ prop->priv->key = g_value_dup_string (value);
+ break;
+ case PROP_ICON:
+ ibus_property_set_icon (prop, g_value_get_string (value));
+ break;
+ case PROP_LABEL:
+ ibus_property_set_label (prop, g_value_get_object (value));
+ break;
+ case PROP_TOOLTIP:
+ ibus_property_set_tooltip (prop, g_value_get_object (value));
+ break;
+ case PROP_SENSITIVE:
+ ibus_property_set_sensitive (prop, g_value_get_boolean (value));
+ break;
+ case PROP_VISIBLE:
+ ibus_property_set_visible (prop, g_value_get_boolean (value));
+ break;
+ case PROP_PROP_TYPE:
+ prop->priv->type = g_value_get_enum (value);
+ break;
+ case PROP_STATE:
+ ibus_property_set_state (prop, g_value_get_enum (value));
+ break;
+ case PROP_SUB_PROPS:
+ ibus_property_set_sub_props (prop,
+ (IBusPropList *)g_value_get_object (value));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (prop, prop_id, pspec);
+ }
+}
+
+static void
+ibus_property_get_property (IBusProperty *prop,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ switch (prop_id) {
+ case PROP_KEY:
+ g_value_set_string (value, ibus_property_get_key (prop));
+ break;
+ case PROP_ICON:
+ g_value_set_string (value, ibus_property_get_icon (prop));
+ break;
+ case PROP_LABEL:
+ g_value_set_object (value, ibus_property_get_label (prop));
+ break;
+ case PROP_TOOLTIP:
+ g_value_set_object (value, ibus_property_get_tooltip (prop));
+ break;
+ case PROP_SENSITIVE:
+ g_value_set_boolean (value, ibus_property_get_sensitive (prop));
+ break;
+ case PROP_VISIBLE:
+ g_value_set_boolean (value, ibus_property_get_visible (prop));
+ break;
+ case PROP_PROP_TYPE:
+ g_value_set_enum (value, ibus_property_get_prop_type (prop));
+ break;
+ case PROP_STATE:
+ g_value_set_enum (value, ibus_property_get_state (prop));
+ break;
+ case PROP_SUB_PROPS:
+ g_value_set_object (value, ibus_property_get_sub_props (prop));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (prop, prop_id, pspec);
+ }
}
static void
ibus_property_destroy (IBusProperty *prop)
{
- g_free (prop->key);
- prop->key = NULL;
+ g_free (prop->priv->key);
+ prop->priv->key = NULL;
- g_free (prop->icon);
- prop->icon = NULL;
+ g_free (prop->priv->icon);
+ prop->priv->icon = NULL;
- if (prop->label) {
- g_object_unref (prop->label);
- prop->label = NULL;
+ if (prop->priv->label) {
+ g_object_unref (prop->priv->label);
+ prop->priv->label = NULL;
}
- if (prop->tooltip) {
- g_object_unref (prop->tooltip);
- prop->tooltip = NULL;
+ if (prop->priv->tooltip) {
+ g_object_unref (prop->priv->tooltip);
+ prop->priv->tooltip = NULL;
}
- if (prop->sub_props) {
- g_object_unref (prop->sub_props);
- prop->sub_props = NULL;
+ if (prop->priv->sub_props) {
+ g_object_unref (prop->priv->sub_props);
+ prop->priv->sub_props = NULL;
}
IBUS_OBJECT_CLASS (ibus_property_parent_class)->destroy ((IBusObject *)prop);
@@ -99,15 +343,18 @@ ibus_property_serialize (IBusProperty *prop,
g_return_val_if_fail (IBUS_IS_PROPERTY (prop), FALSE);
- g_variant_builder_add (builder, "s", prop->key);
- g_variant_builder_add (builder, "u", prop->type);
- g_variant_builder_add (builder, "v", ibus_serializable_serialize ((IBusSerializable *)prop->label));
- g_variant_builder_add (builder, "s", prop->icon);
- g_variant_builder_add (builder, "v", ibus_serializable_serialize ((IBusSerializable *)prop->tooltip));
- g_variant_builder_add (builder, "b", prop->sensitive);
- g_variant_builder_add (builder, "b", prop->visible);
- g_variant_builder_add (builder, "u", prop->state);
- g_variant_builder_add (builder, "v", ibus_serializable_serialize ((IBusSerializable *)prop->sub_props));
+ g_variant_builder_add (builder, "s", prop->priv->key);
+ g_variant_builder_add (builder, "u", prop->priv->type);
+ g_variant_builder_add (builder, "v",
+ ibus_serializable_serialize ((IBusSerializable *)prop->priv->label));
+ g_variant_builder_add (builder, "s", prop->priv->icon);
+ g_variant_builder_add (builder, "v",
+ ibus_serializable_serialize ((IBusSerializable *)prop->priv->tooltip));
+ g_variant_builder_add (builder, "b", prop->priv->sensitive);
+ g_variant_builder_add (builder, "b", prop->priv->visible);
+ g_variant_builder_add (builder, "u", prop->priv->state);
+ g_variant_builder_add (builder, "v",
+ ibus_serializable_serialize ((IBusSerializable *)prop->priv->sub_props));
return TRUE;
}
@@ -121,28 +368,28 @@ ibus_property_deserialize (IBusProperty *prop,
retval = IBUS_SERIALIZABLE_CLASS (ibus_property_parent_class)->deserialize ((IBusSerializable *) prop, variant);
g_return_val_if_fail (retval, 0);
- g_variant_get_child (variant, retval++, "s", &prop->key);
- g_variant_get_child (variant, retval++, "u", &prop->type);
+ g_variant_get_child (variant, retval++, "s", &prop->priv->key);
+ g_variant_get_child (variant, retval++, "u", &prop->priv->type);
GVariant *subvar = g_variant_get_child_value (variant, retval++);
- prop->label = IBUS_TEXT (ibus_serializable_deserialize (subvar));
- g_object_ref_sink (prop->label);
+ prop->priv->label = IBUS_TEXT (ibus_serializable_deserialize (subvar));
+ g_object_ref_sink (prop->priv->label);
g_variant_unref (subvar);
- g_variant_get_child (variant, retval++, "s", &prop->icon);
+ g_variant_get_child (variant, retval++, "s", &prop->priv->icon);
subvar = g_variant_get_child_value (variant, retval++);
- prop->tooltip = IBUS_TEXT (ibus_serializable_deserialize (subvar));
- g_object_ref_sink (prop->tooltip);
+ prop->priv->tooltip = IBUS_TEXT (ibus_serializable_deserialize (subvar));
+ g_object_ref_sink (prop->priv->tooltip);
g_variant_unref (subvar);
- g_variant_get_child (variant, retval++, "b", &prop->sensitive);
- g_variant_get_child (variant, retval++, "b", &prop->visible);
- g_variant_get_child (variant, retval++, "u", &prop->state);
+ g_variant_get_child (variant, retval++, "b", &prop->priv->sensitive);
+ g_variant_get_child (variant, retval++, "b", &prop->priv->visible);
+ g_variant_get_child (variant, retval++, "u", &prop->priv->state);
subvar = g_variant_get_child_value (variant, retval++);
- prop->sub_props = IBUS_PROP_LIST (ibus_serializable_deserialize (subvar));
- g_object_ref_sink (prop->sub_props);
+ prop->priv->sub_props = IBUS_PROP_LIST (ibus_serializable_deserialize (subvar));
+ g_object_ref_sink (prop->priv->sub_props);
g_variant_unref (subvar);
return retval;
@@ -160,25 +407,25 @@ ibus_property_copy (IBusProperty *dest,
g_return_val_if_fail (IBUS_IS_PROPERTY (dest), FALSE);
g_return_val_if_fail (IBUS_IS_PROPERTY (src), FALSE);
- dest->key = g_strdup (src->key);
- dest->icon = g_strdup (src->icon);
- if (src->label) {
- dest->label = (IBusText *) ibus_serializable_copy ((IBusSerializable *) src->label);
+ dest->priv->key = g_strdup (src->priv->key);
+ dest->priv->icon = g_strdup (src->priv->icon);
+ if (src->priv->label) {
+ dest->priv->label = (IBusText *) ibus_serializable_copy ((IBusSerializable *) src->priv->label);
}
else
- dest->label = ibus_text_new_from_static_string ("");
- if (src->tooltip) {
- dest->tooltip = (IBusText *) ibus_serializable_copy ((IBusSerializable *) src->tooltip);
+ dest->priv->label = ibus_text_new_from_static_string ("");
+ if (src->priv->tooltip) {
+ dest->priv->tooltip = (IBusText *) ibus_serializable_copy ((IBusSerializable *) src->priv->tooltip);
}
else
- dest->tooltip = ibus_text_new_from_static_string ("");
+ dest->priv->tooltip = ibus_text_new_from_static_string ("");
- dest->sensitive = src->sensitive;
- dest->visible = src->visible;
- dest->type = src->type;
- dest->state = src->state;
+ dest->priv->sensitive = src->priv->sensitive;
+ dest->priv->visible = src->priv->visible;
+ dest->priv->type = src->priv->type;
+ dest->priv->state = src->priv->state;
- dest->sub_props = (IBusPropList *) ibus_serializable_copy ((IBusSerializable *) src->sub_props);
+ dest->priv->sub_props = (IBusPropList *) ibus_serializable_copy ((IBusSerializable *) src->priv->sub_props);
return TRUE;
}
@@ -192,7 +439,7 @@ ibus_property_new (const gchar *key,
gboolean sensitive,
gboolean visible,
IBusPropState state,
- IBusPropList *prop_list)
+ IBusPropList *props)
{
g_return_val_if_fail (key != NULL, NULL);
g_return_val_if_fail (type >= PROP_TYPE_NORMAL &&
@@ -201,19 +448,17 @@ ibus_property_new (const gchar *key,
IBusProperty *prop;
- prop = (IBusProperty *)g_object_new (IBUS_TYPE_PROPERTY, NULL);
-
- prop->key = g_strdup (key);
- prop->type = type;
-
- ibus_property_set_label (prop, label);
- ibus_property_set_icon (prop, icon);
- ibus_property_set_tooltip (prop, tooltip);
- ibus_property_set_sensitive (prop, sensitive);
- ibus_property_set_visible (prop, visible);
- ibus_property_set_state (prop, state);
- ibus_property_set_sub_props (prop, prop_list);
-
+ prop = (IBusProperty *)g_object_new (IBUS_TYPE_PROPERTY,
+ "key", key,
+ "prop-type", type,
+ "label", label,
+ "icon", icon,
+ "tooltip", tooltip,
+ "sensitive", sensitive,
+ "visible", visible,
+ "state", state,
+ "sub-props", props,
+ NULL);
return prop;
}
@@ -221,24 +466,25 @@ ibus_property_new (const gchar *key,
return_type \
ibus_property_get_ ## field (IBusProperty *prop) \
{ \
- return prop->field; \
+ return prop->priv->field; \
}
IBUS_PROPERTY_GET_FIELD (key, const gchar *)
IBUS_PROPERTY_GET_FIELD (icon, const gchar *)
-IBUS_PROPERTY_GET_FIELD (label, const IBusText *)
-IBUS_PROPERTY_GET_FIELD (tooltip, const IBusText *)
+IBUS_PROPERTY_GET_FIELD (label, IBusText *)
+IBUS_PROPERTY_GET_FIELD (tooltip, IBusText *)
IBUS_PROPERTY_GET_FIELD (sensitive, gboolean)
IBUS_PROPERTY_GET_FIELD (visible, gboolean)
IBUS_PROPERTY_GET_FIELD (state, IBusPropState)
-IBUS_PROPERTY_GET_FIELD (sub_props, const IBusPropList *)
+IBUS_PROPERTY_GET_FIELD (sub_props, IBusPropList *)
#undef IBUS_PROPERTY_GET_FIELD
/* ibus_property_get_type() exists */
IBusPropType
ibus_property_get_prop_type (IBusProperty *prop)
{
- return prop->type;
+ g_assert (IBUS_IS_PROPERTY (prop));
+ return prop->priv->type;
}
void
@@ -248,15 +494,15 @@ ibus_property_set_label (IBusProperty *prop,
g_assert (IBUS_IS_PROPERTY (prop));
g_return_if_fail (label == NULL || IBUS_IS_TEXT (label));
- if (prop->label) {
- g_object_unref (prop->label);
+ if (prop->priv->label) {
+ g_object_unref (prop->priv->label);
}
if (label == NULL) {
- prop->label = ibus_text_new_from_static_string ("");
+ prop->priv->label = ibus_text_new_from_static_string ("");
}
else {
- prop->label = g_object_ref_sink (label);
+ prop->priv->label = g_object_ref_sink (label);
}
}
@@ -266,8 +512,8 @@ ibus_property_set_icon (IBusProperty *prop,
{
g_assert (IBUS_IS_PROPERTY (prop));
- g_free (prop->icon);
- prop->icon = g_strdup (icon != NULL ? icon : "");
+ g_free (prop->priv->icon);
+ prop->priv->icon = g_strdup (icon != NULL ? icon : "");
}
void
@@ -277,17 +523,19 @@ ibus_property_set_tooltip (IBusProperty *prop,
g_assert (IBUS_IS_PROPERTY (prop));
g_assert (tooltip == NULL || IBUS_IS_TEXT (tooltip));
- if (prop->tooltip) {
- g_object_unref (prop->tooltip);
+ IBusPropertyPrivate *priv = prop->priv;
+
+ if (priv->tooltip) {
+ g_object_unref (priv->tooltip);
}
if (tooltip == NULL) {
- prop->tooltip = ibus_text_new_from_static_string ("");
- g_object_ref_sink (prop->tooltip);
+ priv->tooltip = ibus_text_new_from_static_string ("");
+ g_object_ref_sink (priv->tooltip);
}
else {
- prop->tooltip = tooltip;
- g_object_ref_sink (prop->tooltip);
+ priv->tooltip = tooltip;
+ g_object_ref_sink (priv->tooltip);
}
}
@@ -296,7 +544,7 @@ ibus_property_set_sensitive (IBusProperty *prop,
gboolean sensitive)
{
g_assert (IBUS_IS_PROPERTY (prop));
- prop->sensitive = sensitive;
+ prop->priv->sensitive = sensitive;
}
void
@@ -304,7 +552,7 @@ ibus_property_set_visible (IBusProperty *prop,
gboolean visible)
{
g_assert (IBUS_IS_PROPERTY (prop));
- prop->visible = visible;
+ prop->priv->visible = visible;
}
void
@@ -316,7 +564,7 @@ ibus_property_set_state (IBusProperty *prop,
state == PROP_STATE_CHECKED ||
state == PROP_STATE_INCONSISTENT);
- prop->state = state;
+ prop->priv->state = state;
}
void
@@ -326,17 +574,19 @@ ibus_property_set_sub_props (IBusProperty *prop,
g_assert (IBUS_IS_PROPERTY (prop));
g_assert (IBUS_IS_PROP_LIST (prop_list) || prop_list == NULL);
- if (prop->sub_props) {
- g_object_unref (prop->sub_props);
+ IBusPropertyPrivate *priv = prop->priv;
+
+ if (priv->sub_props) {
+ g_object_unref (priv->sub_props);
}
if (prop_list) {
- prop->sub_props = prop_list;
+ priv->sub_props = prop_list;
g_object_ref_sink (prop_list);
}
else {
- prop->sub_props = ibus_prop_list_new ();
- g_object_ref_sink (prop->sub_props);
+ priv->sub_props = ibus_prop_list_new ();
+ g_object_ref_sink (priv->sub_props);
}
}
@@ -347,25 +597,24 @@ ibus_property_update (IBusProperty *prop,
g_assert (IBUS_IS_PROPERTY (prop));
g_assert (IBUS_IS_PROPERTY (prop_update));
- if (g_strcmp0 (prop->key, prop_update->key) != 0) {
- return ibus_prop_list_update_property (prop->sub_props, prop_update);
+ IBusPropertyPrivate *priv = prop->priv;
+ IBusPropertyPrivate *priv_update = prop_update->priv;
+
+ if (g_strcmp0 (priv->key, priv_update->key) != 0) {
+ return ibus_prop_list_update_property (priv->sub_props, prop_update);
}
- g_free (prop->icon);
- prop->icon = g_strdup (prop_update->icon);
+ /* Do not support update prop type */
+ g_assert (priv->type == priv_update->type);
- if (prop->label) {
- g_object_unref (prop->label);
- }
- prop->label = (IBusText *) g_object_ref_sink (prop_update->label);
+ ibus_property_set_icon (prop, ibus_property_get_icon (prop_update));
+ ibus_property_set_label (prop, ibus_property_get_label (prop_update));
+ ibus_property_set_tooltip (prop, ibus_property_get_tooltip (prop_update));
+ ibus_property_set_visible (prop, ibus_property_get_visible (prop_update));
+ ibus_property_set_state (prop, ibus_property_get_state (prop_update));
+ ibus_property_set_sensitive (prop, ibus_property_get_sensitive (prop_update));
- if (prop->tooltip) {
- g_object_unref (prop->tooltip);
- }
- prop->tooltip = (IBusText *) g_object_ref_sink (prop_update->tooltip);
- prop->visible = prop_update->visible;
- prop->state = prop_update->state;
- prop->sensitive = prop_update->sensitive;
+ /* Do not support update sub props */
return TRUE;
}
diff --git a/src/ibusproperty.h b/src/ibusproperty.h
index 5e76c8f..ddbadc8 100644
--- a/src/ibusproperty.h
+++ b/src/ibusproperty.h
@@ -114,6 +114,7 @@ typedef enum {
typedef struct _IBusProperty IBusProperty;
typedef struct _IBusPropertyClass IBusPropertyClass;
+typedef struct _IBusPropertyPrivate IBusPropertyPrivate;
#ifndef __PROPLIST_DEFINED
#define __PROPLIST_DEFINED
@@ -137,20 +138,11 @@ typedef struct _IBusPropListClass IBusPropListClass;
* UI component for input method engine property.
*/
struct _IBusProperty {
+ /*< private >*/
IBusSerializable parent;
+ IBusPropertyPrivate *priv;
- /*< public >*/
- gchar *key;
- gchar *icon;
- IBusText *label;
- IBusText *tooltip;
-
- gboolean sensitive;
- gboolean visible;
- guint type;
- guint state;
-
- IBusPropList *sub_props;
+ gpointer pdummy[7];
};
struct _IBusPropertyClass {
@@ -194,22 +186,13 @@ IBusProperty *ibus_property_new (const gchar *key,
const gchar * ibus_property_get_key (IBusProperty *prop);
/**
- * ibus_property_get_prop_type:
- * @prop: An IBusProperty.
- * @returns: the type of IBusProperty.
- *
- * Get the type of IBusProperty.
- */
-IBusPropType ibus_property_get_prop_type(IBusProperty *prop);
-
-/**
* ibus_property_get_label:
* @prop: An IBusProperty.
* @returns: the label of IBusProperty. Should not be freed.
*
* Get the label of IBusProperty.
*/
-const IBusText * ibus_property_get_label (IBusProperty *prop);
+IBusText * ibus_property_get_label (IBusProperty *prop);
/**
* ibus_property_set_label:
@@ -247,7 +230,7 @@ void ibus_property_set_icon (IBusProperty *prop,
*
* Get the tooltip of IBusProperty.
*/
-const IBusText * ibus_property_get_tooltip (IBusProperty *prop);
+IBusText * ibus_property_get_tooltip (IBusProperty *prop);
/**
* ibus_property_set_tooltip:
@@ -298,6 +281,15 @@ void ibus_property_set_visible (IBusProperty *prop,
gboolean visible);
/**
+ * ibus_property_get_property_type:
+ * @prop: An IBusProperty.
+ * @returns: the type of IBusProperty.
+ *
+ * Get the type of IBusProperty.
+ */
+IBusPropType ibus_property_get_prop_type(IBusProperty *prop);
+
+/**
* ibus_property_get_state:
* @prop: An IBusProperty.
* @returns: the state of IBusProperty.
@@ -323,8 +315,7 @@ void ibus_property_set_state (IBusProperty *prop,
*
* Get the IBusPropList of IBusProperty.
*/
-const IBusPropList *
- ibus_property_get_sub_props(IBusProperty *prop);
+IBusPropList * ibus_property_get_sub_props(IBusProperty *prop);
/**
* ibus_property_set_sub_props:
--
1.7.7.4
From df10a24f905c8eea420a5fd33eff78417312410c Mon Sep 17 00:00:00 2001
From: Peng Huang <shawn.p.huang@gmail.com>
Date: Thu, 22 Dec 2011 09:57:23 -0500
Subject: [PATCH] Add ibus_text_set_attributes for scipt language
bindings.
BUG=None
TEST=Linux desktop
Review URL: http://codereview.appspot.com/5500067
---
src/ibustext.c | 12 +++++++++++-
src/ibustext.h | 13 +++++++++++--
2 files changed, 22 insertions(+), 3 deletions(-)
diff --git a/src/ibustext.c b/src/ibustext.c
index f4085e9..e5218d0 100644
--- a/src/ibustext.c
+++ b/src/ibustext.c
@@ -272,8 +272,18 @@ ibus_text_get_text (IBusText *text)
return text->text;
}
-const IBusAttrList *
+IBusAttrList *
ibus_text_get_attributes (IBusText *text)
{
return text->attrs;
}
+
+void
+ibus_text_set_attributes (IBusText *text,
+ IBusAttrList *attrs)
+{
+ if (text->attrs)
+ g_object_unref (text->attrs);
+ text->attrs = attrs;
+ g_object_ref_sink (text->attrs);
+}
diff --git a/src/ibustext.h b/src/ibustext.h
index 1dca466..f6e25a7 100644
--- a/src/ibustext.h
+++ b/src/ibustext.h
@@ -194,8 +194,17 @@ const gchar * ibus_text_get_text (IBusText *text);
*
* Return the attributes in an IBusText. Should not be freed.
*/
-const IBusAttrList *
- ibus_text_get_attributes (IBusText *text);
+IBusAttrList * ibus_text_get_attributes (IBusText *text);
+
+/**
+ * ibus_text_set_attributes:
+ * @text: An IBusText.
+ * @attrs: An IBusAttrList
+ */
+void ibus_text_set_attributes (IBusText *text,
+ IBusAttrList *attrs);
+
+
G_END_DECLS
#endif
--
1.7.7.4
From 4d1f38314b3a9c3dc1683053cda10cfa36fd9019 Mon Sep 17 00:00:00 2001
From: Peng Huang <shawn.p.huang@gmail.com>
Date: Thu, 22 Dec 2011 09:59:05 -0500
Subject: [PATCH] Fix a typo in docs/references/ibus/Makefile
BUG=None
TEST=make
Review URL: http://codereview.appspot.com/5496079
---
docs/reference/ibus/Makefile.am | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/docs/reference/ibus/Makefile.am b/docs/reference/ibus/Makefile.am
index 4fa77a1..75e3815 100644
--- a/docs/reference/ibus/Makefile.am
+++ b/docs/reference/ibus/Makefile.am
@@ -117,7 +117,7 @@ trim-build.stamp: scan-build.stamp
$(AM_V_GEN) \
$(SED) -f $(srcdir)/trim.sed -i.bak \
$(builddir)/$(DOC_MODULE)-sections.txt && \
- $(RM) $(buildir)/$(DOC_MODULE)-sections.txt.bak && \
+ $(RM) $(builddir)/$(DOC_MODULE)-sections.txt.bak && \
touch trim-build.stamp
tmpl-build.stamp: trim-build.stamp $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-overrides.txt
--
1.7.7.4
From 377cf484ea64fc2f30706d298cf1f33debdd9c30 Mon Sep 17 00:00:00 2001
From: fujiwarat <takao.fujiwara1@gmail.com>
Date: Fri, 30 Dec 2011 13:53:50 +0900
Subject: [PATCH] Fix ibus-x11 SEGV in _process_key_event_done.
IMForwardEvent() calls _Xi18nFindClient() and it could return NULL.
Maybe the connect_id would be disconnected during the async
process_key_event.
This fix checks XIM_DISCONNECT in ims_protocol_handler() to cancel
IMForwardEvent() in _process_key_event_done().
---
client/x11/main.c | 17 +++++++++++++++++
1 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/client/x11/main.c b/client/x11/main.c
index 58069fc..3cb03f0 100644
--- a/client/x11/main.c
+++ b/client/x11/main.c
@@ -77,6 +77,8 @@ struct _X11IC {
gint onspot_preedit_length;
};
+static gint disconnected_id = 0;
+
static void _xim_set_cursor_location (X11IC *x11ic);
static void _context_commit_text_cb (IBusInputContext *context,
IBusText *text,
@@ -464,6 +466,12 @@ _process_key_event_done (GObject *object,
g_error_free (error);
}
+ if (pfe->connect_id == disconnected_id) {
+ g_slice_free (IMForwardEventStruct, pfe);
+ disconnected_id = 0;
+ return;
+ }
+
if (retval == FALSE) {
IMForwardEvent (_xims, (XPointer) pfe);
}
@@ -734,6 +742,13 @@ xim_reset_ic (XIMS xims, IMResetICStruct *call_data)
return 1;
}
+static int
+xim_disconnect_ic (XIMS xims, IMDisConnectStruct *call_data)
+{
+ disconnected_id = call_data->connect_id;
+ return 0;
+}
+
int
ims_protocol_handler (XIMS xims, IMProtocol *call_data)
{
@@ -773,6 +788,8 @@ ims_protocol_handler (XIMS xims, IMProtocol *call_data)
case XIM_SYNC_REPLY:
LOG (1, "XIM_SYNC_REPLY");
return 0;
+ case XIM_DISCONNECT:
+ return xim_disconnect_ic (xims, (IMDisConnectStruct *)call_data);
default:
LOG (1, "Unkown (%d)", call_data->major_code);
return 0;
--
1.7.7.4
2011-12-30 15:17:33 +00:00
From b90c7ed47b1f84e0b0a03233e817c97dd854a5d6 Mon Sep 17 00:00:00 2001
From: fujiwarat <takao.fujiwara1@gmail.com>
Date: Sat, 31 Dec 2011 00:09:11 +0900
Subject: [PATCH] Fix g-ir-scanner errors in ibusproperty.h and ibustext.h.
---
src/ibusproperty.h | 7 ++++---
src/ibustext.h | 2 +-
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/src/ibusproperty.h b/src/ibusproperty.h
index ddbadc8..96b1a13 100644
--- a/src/ibusproperty.h
+++ b/src/ibusproperty.h
@@ -188,7 +188,7 @@ const gchar * ibus_property_get_key (IBusProperty *prop);
/**
* ibus_property_get_label:
* @prop: An IBusProperty.
- * @returns: the label of IBusProperty. Should not be freed.
+ * @returns: (transfer none): the label of IBusProperty. Should not be freed.
*
* Get the label of IBusProperty.
*/
@@ -226,7 +226,7 @@ void ibus_property_set_icon (IBusProperty *prop,
/**
* ibus_property_get_tooltip:
* @prop: An IBusProperty.
- * @returns: the tooltip of IBusProperty. Should not be freed.
+ * @returns: (transfer none): the tooltip of IBusProperty. Should not be freed.
*
* Get the tooltip of IBusProperty.
*/
@@ -311,7 +311,8 @@ void ibus_property_set_state (IBusProperty *prop,
/**
* ibus_property_get_sub_props:
* @prop: An IBusProperty.
- * @returns: the IBusPropList of IBusProperty. Should not be freed.
+ * @returns: (transfer none): the IBusPropList of IBusProperty.
+ * Should not be freed.
*
* Get the IBusPropList of IBusProperty.
*/
diff --git a/src/ibustext.h b/src/ibustext.h
index f6e25a7..23ae920 100644
--- a/src/ibustext.h
+++ b/src/ibustext.h
@@ -190,7 +190,7 @@ const gchar * ibus_text_get_text (IBusText *text);
/**
* ibus_text_get_attributes:
* @text: An IBusText.
- * @returns: the attrs in @text.
+ * @returns: (transfer none): the attrs in @text.
*
* Return the attributes in an IBusText. Should not be freed.
*/
--
1.7.7.4