annotate lib/imlib/imconv.c @ 21:7a454839a6de default tip

add some missing header files
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Tue, 09 Mar 2010 19:02:39 +0900
parents eda83436b27e
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1 #ifndef lint
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
2 static char *rcsid = "$Id: imconv.c,v 1.25 2002/01/24 09:07:19 ishisone Exp $";
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
3 #endif
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
4 /*
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
5 * Copyright (c) 1991, 1994 Software Research Associates, Inc.
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
6 *
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
7 * Permission to use, copy, modify, and distribute this software and its
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
8 * documentation for any purpose and without fee is hereby granted, provided
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
9 * that the above copyright notice appear in all copies and that both that
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
10 * copyright notice and this permission notice appear in supporting
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
11 * documentation, and that the name of Software Research Associates not be
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
12 * used in advertising or publicity pertaining to distribution of the
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
13 * software without specific, written prior permission. Software Research
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
14 * Associates makes no representations about the suitability of this software
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
15 * for any purpose. It is provided "as is" without express or implied
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
16 * warranty.
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
17 *
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
18 * Author: Makoto Ishisone, Software Research Associates, Inc., Japan
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
19 */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
20
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
21 #define COMMIT_SYNC
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
22 #define STATUS_SYNC
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
23 #include "im.h"
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
24 #include "ConvMgr.h"
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
25 #include "OverConv.h"
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
26 #include "OffConv.h"
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
27 #include "OnConv.h"
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
28 #include "InputConv.h"
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
29
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
30 static void fillDefaultAttributesForStartup _Pt_((IMIC *icp));
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
31 static unsigned long makeConvAttributesForStartup _Pt_((IMIC *icp,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
32 ConversionAttributes *attrp));
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
33 static void commitString _Pt_((IMIC *icp, char *str, int len, int sync));
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
34 static void fixCallback _Pt_((Widget w, XtPointer client_data,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
35 XtPointer call_data));
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
36 static void detachConverter _Pt_((IMIC *icp));
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
37 static void endCallback _Pt_((Widget w, XtPointer client_data,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
38 XtPointer call_data));
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
39 static void unusedEventCallback _Pt_((Widget w, XtPointer client_data,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
40 XtPointer call_data));
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
41 static void preeditStartCallback _Pt_((Widget w, XtPointer client_data,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
42 XtPointer call_data));
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
43 static void preeditDoneCallback _Pt_((Widget w, XtPointer client_data,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
44 XtPointer call_data));
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
45 static void preeditDrawCallback _Pt_((Widget w, XtPointer client_data,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
46 XtPointer call_data));
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
47 static void preeditCaretCallback _Pt_((Widget w, XtPointer client_data,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
48 XtPointer call_data));
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
49 static void statusStartCallback _Pt_((Widget w, XtPointer client_data,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
50 XtPointer call_data));
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
51 static void statusDoneCallback _Pt_((Widget w, XtPointer client_data,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
52 XtPointer call_data));
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
53 static void statusDrawCallback _Pt_((Widget w, XtPointer client_data,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
54 XtPointer call_data));
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
55 static void preeditStart _Pt_((IMIC *icp));
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
56 static void preeditDone _Pt_((IMIC *icp));
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
57 static void preeditDraw _Pt_((IMIC *icp, OCCPreeditDrawArg *data));
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
58 static void preeditCaret _Pt_((IMIC *icp, int caret));
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
59 static void statusStart _Pt_((IMIC *icp));
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
60 static void statusDone _Pt_((IMIC *icp));
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
61 static void statusDraw _Pt_((IMIC *icp, OCCPreeditDrawArg *data));
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
62 static void setEventMask _Pt_((IMIC *icp, unsigned long forward_mask,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
63 unsigned long synchronous_mask));
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
64
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
65
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
66 /*- fillDefaultAttributesForStartup: put default necessary for conv. start -*/
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
67 static void
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
68 fillDefaultAttributesForStartup(icp)
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
69 IMIC *icp;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
70 {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
71 unsigned long cmask, pmask, smask;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
72
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
73 cmask = ATTR_MASK_FOCUS | ATTR_MASK_PREEDIT_STATE | ATTR_MASK_RESET_STATE;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
74
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
75 switch (icp->style) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
76 case IMSTYLE_OVER_THE_SPOT:
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
77 pmask = ATTR_MASK_FOREGROUND | ATTR_MASK_BACKGROUND |
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
78 ATTR_MASK_FONT_SET;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
79 smask = 0;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
80 break;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
81 case IMSTYLE_OFF_THE_SPOT:
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
82 pmask = ATTR_MASK_FOREGROUND | ATTR_MASK_BACKGROUND |
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
83 ATTR_MASK_FONT_SET | ATTR_MASK_AREA;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
84 smask = ATTR_MASK_AREA;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
85 break;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
86 case IMSTYLE_ON_THE_SPOT:
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
87 pmask = 0;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
88 smask = 0;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
89 break;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
90 default:
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
91 pmask = 0;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
92 smask = 0;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
93 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
94 IMFillDefault(icp, cmask, pmask, smask);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
95 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
96
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
97 /*- makeConvAttributesForStartup: get conv. attrs needed for startup -*/
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
98 static unsigned long
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
99 makeConvAttributesForStartup(icp, attrp)
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
100 IMIC *icp;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
101 ConversionAttributes *attrp;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
102 {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
103 icp->common_attr.change_mask = icp->common_attr.set_mask;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
104 icp->preedit_attr.change_mask = icp->preedit_attr.set_mask;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
105 icp->status_attr.change_mask = icp->status_attr.set_mask;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
106 return IMMakeConvAttributes(icp, attrp);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
107 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
108
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
109 /*- commitString: commmit converted string to client -*/
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
110 static void
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
111 commitString(icp, str, len, sync)
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
112 IMIC *icp;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
113 char *str;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
114 int len;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
115 int sync;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
116 {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
117 int offset;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
118 IMConnection *conn = icp->im->connection;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
119 unsigned int flag;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
120
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
121 TRACE(("imlib:commitString()\n"));
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
122
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
123 if (DDEBUG_CONDITION(5)) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
124 unsigned char *p = (unsigned char *)str;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
125 int i;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
126
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
127 /*
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
128 * Dump commiting string.
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
129 */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
130 printf("* commit string:\n\t");
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
131 for (i = 0; i < len; i++, p++) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
132 if (*p == '\033') {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
133 printf("ESC ");
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
134 } else if (*p < ' ') {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
135 printf("^%c ", *p + '@');
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
136 } else if (*p == ' ') {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
137 printf("sp ");
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
138 } else if (*p >= 0x7f) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
139 printf("%x ", *p);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
140 } else {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
141 printf("%c ", *p);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
142 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
143 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
144 printf("\n");
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
145 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
146
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
147 flag = XIM_FLAG_X_LOOKUP_CHARS;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
148 if (sync) flag |= XIM_FLAG_SYNCHRONOUS;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
149
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
150 offset = IMPutHeader(conn, XIM_COMMIT, 0, 0);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
151 IMPutC16(conn, icp->im->id);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
152 IMPutC16(conn, icp->id);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
153 IMPutC16(conn, flag);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
154 IMPutC16(conn, (unsigned int)len);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
155 IMPutString(conn, str, len);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
156 IMFinishRequest(conn, offset);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
157 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
158
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
159 /*- fixCallback: fix callback -*/
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
160 /* ARGSUSED */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
161 static void
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
162 fixCallback(w, client_data, call_data)
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
163 Widget w;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
164 XtPointer client_data;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
165 XtPointer call_data;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
166 {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
167 IMIC *icp = (IMIC *)client_data;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
168 IMConnection *conn = icp->im->connection;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
169 Widget proto = conn->proto_widget;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
170 Atom ctext = IMCtextAtom(proto);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
171 CCTextCallbackArg *arg = (CCTextCallbackArg *)call_data;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
172
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
173 TRACE(("imlib:fixCallback()\n"));
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
174
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
175 /* check encoding and format */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
176 if (arg->encoding != ctext || arg->format != 8) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
177 /*
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
178 * since every conversion object must support COMPOUND_TEXT,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
179 * it is a serious error.
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
180 */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
181 String params[2];
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
182 Cardinal num_params;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
183 WidgetClass ioc = icp->im->converter->input_object_class;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
184
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
185 params[0] = XtClass(proto)->core_class.class_name;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
186 params[1] = ioc->core_class.class_name;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
187 num_params = 2;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
188
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
189 XtAppErrorMsg(XtWidgetToApplicationContext(proto),
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
190 "encodingError", "convertedString", "WidgetError",
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
191 "%s: encoding of the converted string is not COMPOUND_STRING. check inputObject %s",
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
192 params, &num_params);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
193 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
194
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
195 /*
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
196 * Send fixed string via XIM_COMMIT message.
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
197 * Since kinput2 uses full-synchronous mode,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
198 * synchronous flag must be turned off.
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
199 */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
200 commitString(icp, arg->text, arg->length, 0);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
201
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
202 #ifdef COMMIT_SYNC
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
203 /*
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
204 * Send XIM_SYNC_REPLY so that synchronize with clients here.
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
205 */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
206 if (icp->state & IC_FORWARDING) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
207 icp->state &= ~IC_FORWARDING;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
208 IMSendRequestWithIC(conn, XIM_SYNC_REPLY, 0, icp);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
209 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
210 #endif /* COMMIT_SYNC */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
211 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
212
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
213 /*- detachConverter: detach conversion widget from specified IC -*/
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
214 static void
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
215 detachConverter(icp)
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
216 IMIC *icp;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
217 {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
218 Widget conv;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
219
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
220 TRACE(("imlib:detachConverter()\n"));
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
221
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
222 conv = icp->conversion;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
223 XtRemoveCallback(conv, XtNtextCallback, fixCallback, (XtPointer)icp);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
224 XtRemoveCallback(conv, XtNendCallback, endCallback, (XtPointer)icp);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
225 XtRemoveCallback(conv, XtNunusedEventCallback, unusedEventCallback, (XtPointer)icp);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
226 if (icp->style == IMSTYLE_ON_THE_SPOT) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
227 XtRemoveCallback(conv, XtNpreeditStartCallback, preeditStartCallback,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
228 (XtPointer)icp);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
229 XtRemoveCallback(conv, XtNpreeditDoneCallback, preeditDoneCallback,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
230 (XtPointer)icp);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
231 XtRemoveCallback(conv, XtNpreeditDrawCallback, preeditDrawCallback,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
232 (XtPointer)icp);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
233 XtRemoveCallback(conv, XtNpreeditCaretCallback, preeditCaretCallback,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
234 (XtPointer)icp);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
235 XtRemoveCallback(conv, XtNstatusStartCallback, statusStartCallback,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
236 (XtPointer)icp);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
237 XtRemoveCallback(conv, XtNstatusDoneCallback, statusDoneCallback,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
238 (XtPointer)icp);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
239 XtRemoveCallback(conv, XtNstatusDrawCallback, statusDrawCallback,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
240 (XtPointer)icp);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
241 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
242
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
243 CMReleaseConverter(XtParent(icp->im->connection->proto_widget), conv);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
244 icp->conversion = NULL;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
245 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
246
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
247 /*- endCallback: conversion end callback -*/
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
248 /* ARGSUSED */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
249 static void
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
250 endCallback(w, client_data, call_data)
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
251 Widget w;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
252 XtPointer client_data;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
253 XtPointer call_data;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
254 {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
255 IMIC *icp = (IMIC *)client_data;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
256
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
257 TRACE(("imlib:endCallback()\n"));
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
258
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
259 if (icp->state & IC_CONVERTING) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
260 detachConverter(icp);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
261 icp->state &= ~IC_CONVERTING;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
262 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
263 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
264
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
265 /*- unusedEventCallback: unused key event callback -*/
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
266 /* ARGSUSED */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
267 static void
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
268 unusedEventCallback(w, client_data, call_data)
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
269 Widget w;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
270 XtPointer client_data;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
271 XtPointer call_data;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
272 {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
273 IMIC *icp = (IMIC *)client_data;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
274 IMConnection *conn = icp->im->connection;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
275 XKeyEvent *ev = (XKeyEvent *)call_data;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
276 int offset;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
277
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
278 TRACE(("imlib:unusedEventCallback()\n"));
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
279
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
280 if (icp->im->mask & XIM_EXT_FORWARD_KEYEVENT_MASK) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
281 offset = IMPutHeader(conn, XIM_EXT_FORWARD_KEYEVENT, 0, 0);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
282 IMPutC16(conn, icp->im->id);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
283 IMPutC16(conn, icp->id);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
284 IMPutC16(conn, 0);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
285 IMPutC16(conn, (unsigned int)(ev->serial & 0xffff));
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
286 IMPutC8(conn, ev->type);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
287 IMPutC8(conn, (int)ev->keycode);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
288 IMPutC16(conn, (unsigned int)ev->state);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
289 IMPutC32(conn, ev->time);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
290 IMPutC32(conn, ev->window);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
291 IMFinishRequest(conn, offset);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
292 } else {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
293 offset = IMPutHeader(conn, XIM_FORWARD_EVENT, 0, 0);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
294 IMPutC16(conn, icp->im->id);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
295 IMPutC16(conn, icp->id);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
296 IMPutC16(conn, 0); /* ?? */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
297 IMPutC16(conn, (unsigned int)((ev->serial >> 16) & 0xffff));
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
298
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
299 IMPutC8(conn, ev->type);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
300 IMPutC8(conn, (int)ev->keycode);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
301 IMPutC16(conn, (unsigned int)(ev->serial & 0xffff));
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
302 IMPutC32(conn, ev->time);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
303 IMPutC32(conn, ev->root);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
304 IMPutC32(conn, ev->window);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
305 IMPutC32(conn, ev->subwindow);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
306 IMPutI16(conn, ev->x_root);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
307 IMPutI16(conn, ev->y_root);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
308 IMPutI16(conn, ev->x);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
309 IMPutI16(conn, ev->y);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
310 IMPutC16(conn, ev->state);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
311 IMPutC8(conn, ev->same_screen);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
312
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
313 IMFinishRequest(conn, offset);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
314 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
315 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
316
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
317 /*- preeditStartCallback: preedit start -*/
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
318 /* ARGSUSED */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
319 static void
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
320 preeditStartCallback(w, client_data, call_data)
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
321 Widget w;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
322 XtPointer client_data;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
323 XtPointer call_data;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
324 {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
325 IMIC *icp = (IMIC *)client_data;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
326
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
327 TRACE(("preeditStartCallback(icp=0x%lx)\n", icp));
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
328
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
329 if (!(icp->common_attr.input_style & XIMPreeditCallbacks))
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
330 return;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
331
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
332 preeditStart(icp);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
333 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
334
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
335 /*- preeditDoneCallback: preedit done -*/
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
336 /* ARGSUSED */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
337 static void
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
338 preeditDoneCallback(w, client_data, call_data)
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
339 Widget w;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
340 XtPointer client_data;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
341 XtPointer call_data;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
342 {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
343 IMIC *icp = (IMIC *)client_data;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
344
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
345 TRACE(("preeditDoneCallback(icp=0x%lx)\n", icp));
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
346
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
347 if (!(icp->common_attr.input_style & XIMPreeditCallbacks))
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
348 return;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
349
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
350 preeditDone(icp);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
351 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
352
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
353 /*- preeditDrawCallback: preedit draw -*/
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
354 /* ARGSUSED */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
355 static void
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
356 preeditDrawCallback(w, client_data, call_data)
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
357 Widget w;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
358 XtPointer client_data;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
359 XtPointer call_data;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
360 {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
361 IMIC *icp = (IMIC *)client_data;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
362 OCCPreeditDrawArg *arg = (OCCPreeditDrawArg *)call_data;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
363 IMConnection *conn = icp->im->connection;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
364 Widget proto = conn->proto_widget;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
365 Atom ctext = IMCtextAtom(proto);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
366
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
367 TRACE(("preeditDrawCallback(icp=0x%lx, length=%d)\n",icp,arg->text_length));
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
368
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
369 if (!(icp->common_attr.input_style & XIMPreeditCallbacks))
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
370 return;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
371
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
372 /* check encoding and format */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
373 if (arg->encoding != ctext || arg->format != 8) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
374 /*
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
375 * since every conversion object must support COMPOUND_TEXT,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
376 * it is a serious error.
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
377 */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
378 String params[2];
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
379 Cardinal num_params;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
380 WidgetClass ioc = icp->im->converter->input_object_class;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
381
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
382 params[0] = XtClass(proto)->core_class.class_name;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
383 params[1] = ioc->core_class.class_name;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
384 num_params = 2;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
385
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
386 XtAppErrorMsg(XtWidgetToApplicationContext(proto),
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
387 "encodingError", "preeditString", "WidgetError",
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
388 "%s: encoding of the preedit string is not COMPOUND_STRING. check inputObject %s",
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
389 params, &num_params);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
390 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
391
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
392 preeditDraw(icp, arg);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
393 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
394
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
395 /*- preeditCaretCallback: preedit caret -*/
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
396 /* ARGSUSED */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
397 static void
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
398 preeditCaretCallback(w, client_data, call_data)
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
399 Widget w;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
400 XtPointer client_data;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
401 XtPointer call_data;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
402 {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
403 IMIC *icp = (IMIC *)client_data;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
404 int caret = (int)call_data;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
405
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
406 TRACE(("preeditCaretCallback(icp=0x%lx, caret=%d)\n", icp, caret));
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
407
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
408 if (!(icp->common_attr.input_style & XIMPreeditCallbacks))
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
409 return;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
410
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
411 preeditCaret(icp, caret);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
412 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
413
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
414 /*- statusStartCallback: status start -*/
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
415 /* ARGSUSED */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
416 static void
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
417 statusStartCallback(w, client_data, call_data)
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
418 Widget w;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
419 XtPointer client_data;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
420 XtPointer call_data;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
421 {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
422 IMIC *icp = (IMIC *)client_data;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
423
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
424 TRACE(("statusStartCallback(icp=0x%lx)\n", icp));
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
425
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
426 if (!(icp->common_attr.input_style & XIMStatusCallbacks))
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
427 return;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
428
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
429 statusStart(icp);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
430 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
431
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
432 /*- statusDoneCallback: status done -*/
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
433 /* ARGSUSED */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
434 static void
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
435 statusDoneCallback(w, client_data, call_data)
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
436 Widget w;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
437 XtPointer client_data;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
438 XtPointer call_data;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
439 {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
440 IMIC *icp = (IMIC *)client_data;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
441
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
442 TRACE(("statusDoneCallback(icp=0x%lx)\n", icp));
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
443
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
444 if (!(icp->common_attr.input_style & XIMStatusCallbacks))
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
445 return;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
446
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
447 statusDone(icp);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
448 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
449
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
450 /*- statusDrawCallback: status draw -*/
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
451 /* ARGSUSED */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
452 static void
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
453 statusDrawCallback(w, client_data, call_data)
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
454 Widget w;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
455 XtPointer client_data;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
456 XtPointer call_data;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
457 {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
458 IMIC *icp = (IMIC *)client_data;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
459 OCCPreeditDrawArg *arg = (OCCPreeditDrawArg *)call_data;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
460 IMConnection *conn = icp->im->connection;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
461 Widget proto = conn->proto_widget;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
462 Atom ctext = IMCtextAtom(proto);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
463
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
464 TRACE(("statusDrawCallback(icp=0x%lx, length=%d)\n", icp,arg->text_length));
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
465
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
466 if (!(icp->common_attr.input_style & XIMStatusCallbacks))
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
467 return;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
468
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
469 /* check encoding and format */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
470 if (arg->encoding != ctext || arg->format != 8) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
471 /*
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
472 * since every conversion object must support COMPOUND_TEXT,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
473 * it is a serious error.
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
474 */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
475 String params[2];
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
476 Cardinal num_params;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
477 WidgetClass ioc = icp->im->converter->input_object_class;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
478
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
479 params[0] = XtClass(proto)->core_class.class_name;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
480 params[1] = ioc->core_class.class_name;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
481 num_params = 2;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
482
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
483 XtAppErrorMsg(XtWidgetToApplicationContext(proto),
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
484 "encodingError", "statusString", "WidgetError",
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
485 "%s: encoding of the status string is not COMPOUND_STRING. check inputObject %s",
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
486 params, &num_params);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
487 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
488
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
489 statusDraw(icp, arg);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
490 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
491
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
492 /*- preeditStart: do preedit start -*/
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
493 static void
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
494 preeditStart(icp)
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
495 IMIC *icp;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
496 {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
497 if (!(icp->state & IC_IN_PREEDIT)) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
498 int offset;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
499 IMConnection *conn = icp->im->connection;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
500
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
501 TRACE(("imlib:preeditStart()\n"));
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
502
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
503 offset = IMPutHeader(conn, XIM_PREEDIT_START, 0, 0);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
504 IMPutC16(conn, icp->im->id);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
505 IMPutC16(conn, icp->id);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
506 IMFinishRequest(conn, offset);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
507 icp->state |= IC_IN_PREEDIT;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
508 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
509 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
510
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
511 /*- preeditDone: do preedit done -*/
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
512 static void
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
513 preeditDone(icp)
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
514 IMIC *icp;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
515 {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
516 if (icp->state & IC_IN_PREEDIT) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
517 int offset;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
518 IMConnection *conn = icp->im->connection;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
519
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
520 TRACE(("imlib:preeditDone()\n"));
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
521
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
522 offset = IMPutHeader(conn, XIM_PREEDIT_DONE, 0, 0);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
523 IMPutC16(conn, icp->im->id);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
524 IMPutC16(conn, icp->id);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
525 IMFinishRequest(conn, offset);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
526 icp->state &= ~IC_IN_PREEDIT;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
527 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
528 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
529
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
530 /*- preeditDraw: do actual preedit draw -*/
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
531 static void
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
532 preeditDraw(icp, data)
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
533 IMIC *icp;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
534 OCCPreeditDrawArg *data;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
535 {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
536 IMConnection *conn = icp->im->connection;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
537 int offset;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
538 unsigned int status;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
539 XIMFeedback feedback;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
540 int i;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
541
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
542 if (icp->state & IC_RESETTING) return;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
543
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
544 preeditStart(icp);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
545
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
546 TRACE(("imlib:preeditDraw()\n"));
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
547
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
548 if (DDEBUG_CONDITION(5)) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
549 unsigned char *p = (unsigned char *)data->text;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
550
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
551 /*
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
552 * Dump preedit string.
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
553 */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
554 printf("* preedit string:\n\t");
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
555 for (i = 0; i < data->text_length; i++, p++) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
556 if (*p == '\033') {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
557 printf("ESC ");
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
558 } else if (*p < ' ') {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
559 printf("^%c ", *p + '@');
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
560 } else if (*p == ' ') {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
561 printf("sp ");
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
562 } else if (*p >= 0x7f) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
563 printf("%x ", *p);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
564 } else {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
565 printf("%c ", *p);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
566 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
567 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
568 printf("\n");
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
569 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
570
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
571 offset = IMPutHeader(conn, XIM_PREEDIT_DRAW, 0, 0);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
572 IMPutC16(conn, icp->im->id);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
573 IMPutC16(conn, icp->id);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
574 IMPutC32(conn, data->caret);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
575 IMPutC32(conn, data->chg_first);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
576 IMPutC32(conn, data->chg_length);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
577 status = 0;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
578 if (data->text_length == 0) status |= 0x1; /* no string */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
579 if (data->attrs_length == 0) status |= 0x2; /* no feedback */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
580 IMPutC32(conn, status);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
581 IMPutC16(conn, (unsigned int)data->text_length);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
582 if (data->text_length > 0) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
583 IMPutString(conn, data->text, data->text_length);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
584 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
585 IMPutPad(conn);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
586 IMPutC16(conn, (unsigned int)(data->attrs_length * 4));
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
587 IMPutC16(conn, 0L); /* unused */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
588 if (data->attrs_length > 0) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
589 for (i = 0; i < data->attrs_length; i++) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
590 IMPutC32(conn, data->attrs[i]);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
591 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
592 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
593 IMFinishRequest(conn, offset);
13
eda83436b27e imported patch 16_imflush.diff
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
594 #ifdef STATUS_SYNC
eda83436b27e imported patch 16_imflush.diff
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
595 IMFlush(conn);
eda83436b27e imported patch 16_imflush.diff
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
596 #endif /* STATUS_SYNC */
0
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
597 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
598
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
599 /*- preeditCaret: do actual preedit caret -*/
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
600 static void
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
601 preeditCaret(icp, caret)
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
602 IMIC *icp;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
603 int caret;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
604 {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
605 IMConnection *conn = icp->im->connection;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
606 int offset;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
607
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
608 if (icp->state & IC_RESETTING) return;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
609
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
610 preeditStart(icp);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
611
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
612 TRACE(("imlib:preeditCaret()\n"));
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
613
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
614 offset = IMPutHeader(conn, XIM_PREEDIT_CARET, 0, 0);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
615 IMPutC16(conn, icp->im->id);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
616 IMPutC16(conn, icp->id);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
617 IMPutC32(conn, caret);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
618 IMPutC32(conn, (long)XIMAbsolutePosition);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
619 IMPutC32(conn, (long)XIMPrimary);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
620 IMFinishRequest(conn, offset);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
621 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
622
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
623 /*- statusStart: do status start -*/
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
624 static void
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
625 statusStart(icp)
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
626 IMIC *icp;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
627 {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
628 if (!(icp->state & IC_IN_STATUS)) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
629 int offset;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
630 IMConnection *conn = icp->im->connection;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
631
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
632 TRACE(("imlib:statusStart()\n"));
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
633
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
634 offset = IMPutHeader(conn, XIM_STATUS_START, 0, 0);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
635 IMPutC16(conn, icp->im->id);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
636 IMPutC16(conn, icp->id);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
637 IMFinishRequest(conn, offset);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
638 icp->state |= IC_IN_STATUS;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
639 #ifdef STATUS_SYNC
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
640 IMFlush(conn);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
641 #endif /* STATUS_SYNC */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
642 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
643 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
644
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
645 /*- statusDone: do status done -*/
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
646 static void
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
647 statusDone(icp)
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
648 IMIC *icp;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
649 {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
650 if (icp->state & IC_IN_STATUS) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
651 int offset;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
652 IMConnection *conn = icp->im->connection;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
653
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
654 TRACE(("imlib:statusDone()\n"));
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
655
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
656 offset = IMPutHeader(conn, XIM_STATUS_DONE, 0, 0);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
657 IMPutC16(conn, icp->im->id);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
658 IMPutC16(conn, icp->id);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
659 IMFinishRequest(conn, offset);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
660 icp->state &= ~IC_IN_STATUS;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
661 #ifdef STATUS_SYNC
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
662 IMFlush(conn);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
663 #endif /* STATUS_SYNC */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
664 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
665 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
666
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
667 /*- statusDraw: do actual status draw -*/
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
668 static void
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
669 statusDraw(icp, data)
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
670 IMIC *icp;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
671 OCCPreeditDrawArg *data;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
672 {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
673 IMConnection *conn = icp->im->connection;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
674 int offset;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
675 unsigned int status;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
676
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
677 if (icp->state & IC_RESETTING) return;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
678
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
679 statusStart(icp);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
680
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
681 TRACE(("imlib:statusDraw()\n"));
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
682
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
683 offset = IMPutHeader(conn, XIM_STATUS_DRAW, 0, 0);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
684 IMPutC16(conn, icp->im->id);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
685 IMPutC16(conn, icp->id);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
686 IMPutC32(conn, 0L); /* text type */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
687 status = 0;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
688 if (data->text_length == 0) status |= 0x1; /* no string */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
689 if (data->attrs_length == 0) status |= 0x2; /* no feedback */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
690 IMPutC32(conn, status);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
691 IMPutC16(conn, (unsigned int)data->text_length);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
692 if (data->text_length > 0) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
693 IMPutString(conn, data->text, data->text_length);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
694 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
695 IMPutPad(conn);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
696 IMPutC16(conn, (unsigned int)(data->attrs_length * 32));
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
697 IMPutC16(conn, 0L); /* unused */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
698 if (data->attrs_length > 0) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
699 int i;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
700 for (i = 0; i < data->attrs_length; i++) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
701 IMPutC32(conn, 0L);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
702 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
703 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
704 IMFinishRequest(conn, offset);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
705 #ifdef STATUS_SYNC
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
706 IMFlush(conn);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
707 #endif /* STATUS_SYNC */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
708 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
709
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
710 /*- setEventMask: put XIM_SET_EVENT_MASK request on the output stream -*/
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
711 static void
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
712 setEventMask(icp, forward_mask, synchronous_mask)
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
713 IMIC *icp;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
714 unsigned long forward_mask;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
715 unsigned long synchronous_mask;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
716 {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
717 IMConnection *conn = icp->im->connection;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
718
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
719 (void)IMPutHeader(conn, XIM_SET_EVENT_MASK, 0, 12);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
720 IMPutC16(conn, icp->im->id);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
721 IMPutC16(conn, icp->id);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
722 IMPutC32(conn, forward_mask);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
723 IMPutC32(conn, synchronous_mask);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
724 IMSchedule(conn, SCHED_WRITE);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
725 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
726
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
727
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
728 /*
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
729 * Public functions
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
730 */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
731
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
732 int
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
733 IMStartConversion(icp)
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
734 IMIC *icp;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
735 {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
736 IMIM *imp = icp->im;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
737 Widget proto = imp->connection->proto_widget;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
738 Widget converter;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
739 WidgetClass class;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
740 unsigned long attrmask;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
741 ConversionAttributes attrs;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
742
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
743 TRACE(("IMStartConversion()\n"));
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
744
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
745 if (icp->state & IC_CONVERTING) return 0;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
746
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
747 /*
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
748 * Check required attributes i.e. client window.
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
749 */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
750 if (!(icp->common_attr.set_mask & ATTR_MASK_CLIENT)) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
751 IMSendError(icp->im->connection, IMBadSomething, icp->im->id, icp->id,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
752 "client window required");
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
753 return -1;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
754 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
755
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
756 /*
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
757 * Fill in default values for unspecified attributes.
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
758 */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
759 fillDefaultAttributesForStartup(icp);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
760
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
761 /*
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
762 * Get appropriate converter class.
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
763 */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
764 if (icp->style == IMSTYLE_OVER_THE_SPOT) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
765 class = overTheSpotConversionWidgetClass;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
766 } else if (icp->style == IMSTYLE_OFF_THE_SPOT) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
767 class = offTheSpotConversionWidgetClass;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
768 } else if (icp->style == IMSTYLE_ON_THE_SPOT) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
769 class = onTheSpotConversionWidgetClass;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
770 } else {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
771 class = separateConversionWidgetClass;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
772 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
773
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
774 /*
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
775 * Compute conversion attributes to be passed to the converter.
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
776 */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
777 attrmask = makeConvAttributesForStartup(icp, &attrs);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
778
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
779 icp->state &= ~IC_RESETTING;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
780
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
781 /*
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
782 * Attach converter to this IC.
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
783 */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
784 converter = CMGetConverter(XtParent(proto),
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
785 icp->common_attr.client, class,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
786 imp->converter->input_object_class,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
787 imp->converter->display_object_class);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
788 if (converter == NULL) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
789 IMSendError(imp->connection, IMBadSomething, imp->id, icp->id,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
790 "can't attach converter to this IC");
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
791 return -1;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
792 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
793 icp->conversion = converter;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
794
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
795 /*
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
796 * Add callback functions.
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
797 */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
798 XtAddCallback(converter, XtNtextCallback, fixCallback, (XtPointer)icp);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
799 XtAddCallback(converter, XtNendCallback, endCallback, (XtPointer)icp);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
800 XtAddCallback(converter, XtNunusedEventCallback, unusedEventCallback, (XtPointer)icp);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
801 if (icp->style == IMSTYLE_ON_THE_SPOT) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
802 XtAddCallback(converter, XtNpreeditStartCallback, preeditStartCallback,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
803 (XtPointer)icp);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
804 XtAddCallback(converter, XtNpreeditDoneCallback, preeditDoneCallback,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
805 (XtPointer)icp);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
806 XtAddCallback(converter, XtNpreeditDrawCallback, preeditDrawCallback,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
807 (XtPointer)icp);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
808 XtAddCallback(converter, XtNpreeditCaretCallback, preeditCaretCallback,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
809 (XtPointer)icp);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
810 XtAddCallback(converter, XtNstatusStartCallback, statusStartCallback,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
811 (XtPointer)icp);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
812 XtAddCallback(converter, XtNstatusDoneCallback, statusDoneCallback,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
813 (XtPointer)icp);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
814 XtAddCallback(converter, XtNstatusDrawCallback, statusDrawCallback,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
815 (XtPointer)icp);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
816 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
817
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
818 /*
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
819 * Start conversion
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
820 */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
821 /* !!! if front-end method is used, ESMethodSelectFocus should be used */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
822 XtVaSetValues(converter, XtNeventSelectMethod, ESMethodNone, NULL);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
823 CControlStartConversion(converter, icp->common_attr.client,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
824 attrmask, &attrs);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
825
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
826 icp->state |= IC_CONVERTING;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
827
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
828 if (icp->common_attr.input_style & XIMPreeditCallbacks)
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
829 preeditStart(icp);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
830
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
831 /*
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
832 * Send XIM_SET_EVENT_MASK to let the client forward the key events.
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
833 */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
834 IMStartForwarding(icp);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
835
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
836 return 0;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
837 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
838
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
839 void
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
840 IMStopConversion(icp)
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
841 IMIC *icp;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
842 {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
843 TRACE(("IMStopConversion()\n"));
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
844
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
845 if (!(icp->state & IC_CONVERTING)) return;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
846
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
847 /*
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
848 * Terminate conversion.
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
849 */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
850 CControlEndConversion(icp->conversion);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
851
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
852 if (icp->common_attr.input_style & XIMPreeditCallbacks)
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
853 preeditDone(icp);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
854 IMStatusDone(icp);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
855
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
856 /*
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
857 * Detach converter.
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
858 */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
859 detachConverter(icp);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
860
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
861 /*
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
862 * Stop forwarding key events unless this IC is being destroyed.
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
863 */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
864 if (!(icp->state & IC_DESTROYING)) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
865 IMStopForwarding(icp);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
866 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
867
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
868 icp->state &= ~IC_CONVERTING;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
869 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
870
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
871 int
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
872 IMResetIC(icp, preedit_strp)
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
873 IMIC *icp;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
874 char **preedit_strp;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
875 {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
876 int num_bytes = 0;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
877
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
878 TRACE(("IMResetIC()\n"));
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
879
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
880 *preedit_strp = NULL;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
881
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
882 if (icp->state & IC_CONVERTING) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
883 /*
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
884 * get input object by asking conversion widget of XtNinputObject
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
885 * resource. however, it is not recommended since protocol widget
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
886 * should interact with input object only through conversion
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
887 * widget.
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
888 */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
889 CCTextCallbackArg arg;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
890 Widget input_obj;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
891 Widget w = icp->im->connection->proto_widget;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
892
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
893 XtVaGetValues(icp->conversion, XtNinputObject, &input_obj, NULL);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
894 arg.encoding = IMCtextAtom(w);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
895 #ifdef notdef
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
896 if (ICGetConvertedString(input_obj, &arg.encoding, &arg.format,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
897 &arg.length, &arg.text) >= 0) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
898 num_bytes = arg.length;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
899 *preedit_strp = (char *)arg.text;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
900 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
901 #else
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
902 /*
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
903 * Canna seems to have some problem with ICGetConvertedString().
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
904 * Use ICGetPreeditString instead.
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
905 */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
906 if (ICGetPreeditString(input_obj, 0, 0, &arg.encoding, &arg.format,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
907 &arg.length, &arg.text) >= 0) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
908 num_bytes = arg.length;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
909 *preedit_strp = (char *)arg.text;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
910 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
911 #endif
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
912 ICClearConversion(input_obj);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
913 TRACE(("\twas converting. %d bytes left\n", num_bytes));
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
914
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
915 if (icp->common_attr.reset_state == XIMInitialState) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
916 /* Force to end the conversion. */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
917 TRACE(("\tback to the initial state\n"));
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
918 IMStopConversion(icp);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
919 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
920 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
921 return num_bytes;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
922 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
923
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
924 void
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
925 IMForwardEvent(icp, ev)
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
926 IMIC *icp;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
927 XEvent *ev;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
928 {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
929 TRACE(("IMForwardEvent()\n"));
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
930
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
931 if (icp->conversion == NULL) return;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
932 XtCallActionProc(icp->conversion, "to-inputobj", ev,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
933 (String *)NULL, (Cardinal)0);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
934 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
935
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
936 /* ARGSUSED */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
937 void
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
938 IMSetFocus(icp)
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
939 IMIC *icp;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
940 {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
941 TRACE(("IMSetFocus(ic%d)\n", icp->id));
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
942 if (icp->conversion != NULL) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
943 CControlChangeFocus(icp->conversion, 1);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
944 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
945 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
946
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
947 /* ARGSUSED */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
948 void
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
949 IMUnsetFocus(icp)
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
950 IMIC *icp;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
951 {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
952 TRACE(("IMUnsetFocus(ic%d)\n", icp->id));
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
953 if (icp->conversion != NULL) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
954 CControlChangeFocus(icp->conversion, 0);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
955 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
956 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
957
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
958 /* ARGSUSED */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
959 void
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
960 IMStatusStart(icp)
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
961 IMIC *icp;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
962 {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
963 TRACE(("IMStatusStart(ic%d)\n", icp->id));
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
964 if (!(icp->common_attr.input_style & XIMStatusCallbacks))
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
965 return;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
966 statusStart(icp);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
967 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
968
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
969 /* ARGSUSED */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
970 void
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
971 IMStatusDone(icp)
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
972 IMIC *icp;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
973 {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
974 TRACE(("IMStatusDone(ic%d)\n", icp->id));
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
975 if (!(icp->common_attr.input_style & XIMStatusCallbacks))
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
976 return;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
977 statusDone(icp);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
978 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
979
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
980 void
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
981 IMStartForwarding(icp)
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
982 IMIC *icp;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
983 {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
984 /*
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
985 * Make the client forward key events to us.
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
986 */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
987 TRACE(("IMStartForwarding(ic%d)\n", icp->id));
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
988
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
989 #define FORWARD_MASK (KeyPressMask|KeyReleaseMask)
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
990
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
991 #ifdef notdef
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
992 if (synchronous) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
993 setEventMask(icp, FORWARD_MASK, FORWARD_MASK);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
994 } else {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
995 setEventMask(icp, FORWARD_MASK, NoEventMask);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
996 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
997 #else
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
998 /* using full-synchronous method */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
999 setEventMask(icp, FORWARD_MASK, FORWARD_MASK);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1000 #endif
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1001
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1002 #undef FORWARD_MASK
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1003 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1004
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1005 void
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1006 IMStopForwarding(icp)
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1007 IMIC *icp;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1008 {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1009 /*
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1010 * Make the client stop sending key events.
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1011 */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1012 TRACE(("IMStopForwarding(ic%d)\n", icp->id));
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1013 setEventMask(icp, NoEventMask, NoEventMask);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1014 }