~ubuntu-branches/ubuntu/saucy/fcitx/saucy-proposed

« back to all changes in this revision

Viewing changes to debian/patches/0009-gnumeric_cursor_keys_edit.patch

  • Committer: Package Import Robot
  • Author(s): YunQiang Su
  • Date: 2012-09-26 22:08:29 UTC
  • mfrom: (10.1.28 sid)
  • Revision ID: package-import@ubuntu.com-20120926220829-lawti2wqb6lmd5sc
Tags: 1:4.2.4.1-7
improve 0009-gnumeric_cursor_keys_edit.patch to fix bug
completely.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
Index: fcitx/src/frontend/ipc/ipc.c
 
2
===================================================================
 
3
--- fcitx.orig/src/frontend/ipc/ipc.c   2012-09-26 22:01:16.354865405 +0800
 
4
+++ fcitx/src/frontend/ipc/ipc.c        2012-09-26 22:02:26.979215609 +0800
 
5
@@ -43,6 +43,7 @@
 
6
     char* surroundingText;
 
7
     unsigned int anchor;
 
8
     unsigned int cursor;
 
9
+    boolean lastPreeditIsEmpty;
 
10
 } FcitxIPCIC;
 
11
 
 
12
 typedef struct _FcitxIPCFrontend {
 
13
@@ -349,6 +350,7 @@
 
14
 
 
15
     ipcic->id = ipc->maxid;
 
16
     ipc->maxid ++;
 
17
+    ipcic->lastPreeditIsEmpty = false;
 
18
     sprintf(ipcic->path, FCITX_IC_DBUS_PATH, ipcic->id);
 
19
 
 
20
     uint32_t arg1, arg2, arg3, arg4;
 
21
@@ -930,6 +932,23 @@
 
22
 
 
23
 void IPCUpdatePreedit(void* arg, FcitxInputContext* ic)
 
24
 {
 
25
+    FcitxIPCFrontend* ipc = (FcitxIPCFrontend*) arg;
 
26
+    FcitxInputState* input = FcitxInstanceGetInputState(ipc->owner);
 
27
+    FcitxMessages* clientPreedit = FcitxInputStateGetClientPreedit(input);
 
28
+    int i = 0;
 
29
+    for (i = 0; i < FcitxMessagesGetMessageCount(clientPreedit) ; i ++) {
 
30
+        char* str = FcitxMessagesGetMessageString(clientPreedit, i);
 
31
+        if (!fcitx_utf8_check_string(str))
 
32
+            return;
 
33
+    }
 
34
+
 
35
+    /* a small optimization, don't need to update empty preedit */
 
36
+    FcitxIPCIC* ipcic = GetIPCIC(ic);
 
37
+    if (ipcic->lastPreeditIsEmpty && FcitxMessagesGetMessageCount(clientPreedit) == 0)
 
38
+        return;
 
39
+
 
40
+    ipcic->lastPreeditIsEmpty = (FcitxMessagesGetMessageCount(clientPreedit) == 0);
 
41
+
 
42
     if (ic->contextCaps & CAPACITY_FORMATTED_PREEDIT) {
 
43
         FcitxIPCFrontend* ipc = (FcitxIPCFrontend*) arg;
 
44
         dbus_uint32_t serial = 0; // unique number to associate replies with requests
 
45
Index: fcitx/data/script/fcitx-configtool
 
46
===================================================================
 
47
--- fcitx.orig/data/script/fcitx-configtool     2012-09-26 22:01:57.235068121 +0800
 
48
+++ fcitx/data/script/fcitx-configtool  2012-09-26 22:03:16.283460099 +0800
 
49
@@ -32,7 +32,7 @@
 
50
             exec $command kcm_fcitx
 
51
         fi
 
52
     else
 
53
-        run_gtk $1
 
54
+        run_gtk3 $1
 
55
     fi
 
56
 }
 
57
 
 
58
Index: fcitx/src/frontend/gtk2/fcitximcontext.c
 
59
===================================================================
 
60
--- fcitx.orig/src/frontend/gtk2/fcitximcontext.c       2012-09-26 22:01:57.235068121 +0800
 
61
+++ fcitx/src/frontend/gtk2/fcitximcontext.c    2012-09-26 22:03:16.287460117 +0800
 
62
@@ -465,7 +465,7 @@
 
63
 
 
64
             /* set_cursor_location_internal() will get origin from X server,
 
65
             * it blocks UI. So delay it to idle callback. */
 
66
-            g_idle_add_full(G_PRIORITY_DEFAULT_IDLE,
 
67
+            gdk_threads_add_idle_full(G_PRIORITY_DEFAULT_IDLE,
 
68
                             (GSourceFunc) _set_cursor_location_internal,
 
69
                             g_object_ref(fcitxcontext),
 
70
                             (GDestroyNotify) g_object_unref);
 
71
@@ -584,8 +584,6 @@
 
72
             /* do nothing */
 
73
         }
 
74
     }
 
75
-
 
76
-    g_signal_emit(context, _signal_preedit_changed_id, 0);
 
77
 }
 
78
 
 
79
 static void
 
80
@@ -695,8 +693,6 @@
 
81
             /* do nothing */
 
82
         }
 
83
     }
 
84
-
 
85
-    g_signal_emit(context, _signal_preedit_changed_id, 0);
 
86
 }
 
87
 
 
88
 ///
 
89
@@ -727,7 +723,7 @@
 
90
 
 
91
     /* set_cursor_location_internal() will get origin from X server,
 
92
      * it blocks UI. So delay it to idle callback. */
 
93
-    g_idle_add_full(G_PRIORITY_DEFAULT_IDLE,
 
94
+    gdk_threads_add_idle_full(G_PRIORITY_DEFAULT_IDLE,
 
95
                     (GSourceFunc) _set_cursor_location_internal,
 
96
                     g_object_ref(fcitxcontext),
 
97
                     (GDestroyNotify) g_object_unref);