Update to 1.3.2-9.

This commit is contained in:
Daiki Ueno 2011-08-08 10:15:01 +09:00
parent 5232cde180
commit ff70ed76fc
4 changed files with 60 additions and 287 deletions

View File

@ -1,43 +1,4 @@
Patch to set certain XKB options when an m17n IME is set.
Index: ibus-m17n-1.3.2/configure.ac
===================================================================
--- ibus-m17n-1.3.2.orig/configure.ac
+++ ibus-m17n-1.3.2/configure.ac
@@ -106,6 +106,14 @@ AC_CHECK_FUNCS([ibus_engine_get_surround
CFLAGS="$save_CFLAGS"
LIBS="$save_LIBS"
+# check libxklavier
+have_libxklavier=no
+PKG_CHECK_MODULES([LIBXKLAVIER], [libxklavier gdk-3.0 x11],
+ have_libxklavier=yes)
+if test x$have_libxklavier != xno; then
+ AC_DEFINE([HAVE_LIBXKLAVIER], [1], [Define if libxklavier is found])
+fi
+
# define GETTEXT_* variables
GETTEXT_PACKAGE=ibus-m17n
AC_SUBST(GETTEXT_PACKAGE)
Index: ibus-m17n-1.3.2/src/Makefile.am
===================================================================
--- ibus-m17n-1.3.2.orig/src/Makefile.am
+++ ibus-m17n-1.3.2/src/Makefile.am
@@ -66,10 +66,15 @@ ibus_engine_m17n_SOURCES = \
engine.c \
engine.h \
$(NULL)
+ibus_engine_m17n_CFLAGS = \
+ @LIBXKLAVIER_CFLAGS@ \
+ $(AM_CFLAGS) \
+ $(NULL)
ibus_engine_m17n_LDADD = \
libm17ncommon.a \
@IBUS_LIBS@ \
@M17N_LIBS@ \
+ @LIBXKLAVIER_LIBS@ \
$(NULL)
if HAVE_GTK
Index: ibus-m17n-1.3.2/src/default.xml.in.in
===================================================================
--- ibus-m17n-1.3.2.orig/src/default.xml.in.in
@ -50,21 +11,21 @@ Index: ibus-m17n-1.3.2/src/default.xml.in.in
+ <name>m17n:bn:inscript*</name>
<rank>2</rank>
<preedit-highlight>FALSE</preedit-highlight>
+ <xkb-options>lv3:ralt_switch</xkb-options>
+ <layout>default[lv3:ralt_switch]</layout>
</engine>
<engine>
- <name>m17n:gu:inscript</name>
+ <name>m17n:gu:inscript*</name>
<rank>2</rank>
<preedit-highlight>FALSE</preedit-highlight>
+ <xkb-options>lv3:ralt_switch</xkb-options>
+ <layout>default[lv3:ralt_switch]</layout>
</engine>
<engine>
- <name>m17n:hi:inscript</name>
+ <name>m17n:hi:inscript*</name>
<rank>2</rank>
<preedit-highlight>FALSE</preedit-highlight>
+ <xkb-options>lv3:ralt_switch</xkb-options>
+ <layout>default[lv3:ralt_switch]</layout>
</engine>
<engine>
<name>m17n:kn:kgp</name>
@ -76,21 +37,21 @@ Index: ibus-m17n-1.3.2/src/default.xml.in.in
+ <name>m17n:mai:inscript*</name>
<rank>2</rank>
<preedit-highlight>FALSE</preedit-highlight>
+ <xkb-options>lv3:ralt_switch</xkb-options>
+ <layout>default[lv3:ralt_switch]</layout>
</engine>
<engine>
- <name>m17n:ml:inscript</name>
+ <name>m17n:ml:inscript*</name>
<rank>2</rank>
<preedit-highlight>FALSE</preedit-highlight>
+ <xkb-options>lv3:ralt_switch</xkb-options>
+ <layout>default[lv3:ralt_switch]</layout>
</engine>
<engine>
- <name>m17n:mr:inscript</name>
+ <name>m17n:mr:inscript*</name>
<rank>2</rank>
<preedit-highlight>FALSE</preedit-highlight>
+ <xkb-options>lv3:ralt_switch</xkb-options>
+ <layout>default[lv3:ralt_switch]</layout>
</engine>
<engine>
<name>m17n:ne:rom</name>
@ -102,14 +63,14 @@ Index: ibus-m17n-1.3.2/src/default.xml.in.in
+ <name>m17n:or:inscript*</name>
<rank>2</rank>
<preedit-highlight>FALSE</preedit-highlight>
+ <xkb-options>lv3:ralt_switch</xkb-options>
+ <layout>default[lv3:ralt_switch]</layout>
</engine>
<engine>
- <name>m17n:pa:inscript</name>
+ <name>m17n:pa:inscript*</name>
<rank>2</rank>
<preedit-highlight>FALSE</preedit-highlight>
+ <xkb-options>lv3:ralt_switch</xkb-options>
+ <layout>default[lv3:ralt_switch]</layout>
</engine>
<engine>
<name>m17n:sa:harvard-kyoto</name>
@ -121,13 +82,13 @@ Index: ibus-m17n-1.3.2/src/default.xml.in.in
+ <name>m17n:sd:inscript*</name>
<rank>2</rank>
<preedit-highlight>FALSE</preedit-highlight>
+ <xkb-options>lv3:ralt_switch</xkb-options>
+ <layout>default[lv3:ralt_switch]</layout>
</engine>
<engine>
<name>m17n:si:wijesekera</name>
<rank>2</rank>
<preedit-highlight>FALSE</preedit-highlight>
+ <xkb-options>lv3:ralt_switch</xkb-options>
+ <layout>default[lv3:ralt_switch]</layout>
</engine>
<engine>
<name>m17n:ta:tamil99</name>
@ -139,7 +100,7 @@ Index: ibus-m17n-1.3.2/src/default.xml.in.in
+ <name>m17n:te:inscript*</name>
<rank>2</rank>
<preedit-highlight>FALSE</preedit-highlight>
+ <xkb-options>lv3:ralt_switch</xkb-options>
+ <layout>default[lv3:ralt_switch]</layout>
</engine>
<!-- Samanala should have lower rank than other Sinhala
engines since it is the only non-keyboard input method in
@ -147,232 +108,46 @@ Index: ibus-m17n-1.3.2/src/default.xml.in.in
<name>m17n:si:*</name>
<rank>1</rank>
<preedit-highlight>FALSE</preedit-highlight>
+ <xkb-options>lv3:ralt_switch</xkb-options>
+ <layout>default[lv3:ralt_switch]</layout>
</engine>
<engine>
<name>m17n:ta:*</name>
Index: ibus-m17n-1.3.2/src/engine.c
===================================================================
--- ibus-m17n-1.3.2.orig/src/engine.c
+++ ibus-m17n-1.3.2/src/engine.c
@@ -6,6 +6,10 @@
#include <ibus.h>
#include <m17n.h>
#include <string.h>
+#ifdef HAVE_LIBXKLAVIER
+#include <gdk/gdkx.h>
+#include <libxklavier/xklavier.h>
+#endif /* HAVE_LIBXKLAVIER */
#include "m17nutil.h"
#include "engine.h"
@@ -38,6 +42,10 @@ struct _IBusM17NEngineClass {
gboolean use_iok;
MInputMethod *im;
+
+#if HAVE_LIBXKLAVIER
+ XklConfigRec *xkl_config_rec;
+#endif /* HAVE_LIBXKLAVIER */
};
/* functions prototype */
@@ -105,12 +113,90 @@ static IBusEngineClass *parent_class = N
static IBusConfig *config = NULL;
+#if HAVE_LIBXKLAVIER
+static XklEngine *xkl_engine = NULL;
+static XklConfigRec *xkl_system_config_rec = NULL;
+
+static gboolean
+parse_xkb_options (XklConfigRec *config_rec, const gchar *xkb_options)
+{
+ gchar **strv;
+
+ strv = g_strsplit (xkb_options, ",", -1);
+ if (g_strv_length (strv) < 1) {
+ g_strfreev (strv);
+ return FALSE;
+ }
+
+ g_strfreev (config_rec->options);
+ config_rec->options = strv;
+
+ return TRUE;
+}
+
+static GdkFilterReturn
+filter_xkl_event (GdkXEvent *xev,
+ GdkEvent *event,
+ gpointer user_data)
+{
+ XEvent *xevent = (XEvent *)xev;
+
+ xkl_engine_filter_events (xkl_engine, xevent);
+ return GDK_FILTER_CONTINUE;
+}
+
+static void
+on_xkl_config_changed (XklEngine *xklengine,
+ gpointer user_data)
+{
+ IBusM17NEngineClass *klass = user_data;
+ XklConfigRec *config_rec;
+
+ config_rec = xkl_config_rec_new ();
+ if (!xkl_config_rec_get_from_server (config_rec, xkl_engine)) {
+ g_object_unref (config_rec);
+ g_warning ("Can't get default keyboard config from the server");
+ } else if (klass->xkl_config_rec &&
+ !xkl_config_rec_equals (config_rec, klass->xkl_config_rec)) {
+ if (xkl_system_config_rec)
+ g_object_unref (xkl_system_config_rec);
+ xkl_system_config_rec = config_rec;
+ }
+}
+#endif /* HAVE_LIBXKLAVIER */
+
void
ibus_m17n_init (IBusBus *bus)
{
+#if HAVE_LIBXKLAVIER
+ if (gdk_init_check (NULL, NULL)) {
+ GdkDisplay *display = gdk_display_get_default ();
+ g_assert (display);
+
+ xkl_engine = xkl_engine_get_instance (GDK_DISPLAY_XDISPLAY (display));
+ xkl_system_config_rec = xkl_config_rec_new ();
+ if (!xkl_config_rec_get_from_server (xkl_system_config_rec,
+ xkl_engine)) {
+ g_object_unref (xkl_system_config_rec);
+ xkl_system_config_rec = NULL;
+
+ g_warning ("Can't get default keyboard config from the server");
+ } else {
+ gdk_window_add_filter (NULL,
+ (GdkFilterFunc) filter_xkl_event,
+ NULL);
+ gdk_window_add_filter (gdk_get_default_root_window (),
+ (GdkFilterFunc) filter_xkl_event,
+ NULL);
+ xkl_engine_start_listen (xkl_engine, XKLL_TRACK_KEYBOARD_STATE);
+ }
+ }
+#endif /* HAVE_LIBXKLAVIER */
+
config = ibus_bus_get_config (bus);
if (config)
g_object_ref_sink (config);
+
ibus_m17n_init_common ();
}
@@ -299,6 +385,27 @@ ibus_m17n_engine_class_init (IBusM17NEng
G_CALLBACK(ibus_m17n_config_value_changed),
klass);
+#if HAVE_LIBXKLAVIER
+ if (engine_config->xkb_options) {
+ klass->xkl_config_rec = xkl_config_rec_new ();
+ if (!xkl_config_rec_get_from_server (klass->xkl_config_rec,
+ xkl_engine)) {
+ g_object_unref (klass->xkl_config_rec);
+ klass->xkl_config_rec = NULL;
+ g_warning ("Can't get default keyboard config from the server");
+ } else if (!parse_xkb_options (klass->xkl_config_rec,
+ engine_config->xkb_options)) {
+ g_object_unref (klass->xkl_config_rec);
+ klass->xkl_config_rec = NULL;
+ g_warning ("Can't parse xkb options %s",
+ engine_config->xkb_options);
+ }
+ }
+
+ g_signal_connect (xkl_engine, "X-config-changed",
+ G_CALLBACK(on_xkl_config_changed), klass);
+#endif /* HAVE_LIBXKLAVIER */
+
klass->im = NULL;
}
@@ -499,6 +606,11 @@ ibus_m17n_engine_destroy (IBusM17NEngine
m17n->context = NULL;
}
+#if HAVE_LIBXKLAVIER
+ if (xkl_system_config_rec)
+ xkl_config_rec_activate (xkl_system_config_rec, xkl_engine);
+#endif /* HAVE_LIBXKLAVIER */
+
IBUS_OBJECT_CLASS (parent_class)->destroy ((IBusObject *)m17n);
}
@@ -735,6 +847,19 @@ ibus_m17n_engine_enable (IBusEngine *eng
ibus_engine_get_surrounding_text (engine, &text, &cursor_pos);
g_object_unref (text);
#endif /* HAVE_IBUS_ENGINE_GET_SURROUNDING_TEXT */
+
+#if HAVE_LIBXKLAVIER
+ GObjectClass *object_class;
+ IBusM17NEngineClass *klass;
+
+ object_class = G_OBJECT_GET_CLASS (m17n);
+ klass = (IBusM17NEngineClass *) object_class;
+
+ if (klass->xkl_config_rec) {
+ if (!xkl_config_rec_activate (klass->xkl_config_rec, xkl_engine))
+ g_warning ("Can't set the XKB layout");
+ }
+#endif /* HAVE_LIBXKLAVIER */
}
static void
@@ -744,6 +869,17 @@ ibus_m17n_engine_disable (IBusEngine *en
ibus_m17n_engine_focus_out (engine);
parent_class->disable (engine);
+
+#if HAVE_LIBXKLAVIER
+ GObjectClass *object_class;
+ IBusM17NEngineClass *klass;
+
+ object_class = G_OBJECT_GET_CLASS (m17n);
+ klass = (IBusM17NEngineClass *) object_class;
+
+ if (xkl_system_config_rec)
+ xkl_config_rec_activate (xkl_system_config_rec, xkl_engine);
+#endif /* HAVE_LIBXKLAVIER */
}
static void
Index: ibus-m17n-1.3.2/src/m17nutil.c
===================================================================
--- ibus-m17n-1.3.2.orig/src/m17nutil.c
+++ ibus-m17n-1.3.2/src/m17nutil.c
@@ -290,6 +290,11 @@ ibus_m17n_engine_config_parse_xml_node (
sub_node->name, sub_node->text);
@@ -120,7 +120,7 @@ ibus_m17n_engine_new (MSymbol lang,
"language", msymbol_name (lang),
"license", "GPL",
"icon", engine_icon ? engine_icon : "",
- "layout", "us",
+ "layout", config->layout ? config->layout : "us",
"rank", config->rank,
NULL);
#else
@@ -282,6 +282,11 @@ ibus_m17n_engine_config_parse_xml_node (
cnode->config.rank = atoi (sub_node->text);
continue;
}
+ if (g_strcmp0 (sub_node->name, "xkb-options") == 0) {
+ g_free (cnode->config.xkb_options);
+ cnode->config.xkb_options = g_strdup (sub_node->text);
+ if (g_strcmp0 (sub_node->name , "layout") == 0) {
+ g_free (cnode->config.layout);
+ cnode->config.layout = g_strdup (sub_node->text);
+ continue;
+ }
g_warning ("<engine> element contains invalid element <%s>",
sub_node->name);
}
if (g_strcmp0 (sub_node->name , "preedit-highlight") == 0) {
if (g_ascii_strcasecmp ("TRUE", sub_node->text) == 0)
cnode->config.preedit_highlight = TRUE;
Index: ibus-m17n-1.3.2/src/m17nutil.h
===================================================================
--- ibus-m17n-1.3.2.orig/src/m17nutil.h
+++ ibus-m17n-1.3.2/src/m17nutil.h
@@ -16,6 +16,9 @@ struct _IBusM17NEngineConfig {
@@ -14,6 +14,9 @@ struct _IBusM17NEngineConfig {
/* engine rank */
gint rank;
+ /* keyboard layout */
+ gchar *layout;
+
/* whether to highlight preedit */
gboolean preedit_highlight;
+
+ /* keyboard options to which the engine switches when enabled */
+ char *xkb_options;
};
typedef struct _IBusM17NEngineConfig IBusM17NEngineConfig;

View File

@ -17,7 +17,7 @@ Index: ibus-m17n-1.3.2/configure.ac
===================================================================
--- ibus-m17n-1.3.2.orig/configure.ac
+++ ibus-m17n-1.3.2/configure.ac
@@ -122,6 +122,9 @@ AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GET
@@ -114,6 +114,9 @@ AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GET
AM_GNU_GETTEXT([external])
AM_GNU_GETTEXT_VERSION(0.16.1)
@ -98,21 +98,21 @@ Index: ibus-m17n-1.3.2/src/default.xml.in.in
<name>m17n:bn:inscript*</name>
<rank>2</rank>
<preedit-highlight>FALSE</preedit-highlight>
<xkb-options>lv3:ralt_switch</xkb-options>
<layout>default[lv3:ralt_switch]</layout>
+ <symbol>ক</symbol>
</engine>
<engine>
<name>m17n:gu:inscript*</name>
<rank>2</rank>
<preedit-highlight>FALSE</preedit-highlight>
<xkb-options>lv3:ralt_switch</xkb-options>
<layout>default[lv3:ralt_switch]</layout>
+ <symbol>ક</symbol>
</engine>
<engine>
<name>m17n:hi:inscript*</name>
<rank>2</rank>
<preedit-highlight>FALSE</preedit-highlight>
<xkb-options>lv3:ralt_switch</xkb-options>
<layout>default[lv3:ralt_switch]</layout>
+ <symbol>क</symbol>
</engine>
<engine>
@ -131,21 +131,21 @@ Index: ibus-m17n-1.3.2/src/default.xml.in.in
<name>m17n:mai:inscript*</name>
<rank>2</rank>
<preedit-highlight>FALSE</preedit-highlight>
<xkb-options>lv3:ralt_switch</xkb-options>
<layout>default[lv3:ralt_switch]</layout>
+ <symbol>क</symbol>
</engine>
<engine>
<name>m17n:ml:inscript*</name>
<rank>2</rank>
<preedit-highlight>FALSE</preedit-highlight>
<xkb-options>lv3:ralt_switch</xkb-options>
<layout>default[lv3:ralt_switch]</layout>
+ <symbol>ക</symbol>
</engine>
<engine>
<name>m17n:mr:inscript*</name>
<rank>2</rank>
<preedit-highlight>FALSE</preedit-highlight>
<xkb-options>lv3:ralt_switch</xkb-options>
<layout>default[lv3:ralt_switch]</layout>
+ <symbol>क</symbol>
</engine>
<engine>
@ -158,14 +158,14 @@ Index: ibus-m17n-1.3.2/src/default.xml.in.in
<name>m17n:or:inscript*</name>
<rank>2</rank>
<preedit-highlight>FALSE</preedit-highlight>
<xkb-options>lv3:ralt_switch</xkb-options>
<layout>default[lv3:ralt_switch]</layout>
+ <symbol>କ</symbol>
</engine>
<engine>
<name>m17n:pa:inscript*</name>
<rank>2</rank>
<preedit-highlight>FALSE</preedit-highlight>
<xkb-options>lv3:ralt_switch</xkb-options>
<layout>default[lv3:ralt_switch]</layout>
+ <symbol>ਕ</symbol>
</engine>
<engine>
@ -178,14 +178,14 @@ Index: ibus-m17n-1.3.2/src/default.xml.in.in
<name>m17n:sd:inscript*</name>
<rank>2</rank>
<preedit-highlight>FALSE</preedit-highlight>
<xkb-options>lv3:ralt_switch</xkb-options>
<layout>default[lv3:ralt_switch]</layout>
+ <symbol>क</symbol>
</engine>
<engine>
<name>m17n:si:wijesekera</name>
<rank>2</rank>
<preedit-highlight>FALSE</preedit-highlight>
<xkb-options>lv3:ralt_switch</xkb-options>
<layout>default[lv3:ralt_switch]</layout>
+ <symbol>සි</symbol>
</engine>
<engine>
@ -198,7 +198,7 @@ Index: ibus-m17n-1.3.2/src/default.xml.in.in
<name>m17n:te:inscript*</name>
<rank>2</rank>
<preedit-highlight>FALSE</preedit-highlight>
<xkb-options>lv3:ralt_switch</xkb-options>
<layout>default[lv3:ralt_switch]</layout>
+ <symbol>క</symbol>
</engine>
<!-- Samanala should have lower rank than other Sinhala
@ -351,7 +351,7 @@ Index: ibus-m17n-1.3.2/src/default.xml.in.in
<name>m17n:si:*</name>
<rank>1</rank>
<preedit-highlight>FALSE</preedit-highlight>
<xkb-options>lv3:ralt_switch</xkb-options>
<layout>default[lv3:ralt_switch]</layout>
+ <symbol>සි</symbol>
</engine>
<engine>
@ -582,15 +582,15 @@ Index: ibus-m17n-1.3.2/src/m17nutil.c
+++ ibus-m17n-1.3.2/src/m17nutil.c
@@ -122,6 +122,8 @@ ibus_m17n_engine_new (MSymbol lang,
"icon", engine_icon ? engine_icon : "",
"layout", "us",
"layout", config->layout ? config->layout : "us",
"rank", config->rank,
+ "hotkeys", config->hotkeys ? config->hotkeys : "",
+ "symbol", config->symbol ? config->symbol : "",
NULL);
#else
engine = ibus_engine_desc_new (engine_name,
@@ -282,6 +284,14 @@ ibus_m17n_engine_config_parse_xml_node (
cnode->config.rank = atoi (sub_node->text);
@@ -287,6 +289,14 @@ ibus_m17n_engine_config_parse_xml_node (
cnode->config.layout = g_strdup (sub_node->text);
continue;
}
+ if (g_strcmp0 (sub_node->name , "hotkeys") == 0) {
@ -608,9 +608,9 @@ Index: ibus-m17n-1.3.2/src/m17nutil.h
===================================================================
--- ibus-m17n-1.3.2.orig/src/m17nutil.h
+++ ibus-m17n-1.3.2/src/m17nutil.h
@@ -14,6 +14,12 @@ struct _IBusM17NEngineConfig {
/* engine rank */
gint rank;
@@ -17,6 +17,12 @@ struct _IBusM17NEngineConfig {
/* keyboard layout */
gchar *layout;
+ /* hotkeys */
+ gchar *hotkeys;
@ -620,4 +620,4 @@ Index: ibus-m17n-1.3.2/src/m17nutil.h
+
/* whether to highlight preedit */
gboolean preedit_highlight;
};

View File

@ -13,14 +13,12 @@
Name: ibus-m17n
Version: 1.3.2
Release: 8%{?dist}
Release: 9%{?dist}
Summary: The M17N engine for IBus platform
License: GPLv2+
Group: System Environment/Libraries
URL: http://code.google.com/p/ibus/
Source0: http://ibus.googlecode.com/files/%{name}-%{version}.tar.gz
# dummy source to keep quilt series file
Source1: series
Patch0: ibus-m17n-HEAD.patch
Patch1: ibus-m17n-iok.patch
@ -77,6 +75,10 @@ make DESTDIR=${RPM_BUILD_ROOT} install
%{_datadir}/ibus/component/*
%changelog
* Mon Aug 8 2011 Daiki Ueno <dueno@redhat.com> - 1.3.2-9
- Update ibus-m17n-xkb-options.patch.
- Don't set XKB options directly from engine but via ibus-xkb
* Fri Aug 5 2011 Daiki Ueno <dueno@redhat.com> - 1.3.2-8
- Update ibus-m17n-xx-icon-symbol.patch.
- Fix bug 727024 - ibus compose file needs a symbol tag for gnome-shell

4
series
View File

@ -1,4 +0,0 @@
ibus-m17n-HEAD.patch
ibus-m17n-iok.patch
ibus-m17n-xkb-options.patch
ibus-m17n-xx-icon-symbol.patch