ibus-m17n/ibus-m17n-xkb-options.patch

94 lines
3.4 KiB
Diff
Raw Normal View History

From 0cc2abaab50e6668e525da093ef12ed0277d5c21 Mon Sep 17 00:00:00 2001
2011-09-01 10:18:22 +00:00
From: Daiki Ueno <ueno@unixuser.org>
Date: Mon, 8 Aug 2011 09:59:28 +0900
2011-09-02 03:02:57 +00:00
Subject: [PATCH 3/6] Set XKB layout option via default.xml.
2011-09-01 10:18:22 +00:00
---
src/default.xml.in.in | 9 +++++++++
src/m17nutil.c | 13 +++++++++++--
src/m17nutil.h | 3 +++
3 files changed, 23 insertions(+), 2 deletions(-)
diff --git a/src/default.xml.in.in b/src/default.xml.in.in
index dc93fd3..785ab05 100644
--- a/src/default.xml.in.in
+++ b/src/default.xml.in.in
@@ -157,6 +157,15 @@
<name>m17n:si:samanala</name>
<rank>0</rank>
</engine>
+ <!-- Some Indic engines expect AltGr is automatically mapped -->
+ <engine>
+ <name>m17n:*:inscript</name>
2011-08-08 01:15:01 +00:00
+ <layout>default[lv3:ralt_switch]</layout>
2011-09-01 10:18:22 +00:00
+ </engine>
+ <engine>
+ <name>m17n:si:*</name>
2011-08-08 01:15:01 +00:00
+ <layout>default[lv3:ralt_switch]</layout>
2011-09-01 10:18:22 +00:00
+ </engine>
<!-- Some CJK engines use preedit. -->
<engine>
<name>m17n:zh:cangjie</name>
diff --git a/src/m17nutil.c b/src/m17nutil.c
index b06f71d..201c8b4 100644
2011-09-01 10:18:22 +00:00
--- a/src/m17nutil.c
+++ b/src/m17nutil.c
@@ -15,7 +15,8 @@ static MConverter *utf8_converter = NULL;
2011-09-01 10:18:22 +00:00
typedef enum {
ENGINE_CONFIG_RANK_MASK = 1 << 0,
- ENGINE_CONFIG_PREEDIT_HIGHLIGHT_MASK = 1 << 1
+ ENGINE_CONFIG_LAYOUT_MASK = 1 << 1,
+ ENGINE_CONFIG_PREEDIT_HIGHLIGHT_MASK = 1 << 2
} EngineConfigMask;
struct _EngineConfigNode {
@@ -130,7 +131,7 @@ ibus_m17n_engine_new (MSymbol lang,
2011-08-08 01:15:01 +00:00
"language", msymbol_name (lang),
"license", "GPL",
"icon", engine_icon ? engine_icon : "",
- "layout", "us",
+ "layout", config->layout ? config->layout : "us",
"rank", config->rank,
NULL);
#else
@@ -272,6 +273,8 @@ ibus_m17n_get_engine_config (const gchar *engine_name)
2011-09-01 10:18:22 +00:00
if (g_pattern_match_simple (cnode->name, engine_name)) {
if (cnode->mask & ENGINE_CONFIG_RANK_MASK)
config->rank = cnode->config.rank;
+ if (cnode->mask & ENGINE_CONFIG_LAYOUT_MASK)
+ config->layout = cnode->config.layout;
if (cnode->mask & ENGINE_CONFIG_PREEDIT_HIGHLIGHT_MASK)
config->preedit_highlight = cnode->config.preedit_highlight;
}
@@ -304,6 +307,12 @@ ibus_m17n_engine_config_parse_xml_node (EngineConfigNode *cnode,
2011-09-01 10:18:22 +00:00
cnode->mask |= ENGINE_CONFIG_RANK_MASK;
2011-07-07 05:37:21 +00:00
continue;
}
2011-08-08 01:15:01 +00:00
+ if (g_strcmp0 (sub_node->name , "layout") == 0) {
+ g_free (cnode->config.layout);
+ cnode->config.layout = g_strdup (sub_node->text);
2011-09-01 10:18:22 +00:00
+ cnode->mask |= ENGINE_CONFIG_LAYOUT_MASK;
2011-07-07 05:37:21 +00:00
+ continue;
+ }
2011-08-08 01:15:01 +00:00
if (g_strcmp0 (sub_node->name , "preedit-highlight") == 0) {
if (g_ascii_strcasecmp ("TRUE", sub_node->text) == 0)
cnode->config.preedit_highlight = TRUE;
2011-09-01 10:18:22 +00:00
diff --git a/src/m17nutil.h b/src/m17nutil.h
index 313e7bc..c7b283e 100644
--- a/src/m17nutil.h
+++ b/src/m17nutil.h
2011-08-08 01:15:01 +00:00
@@ -14,6 +14,9 @@ struct _IBusM17NEngineConfig {
/* engine rank */
gint rank;
2011-07-07 05:37:21 +00:00
2011-08-08 01:15:01 +00:00
+ /* keyboard layout */
+ gchar *layout;
+
2011-07-07 05:37:21 +00:00
/* whether to highlight preedit */
gboolean preedit_highlight;
};
2011-09-01 10:18:22 +00:00
--
1.7.6.1