summaryrefslogtreecommitdiff
path: root/java/jdk14/files/patch-awt_InputMethod.c
blob: db52b6d18e887f380f9ac631620ccabd1a7d9c79 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
$FreeBSD$

diff -u -r1.5 awt_InputMethod.c
--- ../src/solaris/native/sun/awt/awt_InputMethod.c	10 Sep 2001 05:31:35 -0000	1.5
+++ ../src/solaris/native/sun/awt/awt_InputMethod.c	18 Oct 2002 02:58:26 -0000
@@ -1320,17 +1320,56 @@
     X11InputMethodData *pX11IMData =
 	(X11InputMethodData *) (unsigned long) data;
     char *xText;
+    char *ret;
     jstring jText;
 
+    XIMPreeditState preeditState = XIMPreeditUnKnown;
+    XVaNestedList preeditAttr;
+    int bGetState = FALSE;
+
     AWT_LOCK();
 
-    if (pX11IMData->current_ic)
+    if (pX11IMData->current_ic) {
+	preeditAttr = XVaCreateNestedList(0, XNPreeditState, &preeditState, 
+                                          NULL);
+        if (!XGetICValues(pX11IMData->current_ic, XNPreeditAttributes, 
+                          preeditAttr, NULL)) {
+             bGetState = TRUE;
+        }
+        XFree(preeditAttr);
+
 	xText = XmbResetIC(pX11IMData->current_ic);
+
+        if (bGetState) {
+             preeditAttr = XVaCreateNestedList(0, XNPreeditState, 
+                                               preeditState, 0);
+             XSetICValues(pX11IMData->current_ic,
+                          XNPreeditAttributes, preeditAttr, NULL);
+             XFree(preeditAttr);
+        }
+    }
     else {
 	/*
 	 * If there is no reference to the current XIC, try to reset both XICs.
 	 */
+        preeditAttr = XVaCreateNestedList(0, XNPreeditState, &preeditState, 
+                                          NULL);
+        if (!XGetICValues(pX11IMData->ic_active, XNPreeditAttributes, 
+                          preeditAttr, NULL)) {
+            bGetState = TRUE;
+        }
+        XFree(preeditAttr);
+
 	xText = XmbResetIC(pX11IMData->ic_active);
+
+        if (bGetState) {
+            preeditAttr = XVaCreateNestedList(0, XNPreeditState, 
+                                              preeditState, 0);
+            XSetICValues(pX11IMData->ic_active, XNPreeditAttributes, 
+                         preeditAttr, NULL);
+            XFree(preeditAttr);
+        }
+
         /*it may also means that the real client component does 
           not have focus -- has been deactivated... its xic should 
           not have the focus, bug#4284651 showes reset XIC for htt