Sophie

Sophie

distrib > Fedora > 17 > x86_64 > by-pkgid > cfb2a44530008ccbb467fb595101b149 > files > 6

ibus-m17n-1.3.4-3.fc17.src.rpm

From ab9d608fdb6054b4b135f891ad5fa1fa7ce27c7b Mon Sep 17 00:00:00 2001
From: Daiki Ueno <ueno@unixuser.org>
Date: Mon, 8 Aug 2011 09:59:28 +0900
Subject: [PATCH 1/4] Set XKB layout option via default.xml.

---
 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 9f5a01e..beae494 100644
--- a/src/default.xml.in.in
+++ b/src/default.xml.in.in
@@ -158,6 +158,15 @@
 		<name>m17n:si:samanala</name>
 		<rank>0</rank>
 	</engine>
+	<!-- Some Indic engines expect AltGr is automatically mapped -->
+	<engine>
+		<name>m17n:*:inscript</name>
+		<layout>default[lv3:ralt_switch]</layout>
+	</engine>
+	<engine>
+		<name>m17n:si:*</name>
+		<layout>default[lv3:ralt_switch]</layout>
+	</engine>
 	<!-- Some CJK engines use preedit. -->
 	<engine>
 		<name>m17n:zh:cangjie</name>
diff --git a/src/m17nutil.c b/src/m17nutil.c
index 51026b2..0b46531 100644
--- a/src/m17nutil.c
+++ b/src/m17nutil.c
@@ -17,7 +17,8 @@ typedef enum {
     ENGINE_CONFIG_RANK_MASK = 1 << 0,
     ENGINE_CONFIG_SYMBOL_MASK = 1 << 1,
     ENGINE_CONFIG_LONGNAME_MASK = 1 << 2,
-    ENGINE_CONFIG_PREEDIT_HIGHLIGHT_MASK = 1 << 3
+    ENGINE_CONFIG_LAYOUT_MASK = 1 << 3,
+    ENGINE_CONFIG_PREEDIT_HIGHLIGHT_MASK = 1 << 4
 } EngineConfigMask;
 
 struct _EngineConfigNode {
@@ -133,7 +134,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,
                                            "symbol",      config->symbol ? config->symbol : "",
                                            "setup",       engine_setup,
@@ -275,6 +276,8 @@ ibus_m17n_get_engine_config (const gchar *engine_name)
                 config->longname = cnode->config.longname;
             if (cnode->mask & ENGINE_CONFIG_PREEDIT_HIGHLIGHT_MASK)
                 config->preedit_highlight = cnode->config.preedit_highlight;
+            if (cnode->mask & ENGINE_CONFIG_LAYOUT_MASK)
+                config->layout = cnode->config.layout;
         }
     }
     return config;
@@ -315,6 +318,12 @@ ibus_m17n_engine_config_parse_xml_node (EngineConfigNode *cnode,
             cnode->mask |= ENGINE_CONFIG_LONGNAME_MASK;
             continue;
         }
+        if (g_strcmp0 (sub_node->name , "layout") == 0) {
+            g_free (cnode->config.layout);
+            cnode->config.layout = g_strdup (sub_node->text);
+            cnode->mask |= ENGINE_CONFIG_LAYOUT_MASK;
+            continue;
+        }
         if (g_strcmp0 (sub_node->name , "preedit-highlight") == 0) {
             if (g_ascii_strcasecmp ("TRUE", sub_node->text) == 0)
                 cnode->config.preedit_highlight = TRUE;
diff --git a/src/m17nutil.h b/src/m17nutil.h
index d790cf8..93faad4 100644
--- a/src/m17nutil.h
+++ b/src/m17nutil.h
@@ -20,6 +20,9 @@ struct _IBusM17NEngineConfig {
     /* overridding longname shown on panel */
     gchar *longname;
 
+    /* keyboard layout */
+    gchar *layout;
+
     /* whether to highlight preedit */
     gboolean preedit_highlight;
 };
-- 
1.7.7.6