You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
87 lines
2.5 KiB
87 lines
2.5 KiB
From 8d9cfe6882f892ff936b20b986fab5d554715c96 Mon Sep 17 00:00:00 2001
|
|
From: Daiki Ueno <ueno@unixuser.org>
|
|
Date: Wed, 14 Aug 2013 12:49:17 +0200
|
|
Subject: [PATCH] Automatically set input mode depending on content-type
|
|
|
|
---
|
|
src/engine.vala | 17 +++++++++++++++++
|
|
src/ibus-1.0.vapi | 27 +++++++++++++++++++++++++++
|
|
2 files changed, 44 insertions(+)
|
|
|
|
diff --git a/src/engine.vala b/src/engine.vala
|
|
index ff7111b..7818cf5 100644
|
|
--- a/src/engine.vala
|
|
+++ b/src/engine.vala
|
|
@@ -599,6 +599,23 @@ class KkcEngine : IBus.Engine {
|
|
context.candidates.page_down ();
|
|
}
|
|
|
|
+ public override void set_content_type (uint purpose, uint hints) {
|
|
+ switch (purpose) {
|
|
+ case IBus.InputPurpose.PASSWORD:
|
|
+ case IBus.InputPurpose.PIN:
|
|
+ context.input_mode = Kkc.InputMode.DIRECT;
|
|
+ break;
|
|
+ case IBus.InputPurpose.ALPHA:
|
|
+ case IBus.InputPurpose.DIGITS:
|
|
+ case IBus.InputPurpose.NUMBER:
|
|
+ case IBus.InputPurpose.PHONE:
|
|
+ case IBus.InputPurpose.URL:
|
|
+ case IBus.InputPurpose.EMAIL:
|
|
+ context.input_mode = Kkc.InputMode.LATIN;
|
|
+ break;
|
|
+ }
|
|
+ }
|
|
+
|
|
static bool ibus;
|
|
|
|
const OptionEntry[] options = {
|
|
diff --git a/src/ibus-1.0.vapi b/src/ibus-1.0.vapi
|
|
index 6c200f9..3c1f6a3 100644
|
|
--- a/src/ibus-1.0.vapi
|
|
+++ b/src/ibus-1.0.vapi
|
|
@@ -206,6 +206,7 @@ namespace IBus {
|
|
public virtual signal void set_capabilities (uint caps);
|
|
public virtual signal void set_cursor_location (int x, int y, int w, int h);
|
|
public virtual signal void set_surrounding_text (GLib.Object text, uint cursor_index, uint anchor_pos);
|
|
+ public virtual signal void set_content_type (uint purpose, uint hints);
|
|
}
|
|
[CCode (cheader_filename = "ibus.h")]
|
|
public class EngineDesc : IBus.Serializable {
|
|
@@ -653,6 +654,32 @@ namespace IBus {
|
|
MENU,
|
|
SEPARATOR
|
|
}
|
|
+ [CCode (cheader_filename = "ibus.h", cprefix = "IBUS_INPUT_PURPOSE_", type_id = "ibus_input_purpose_get_type ()")]
|
|
+ public enum InputPurpose {
|
|
+ FREE_FORM,
|
|
+ ALPHA,
|
|
+ DIGITS,
|
|
+ NUMBER,
|
|
+ PHONE,
|
|
+ URL,
|
|
+ EMAIL,
|
|
+ NAME,
|
|
+ PASSWORD,
|
|
+ PIN
|
|
+ }
|
|
+ [CCode (cheader_filename = "ibus.h", cprefix = "IBUS_INPUT_HINT_", type_id = "ibus_input_hints_get_type ()")]
|
|
+ [Flags]
|
|
+ public enum InputHints {
|
|
+ NONE,
|
|
+ SPELLCHECK,
|
|
+ NO_SPELLCHECK,
|
|
+ WORD_COMPLETION,
|
|
+ LOWERCASE,
|
|
+ UPPERCASE_CHARS,
|
|
+ UPPERCASE_WORDS,
|
|
+ UPPERCASE_SENTENCES,
|
|
+ INHIBIT_OSK
|
|
+ }
|
|
[CCode (cheader_filename = "ibus.h", has_target = false)]
|
|
public delegate void FreeFunc (void* object);
|
|
[CCode (cheader_filename = "ibus.h", has_target = false)]
|
|
--
|
|
1.8.3.1
|
|
|