summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorHuang Peng <shawn.p.huang@gmail.com>2009-03-22 20:31:06 +0800
committerHuang Peng <shawn.p.huang@gmail.com>2009-03-22 20:31:06 +0800
commit2bd2d52476f4828f915ee54182cc0a654f05af53 (patch)
treeb21bf2b24846e0320a841ab1ee288a68422d4270 /src
parentbdb7e54c92b6a111a69889b85a17452b6e9d9abf (diff)
downloadibus-2bd2d52476f4828f915ee54182cc0a654f05af53.tar.gz
ibus-2bd2d52476f4828f915ee54182cc0a654f05af53.tar.xz
ibus-2bd2d52476f4828f915ee54182cc0a654f05af53.zip
Add method ibus_engine_update_lookup_table_fast, it only sends current page.
Diffstat (limited to 'src')
-rw-r--r--src/ibusengine.c36
-rw-r--r--src/ibusengine.h4
2 files changed, 37 insertions, 3 deletions
diff --git a/src/ibusengine.c b/src/ibusengine.c
index e664454..aa02b2f 100644
--- a/src/ibusengine.c
+++ b/src/ibusengine.c
@@ -915,9 +915,10 @@ ibus_engine_hide_auxiliary_text (IBusEngine *engine)
G_TYPE_INVALID);
}
-void ibus_engine_update_lookup_table (IBusEngine *engine,
- IBusLookupTable *table,
- gboolean visible)
+void
+ibus_engine_update_lookup_table (IBusEngine *engine,
+ IBusLookupTable *table,
+ gboolean visible)
{
_send_signal (engine,
"UpdateLookupTable",
@@ -926,6 +927,35 @@ void ibus_engine_update_lookup_table (IBusEngine *engine,
G_TYPE_INVALID);
}
+void
+ibus_engine_update_lookup_table_fast (IBusEngine *engine,
+ IBusLookupTable *table,
+ gboolean visible)
+{
+ IBusLookupTable *new_table;
+ gint page_begin;
+ gint i;
+
+ if (table->candidates->len < table->page_size << 2) {
+ ibus_engine_update_lookup_table (engine, table, visible);
+ return;
+ }
+
+ page_begin = (table->cursor_pos / table->page_size) * table->page_size;
+
+ new_table = ibus_lookup_table_new (table->page_size, 0, table->cursor_visible, table->round);
+
+ for (i = page_begin; i < page_begin + table->page_size && i < table->candidates->len; i++) {
+ ibus_lookup_table_append_candidate (new_table, ibus_lookup_table_get_candidate (table, i));
+ }
+
+ ibus_lookup_table_set_cursor_pos (new_table, ibus_lookup_table_get_cursor_in_page (table));
+
+ ibus_engine_update_lookup_table (engine, new_table, visible);
+
+ g_object_unref (new_table);
+}
+
void ibus_engine_show_lookup_table (IBusEngine *engine)
{
_send_signal (engine,
diff --git a/src/ibusengine.h b/src/ibusengine.h
index 5a86bf0..4fe12dc 100644
--- a/src/ibusengine.h
+++ b/src/ibusengine.h
@@ -129,6 +129,10 @@ void ibus_engine_update_lookup_table
(IBusEngine *engine,
IBusLookupTable *lookup_table,
gboolean visible);
+void ibus_engine_update_lookup_table_fast
+ (IBusEngine *engine,
+ IBusLookupTable *lookup_table,
+ gboolean visible);
void ibus_engine_show_lookup_table
(IBusEngine *engine);
void ibus_engine_hide_lookup_table