Permalink
Browse files

Add cedilla_compose_seqs table for pt_BR compose keys.

  • Loading branch information...
1 parent e129cf2 commit 11a83ef32c7c73f0feb48fd36cc9f33abaa8024a @fujiwarat fujiwarat committed Nov 19, 2012
Showing with 50 additions and 5 deletions.
  1. +44 −0 engine/main.vala
  2. +2 −2 src/ibusengine.h
  3. +4 −3 src/ibusenginesimple.h
View
@@ -22,10 +22,26 @@
using IBus;
+const uint16 cedilla_compose_seqs[] = {
+ (uint16) IBus.KEY_dead_acute, (uint16) IBus.KEY_C, 0, 0, 0,
+ 0x00C7, /* LATIN_CAPITAL_LETTER_C_WITH_CEDILLA */
+ (uint16) IBus.KEY_dead_acute, (uint16) IBus.KEY_c, 0, 0, 0,
+ 0x00E7, /* LATIN_SMALL_LETTER_C_WITH_CEDILLA */
+ (uint16) IBus.KEY_Multi_key, (uint16) IBus.KEY_apostrophe, (uint16) IBus.KEY_C, 0, 0,
+ 0x00C7, /* LATIN_CAPITAL_LETTER_C_WITH_CEDILLA */
+ (uint16) IBus.KEY_Multi_key, (uint16) IBus.KEY_apostrophe, (uint16) IBus.KEY_c, 0, 0,
+ 0x00E7, /* LATIN_SMALL_LETTER_C_WITH_CEDILLA */
+ (uint16) IBus.KEY_Multi_key, (uint16) IBus.KEY_C, (uint16) IBus.KEY_apostrophe, 0, 0,
+ 0x00C7, /* LATIN_CAPITAL_LETTER_C_WITH_CEDILLA */
+ (uint16) IBus.KEY_Multi_key, (uint16) IBus.KEY_c, (uint16) IBus.KEY_apostrophe, 0, 0,
+ 0x00E7, /* LATIN_SMALL_LETTER_C_WITH_CEDILLA */
+};
+
class DummyEngine : IBus.EngineSimple {
}
public int main(string[] args) {
+ Intl.setlocale (LocaleCategory.ALL, "");
IBus.init();
IBus.Bus bus = new IBus.Bus();
@@ -45,9 +61,37 @@ public int main(string[] args) {
factory.create_engine.connect((factory, name) => {
const string path = "/org/freedesktop/IBus/engine/simple/%d";
+ string lang = Intl.setlocale (LocaleCategory.CTYPE, null);
+
+ if (lang == null) {
+ lang = Environment.get_variable("LANG");
+ }
+
IBus.Engine engine = new IBus.Engine.with_type(
typeof(IBus.EngineSimple), name,
path.printf(++id), bus.get_connection());
+
+ /* I think "c" + "'" is c with acute U+0107 and
+ * "c" + "," is c with cedilla U+00E7 and they are
+ * visually comprehensible. But pt-br people need
+ * "c" + "'" is c with cedilla and I think the
+ * cedilla_compose_seqs is needed for the specific keyboards
+ * or regions.
+ * X11 uses compose by locale:
+ * In /usr/share/X11/locale/en_US.UTF-8/Compose ,
+ * <Multi_key> <apostrophe> <c> : U0107
+ * At the moment, LC_CTYPE is checked here.
+ * I am not sure if cedilla_compose_seqs is needed for us layout.
+ * FIXME: Need to provide the customization.
+ */
+ if (lang != null &&
+ lang.ascii_ncasecmp("pt_br", "pt_br".length) == 0) {
+ IBus.EngineSimple? simple = (IBus.EngineSimple ?) engine;
+ simple.add_table((uint16[]) cedilla_compose_seqs,
+ 4,
+ cedilla_compose_seqs.length / (4 + 2));
+ }
+
return engine;
});
View
@@ -33,7 +33,7 @@
* An IBusEngine provides infrastructure for input method engine.
* Developers can "extend" this class for input method engine development.
*
- * @see_also: #IBusComponent, #IBusEngineDesc
+ * see_also: #IBusComponent, #IBusEngineDesc
*/
#ifndef __IBUS_ENGINE_H_
#define __IBUS_ENGINE_H_
@@ -423,7 +423,7 @@ void ibus_engine_delete_surrounding_text(IBusEngine *engine,
* #IBusEngine::enable handler, with both @text and @cursor set to
* %NULL.
*
- * @see_also #IBusEngine::set-surrounding-text
+ * see_also #IBusEngine::set-surrounding-text
*/
void ibus_engine_get_surrounding_text(IBusEngine *engine,
IBusText **text,
View
@@ -32,7 +32,7 @@
*
* An IBusEngineSimple provides table-based input method logic.
*
- * @see_also: #IBusEngine
+ * see_also: #IBusEngine
*/
#ifndef __IBUS_ENGINE_SIMPLE_H__
#define __IBUS_ENGINE_SIMPLE_H__
@@ -97,8 +97,9 @@ GType ibus_engine_simple_get_type (void);
/**
* ibus_engine_simple_add_table:
* @simple: An IBusEngineSimple.
- * @data: The table.
- * @ max_seq_len: Maximum length of a swquence in the table (cannot be greater
+ * @data: (transfer container) (element-type guint16) (array):
+ * The table.
+ * @max_seq_len: Maximum length of a swquence in the table (cannot be greater
* than %IBUS_MAX_COMPOSE_LEN)
*
* Adds an additional table to search to the engine. Each row of the table

0 comments on commit 11a83ef

Please sign in to comment.