Fix the last commit.
This commit is contained in:
parent
e1a8f5680b
commit
bd7cc73712
@ -1,281 +0,0 @@
|
||||
Patch to synch with the git master 65cc1bc1.
|
||||
Index: ibus-m17n-1.3.2/Makefile.am
|
||||
===================================================================
|
||||
--- ibus-m17n-1.3.2.orig/Makefile.am
|
||||
+++ ibus-m17n-1.3.2/Makefile.am
|
||||
@@ -69,7 +69,7 @@ debian/changelog:
|
||||
version=@VERSION@; \
|
||||
serie=$(serie); \
|
||||
if test -z "$$serie"; then \
|
||||
- serie=lucid; \
|
||||
+ serie=maverick; \
|
||||
fi; \
|
||||
if test -z "$$release"; then \
|
||||
release=1; \
|
||||
Index: ibus-m17n-1.3.2/configure.ac
|
||||
===================================================================
|
||||
--- ibus-m17n-1.3.2.orig/configure.ac
|
||||
+++ ibus-m17n-1.3.2/configure.ac
|
||||
@@ -89,7 +89,22 @@ fi
|
||||
AM_CONDITIONAL([HAVE_GTK],[test x$with_gtk != xno])
|
||||
|
||||
# check if minput_list, which is available in m17n-lib 1.6.2+ (CVS)
|
||||
+save_CFLAGS="$CFLAGS"
|
||||
+save_LIBS="$LIBS"
|
||||
+CFLAGS="$CFLAGS $M17N_CFLAGS"
|
||||
+LIBS="$LIBS $M17N_LIBS"
|
||||
AC_REPLACE_FUNCS([minput_list])
|
||||
+CFLAGS="$save_CFLAGS"
|
||||
+LIBS="$save_LIBS"
|
||||
+
|
||||
+# check if ibus_engine_get_surrounding_text, which is available in ibus-1.3.99+ (git master)
|
||||
+save_CFLAGS="$CFLAGS"
|
||||
+save_LIBS="$LIBS"
|
||||
+CFLAGS="$CFLAGS $IBUS_CFLAGS"
|
||||
+LIBS="$LIBS $IBUS_LIBS"
|
||||
+AC_CHECK_FUNCS([ibus_engine_get_surrounding_text])
|
||||
+CFLAGS="$save_CFLAGS"
|
||||
+LIBS="$save_LIBS"
|
||||
|
||||
# define GETTEXT_* variables
|
||||
GETTEXT_PACKAGE=ibus-m17n
|
||||
Index: ibus-m17n-1.3.2/src/engine.c
|
||||
===================================================================
|
||||
--- ibus-m17n-1.3.2.orig/src/engine.c
|
||||
+++ ibus-m17n-1.3.2/src/engine.c
|
||||
@@ -1,4 +1,7 @@
|
||||
/* vim:set et sts=4: */
|
||||
+#ifdef HAVE_CONFIG_H
|
||||
+#include <config.h>
|
||||
+#endif
|
||||
|
||||
#include <ibus.h>
|
||||
#include <m17n.h>
|
||||
@@ -6,23 +9,6 @@
|
||||
#include "m17nutil.h"
|
||||
#include "engine.h"
|
||||
|
||||
-/* type module to assign different GType to each engine */
|
||||
-#define IBUS_TYPE_M17N_TYPE_MODULE (ibus_m17n_type_module_get_type ())
|
||||
-#define IBUS_M17N_TYPE_MODULE (module) (G_TYPE_CHECK_INSTANCE_CAST (module, IBUS_TYPE_M17N_TYPE_MODULE, IBusM17NTypeModule)
|
||||
-
|
||||
-typedef struct _IBusM17NTypeModule IBusM17NTypeModule;
|
||||
-typedef struct _IBusM17NTypeModuleClass IBusM17NTypeModuleClass;
|
||||
-
|
||||
-struct _IBusM17NTypeModule
|
||||
-{
|
||||
- GTypeModule parent_instance;
|
||||
-};
|
||||
-
|
||||
-struct _IBusM17NTypeModuleClass
|
||||
-{
|
||||
- GTypeModuleClass parent_class;
|
||||
-};
|
||||
-
|
||||
typedef struct _IBusM17NEngine IBusM17NEngine;
|
||||
typedef struct _IBusM17NEngineClass IBusM17NEngineClass;
|
||||
|
||||
@@ -53,10 +39,7 @@ struct _IBusM17NEngineClass {
|
||||
};
|
||||
|
||||
/* functions prototype */
|
||||
-static GType
|
||||
- ibus_m17n_type_module_get_type (void);
|
||||
static void ibus_m17n_engine_class_init (IBusM17NEngineClass *klass);
|
||||
-static void ibus_m17n_engine_class_finalize (IBusM17NEngineClass *klass);
|
||||
static void ibus_m17n_config_value_changed (IBusConfig *config,
|
||||
const gchar *section,
|
||||
const gchar *name,
|
||||
@@ -119,7 +102,6 @@ static void ibus_m17n_engine_update_look
|
||||
static IBusEngineClass *parent_class = NULL;
|
||||
|
||||
static IBusConfig *config = NULL;
|
||||
-static IBusM17NTypeModule *module = NULL;
|
||||
|
||||
void
|
||||
ibus_m17n_init (IBusBus *bus)
|
||||
@@ -128,55 +110,6 @@ ibus_m17n_init (IBusBus *bus)
|
||||
if (config)
|
||||
g_object_ref_sink (config);
|
||||
ibus_m17n_init_common ();
|
||||
-
|
||||
- module = g_object_new (IBUS_TYPE_M17N_TYPE_MODULE, NULL);
|
||||
-}
|
||||
-
|
||||
-static gboolean
|
||||
-ibus_m17n_type_module_load (GTypeModule *module)
|
||||
-{
|
||||
- return TRUE;
|
||||
-}
|
||||
-
|
||||
-static void
|
||||
-ibus_m17n_type_module_unload (GTypeModule *module)
|
||||
-{
|
||||
-}
|
||||
-
|
||||
-static void
|
||||
-ibus_m17n_type_module_class_init (IBusM17NTypeModuleClass *klass)
|
||||
-{
|
||||
- GTypeModuleClass *module_class = G_TYPE_MODULE_CLASS (klass);
|
||||
-
|
||||
- module_class->load = ibus_m17n_type_module_load;
|
||||
- module_class->unload = ibus_m17n_type_module_unload;
|
||||
-}
|
||||
-
|
||||
-static GType
|
||||
-ibus_m17n_type_module_get_type (void)
|
||||
-{
|
||||
- static GType type = 0;
|
||||
-
|
||||
- static const GTypeInfo type_info = {
|
||||
- sizeof (IBusM17NTypeModuleClass),
|
||||
- (GBaseInitFunc) NULL,
|
||||
- (GBaseFinalizeFunc) NULL,
|
||||
- (GClassInitFunc) ibus_m17n_type_module_class_init,
|
||||
- (GClassFinalizeFunc) NULL,
|
||||
- NULL,
|
||||
- sizeof (IBusM17NTypeModule),
|
||||
- 0,
|
||||
- (GInstanceInitFunc) NULL,
|
||||
- };
|
||||
-
|
||||
- if (type == 0) {
|
||||
- type = g_type_register_static (G_TYPE_TYPE_MODULE,
|
||||
- "IBusM17NTypeModule",
|
||||
- &type_info,
|
||||
- (GTypeFlags) 0);
|
||||
- }
|
||||
-
|
||||
- return type;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@@ -239,14 +172,14 @@ ibus_m17n_engine_get_type_for_name (cons
|
||||
|
||||
GTypeInfo type_info = {
|
||||
sizeof (IBusM17NEngineClass),
|
||||
- (GBaseInitFunc) NULL,
|
||||
- (GBaseFinalizeFunc) NULL,
|
||||
- (GClassInitFunc) ibus_m17n_engine_class_init,
|
||||
- (GClassFinalizeFunc)ibus_m17n_engine_class_finalize,
|
||||
+ (GBaseInitFunc) NULL,
|
||||
+ (GBaseFinalizeFunc) NULL,
|
||||
+ (GClassInitFunc) ibus_m17n_engine_class_init,
|
||||
+ (GClassFinalizeFunc) NULL,
|
||||
NULL,
|
||||
sizeof (IBusM17NEngine),
|
||||
0,
|
||||
- (GInstanceInitFunc) ibus_m17n_engine_init,
|
||||
+ (GInstanceInitFunc) ibus_m17n_engine_init,
|
||||
};
|
||||
|
||||
if (!ibus_m17n_scan_engine_name (engine_name, &lang, &name)) {
|
||||
@@ -264,11 +197,10 @@ ibus_m17n_engine_get_type_for_name (cons
|
||||
g_assert (type == 0 || g_type_is_a (type, IBUS_TYPE_ENGINE));
|
||||
|
||||
if (type == 0) {
|
||||
- type = g_type_module_register_type (G_TYPE_MODULE (module),
|
||||
- IBUS_TYPE_ENGINE,
|
||||
- type_name,
|
||||
- &type_info,
|
||||
- (GTypeFlags) 0);
|
||||
+ type = g_type_register_static (IBUS_TYPE_ENGINE,
|
||||
+ type_name,
|
||||
+ &type_info,
|
||||
+ (GTypeFlags) 0);
|
||||
}
|
||||
g_free (type_name);
|
||||
|
||||
@@ -408,14 +340,6 @@ ibus_m17n_config_value_changed (IBusConf
|
||||
}
|
||||
|
||||
static void
|
||||
-ibus_m17n_engine_class_finalize (IBusM17NEngineClass *klass)
|
||||
-{
|
||||
- if (klass->im)
|
||||
- minput_close_im (klass->im);
|
||||
- g_free (klass->config_section);
|
||||
-}
|
||||
-
|
||||
-static void
|
||||
ibus_m17n_engine_init (IBusM17NEngine *m17n)
|
||||
{
|
||||
IBusText* label;
|
||||
@@ -773,6 +697,16 @@ ibus_m17n_engine_enable (IBusEngine *eng
|
||||
IBusM17NEngine *m17n = (IBusM17NEngine *) engine;
|
||||
|
||||
parent_class->enable (engine);
|
||||
+
|
||||
+#ifdef HAVE_IBUS_ENGINE_GET_SURROUNDING_TEXT
|
||||
+ /* Issue a dummy ibus_engine_get_surrounding_text() call to tell
|
||||
+ input context that we will use surrounding-text. */
|
||||
+ IBusText *text;
|
||||
+ guint cursor_pos;
|
||||
+
|
||||
+ ibus_engine_get_surrounding_text (engine, &text, &cursor_pos);
|
||||
+ g_object_unref (text);
|
||||
+#endif /* HAVE_IBUS_ENGINE_GET_SURROUNDING_TEXT */
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -986,8 +920,57 @@ ibus_m17n_engine_callback (MInputContext
|
||||
}
|
||||
else if (command == Minput_reset) {
|
||||
}
|
||||
- else if (command == Minput_get_surrounding_text) {
|
||||
- }
|
||||
- else if (command == Minput_delete_surrounding_text) {
|
||||
+ /* ibus_engine_get_surrounding_text is only available in the current
|
||||
+ git master (1.3.99+) */
|
||||
+#ifdef HAVE_IBUS_ENGINE_GET_SURROUNDING_TEXT
|
||||
+ else if (command == Minput_get_surrounding_text &&
|
||||
+ (((IBusEngine *) m17n)->client_capabilities &
|
||||
+ IBUS_CAP_SURROUNDING_TEXT) != 0) {
|
||||
+ IBusText *text;
|
||||
+ guint cursor_pos, nchars, nbytes;
|
||||
+ MText *mt, *surround;
|
||||
+ int len, pos;
|
||||
+
|
||||
+ ibus_engine_get_surrounding_text ((IBusEngine *) m17n,
|
||||
+ &text,
|
||||
+ &cursor_pos);
|
||||
+ nchars = ibus_text_get_length (text);
|
||||
+ nbytes = g_utf8_offset_to_pointer (text->text, nchars) - text->text;
|
||||
+ mt = mconv_decode_buffer (Mcoding_utf_8, text->text, nbytes);
|
||||
+ g_object_unref (text);
|
||||
+
|
||||
+ len = (long) mplist_value (m17n->context->plist);
|
||||
+ if (len < 0) {
|
||||
+ pos = cursor_pos + len;
|
||||
+ if (pos < 0)
|
||||
+ pos = 0;
|
||||
+ surround = mtext_duplicate (mt, pos, cursor_pos);
|
||||
+ }
|
||||
+ else if (len > 0) {
|
||||
+ pos = cursor_pos + len;
|
||||
+ if (pos > nchars)
|
||||
+ pos = nchars;
|
||||
+ surround = mtext_duplicate (mt, cursor_pos, pos);
|
||||
+ }
|
||||
+ else {
|
||||
+ surround = mtext ();
|
||||
+ }
|
||||
+ m17n_object_unref (mt);
|
||||
+ mplist_set (m17n->context->plist, Mtext, surround);
|
||||
+ m17n_object_unref (surround);
|
||||
+ }
|
||||
+#endif /* !HAVE_IBUS_ENGINE_GET_SURROUNDING_TEXT */
|
||||
+ else if (command == Minput_delete_surrounding_text &&
|
||||
+ (((IBusEngine *) m17n)->client_capabilities &
|
||||
+ IBUS_CAP_SURROUNDING_TEXT) != 0) {
|
||||
+ int len;
|
||||
+
|
||||
+ len = (long) mplist_value (m17n->context->plist);
|
||||
+ if (len < 0)
|
||||
+ ibus_engine_delete_surrounding_text ((IBusEngine *) m17n,
|
||||
+ len, -len);
|
||||
+ else if (len > 0)
|
||||
+ ibus_engine_delete_surrounding_text ((IBusEngine *) m17n,
|
||||
+ 0, len);
|
||||
}
|
||||
}
|
@ -27,14 +27,6 @@ index 4df68b6..089aafb 100644
|
||||
|
||||
# OUTPUT files
|
||||
AC_CONFIG_FILES([ po/Makefile.in
|
||||
diff --git a/m4/.gitignore b/m4/.gitignore
|
||||
index 0f4126c..e28d185 100644
|
||||
--- a/m4/.gitignore
|
||||
+++ b/m4/.gitignore
|
||||
@@ -1 +1,3 @@
|
||||
*.m4
|
||||
+!ibus.m4
|
||||
+
|
||||
diff --git a/m4/ibus.m4 b/m4/ibus.m4
|
||||
new file mode 100644
|
||||
index 0000000..f8f074a
|
||||
|
Loading…
Reference in New Issue
Block a user