- Add patch ibus-m17n-HEAD.patch from upstream git tree.

- Make Control + Alt + ... available. (#482789)
This commit is contained in:
Peng Huang 2009-02-18 09:46:32 +00:00
parent 6fb2a3caf8
commit b6ad1166ba
2 changed files with 134 additions and 1 deletions

126
ibus-m17n-HEAD.patch Normal file
View File

@ -0,0 +1,126 @@
diff --git a/src/engine.c b/src/engine.c
index 5c5f56f..06501bb 100644
--- a/src/engine.c
+++ b/src/engine.c
@@ -53,9 +53,10 @@ static void ibus_m17n_engine_page_up (IBusEngine *engine);
static void ibus_m17n_engine_page_down (IBusEngine *engine);
static void ibus_m17n_engine_cursor_up (IBusEngine *engine);
static void ibus_m17n_engine_cursor_down (IBusEngine *engine);
-static void ibus_m17n_property_activate (IBusEngine *engine,
+static void ibus_m17n_engine_property_activate
+ (IBusEngine *engine,
const gchar *prop_name,
- gint prop_state);
+ guint prop_state);
static void ibus_m17n_engine_property_show
(IBusEngine *engine,
const gchar *prop_name);
@@ -126,6 +127,7 @@ ibus_m17n_engine_class_init (IBusM17NEngineClass *klass)
engine_class->cursor_up = ibus_m17n_engine_cursor_up;
engine_class->cursor_down = ibus_m17n_engine_cursor_down;
+ // engine_class->property_activate = ibus_m17n_engine_property_activate;
}
static void
@@ -277,47 +279,67 @@ MSymbol
ibus_m17n_key_event_to_symbol (guint keyval,
guint modifiers)
{
- GString *key;
- MSymbol mkey = Mnil;
+ GString *keysym;
+ MSymbol mkeysym = Mnil;
guint mask = 0;
+ if (keyval >= IBUS_Shift_L && keyval <= IBUS_Hyper_R) {
+ return Mnil;
+ }
+
+ keysym = g_string_new ("");
+
if (keyval >= IBUS_space && keyval <= IBUS_asciitilde) {
+ gint c = keyval;
if (keyval == IBUS_space && modifiers & IBUS_SHIFT_MASK)
mask |= IBUS_SHIFT_MASK;
if (modifiers & IBUS_CONTROL_MASK) {
- if (keyval >= IBUS_a && keyval <= IBUS_z)
- keyval += IBUS_A - IBUS_a;
+ if (c >= IBUS_a && c <= IBUS_z)
+ c += IBUS_A - IBUS_a;
mask |= IBUS_CONTROL_MASK;
}
+
+ g_string_append_c (keysym, c);
}
- else if (keyval >= IBUS_Shift_L && keyval <= IBUS_Hyper_R) {
- return Mnil;
+ else {
+ mask |= modifiers & (IBUS_CONTROL_MASK | IBUS_SHIFT_MASK);
+ g_string_append (keysym, ibus_keyval_name (keyval));
+ if (keysym->len == 0) {
+ g_string_free (keysym, TRUE);
+ return Mnil;
+ }
}
- mask |= modifiers & (IBUS_MOD1_MASK | IBUS_META_MASK);
+ mask |= modifiers & (IBUS_MOD1_MASK |
+ IBUS_META_MASK |
+ IBUS_SUPER_MASK |
+ IBUS_HYPER_MASK);
- key = g_string_new ("");
+ if (mask & IBUS_HYPER_MASK) {
+ g_string_prepend (keysym, "H-");
+ }
+ if (mask & IBUS_SUPER_MASK) {
+ g_string_prepend (keysym, "s-");
+ }
if (mask & IBUS_MOD1_MASK) {
- g_string_append (key, "A-");
+ g_string_prepend (keysym, "A-");
}
if (mask & IBUS_META_MASK) {
- g_string_append (key, "M-");
+ g_string_prepend (keysym, "M-");
}
if (mask & IBUS_CONTROL_MASK) {
- g_string_append (key, "C-");
+ g_string_prepend (keysym, "C-");
}
if (mask & IBUS_SHIFT_MASK) {
- g_string_append (key, "S-");
+ g_string_prepend (keysym, "S-");
}
- g_string_append (key, ibus_keyval_name (keyval));
-
- mkey = msymbol (key->str);
- g_string_free (key, TRUE);
+ mkeysym = msymbol (keysym->str);
+ g_string_free (keysym, TRUE);
- return mkey;
+ return mkeysym;
}
static gboolean
@@ -457,6 +479,15 @@ ibus_m17n_engine_cursor_down (IBusEngine *engine)
}
static void
+ibus_m17n_engine_property_activate (IBusEngine *engine,
+ const gchar *prop_name,
+ guint prop_state)
+{
+ g_debug ("prop_name=%s, prop_state=%d", prop_name, prop_state);
+ parent_class->property_activate (engine, prop_name, prop_state);
+}
+
+static void
ibus_m17n_engine_update_lookup_table (IBusM17NEngine *m17n)
{
ibus_lookup_table_clear (m17n->table);

View File

@ -2,13 +2,15 @@
%define mod_path ibus-1.1
Name: ibus-m17n
Version: 1.1.0.20090211
Release: 1%{?dist}
Release: 2%{?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
Patch0: ibus-m17n-HEAD.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: gettext-devel
BuildRequires: libtool
@ -25,6 +27,7 @@ the input table maps from m17n-db.
%prep
%setup -q
%patch0 -p1
%build
%configure --disable-static
@ -49,6 +52,10 @@ rm -rf $RPM_BUILD_ROOT
%{_datadir}/ibus/component/*
%changelog
* Wed Feb 18 2009 Huang Peng <shawn.p.huang@gmail.com> - 1.1.0.20090211-2
- Add patch ibus-m17n-HEAD.patch from upstream git tree.
- Make Control + Alt + ... available. (#482789)
* Wed Feb 11 2009 Huang Peng <shawn.p.huang@gmail.com> - 1.1.0.20090211-1
- Update to 1.1.0.20090211.