0
|
1 /*
|
|
2 * $Id: chkcset.c,v 1.2 2001/06/14 18:16:10 ura Exp $
|
|
3 */
|
|
4
|
|
5 /*
|
|
6 * FreeWnn is a network-extensible Kana-to-Kanji conversion system.
|
|
7 * This file is part of FreeWnn.
|
|
8 *
|
|
9 * Copyright OMRON Corporation. 1987, 1988, 1989, 1990, 1991, 1992, 1999
|
|
10 *
|
|
11 * Author: OMRON SOFTWARE Co., Ltd. <freewnn@rd.kyoto.omronsoft.co.jp>
|
|
12 *
|
|
13 * This program is free software; you can redistribute it and/or modify
|
|
14 * it under the terms of the GNU General Public License as published by
|
|
15 * the Free Software Foundation; either version 2, or (at your option)
|
|
16 * any later version.
|
|
17 *
|
|
18 * This program is distributed in the hope that it will be useful,
|
|
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
21 * GNU General Public License for more details.
|
|
22 *
|
|
23 * You should have received a copy of the GNU General Public License
|
|
24 * along with GNU Emacs; see the file COPYING. If not, write to the
|
|
25 * Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
26 *
|
|
27 * Commentary:
|
|
28 *
|
|
29 * Change log:
|
|
30 *
|
|
31 * Last modified date: 8,Feb.1999
|
|
32 *
|
|
33 * Code:
|
|
34 *
|
|
35 */
|
|
36
|
|
37 /*
|
|
38 * X11R5 Input Method Test Program
|
|
39 * chkcset.c v 1.0 Tue Mar 12 20:35:00 JST 1991
|
|
40 */
|
|
41
|
|
42 /*
|
|
43 * Author: Takashi Inoue OMRON Corporation
|
|
44 * takashi@ari.ncl.omron.co.jp
|
|
45 */
|
|
46
|
|
47 #include "exvalue.h"
|
|
48 #include "func.h"
|
|
49
|
|
50 /* *INDENT-OFF* */
|
|
51 FLAG
|
|
52 xsuicf (ic, mode) /* XSet/Unset IC Focus */
|
|
53 XIC ic;
|
|
54 FLAG mode;
|
|
55 /* *INDENT-ON* */
|
|
56 {
|
|
57 cls (prdisp);
|
|
58 prstatus ("Test of XSet/UnsetICFocus()...");
|
|
59 switch (focuson)
|
|
60 {
|
|
61 case OK:
|
|
62 XUnsetICFocus (ic);
|
|
63 focuson = NG;
|
|
64 prprint ("The IC Focus is unset by calling XUnsetICFocus.\n\n");
|
|
65 prprint ("Check your own eyes.\n\n");
|
|
66 prprint ("If you want to set IC,\n");
|
|
67 prprint ("you have to click your mouse ");
|
|
68 prprint ("\"Focus1\" on menu window again.\n\n");
|
|
69 cwcolor (ufname, pixel[cmflag][1]);
|
|
70 fprintf (icfp, "...XUnsetICFocus() returned.\n\n");
|
|
71 break;
|
|
72 default:
|
|
73 XSetICFocus (ic);
|
|
74 focuson = OK;
|
|
75 prprint ("The IC Focus is set by calling XSetICFocus.\n\n");
|
|
76 prprint ("Check your own eyes.\n\n");
|
|
77 prprint ("If you want to unset IC,\n");
|
|
78 prprint ("you have to click your mouse ");
|
|
79 prprint ("\"Focus1\" on menu window again.\n\n");
|
|
80 cwcolor (ufname, pixel[cmflag][0]);
|
|
81 fprintf (icfp, "...XSetICFocus() returned.\n\n");
|
|
82 break;
|
|
83 }
|
|
84 prstatus ("done.");
|
|
85 prprint ("Move next test.\n\n");
|
|
86 prpok ();
|
|
87 return (COMP);
|
|
88 }
|
|
89
|
|
90 /* *INDENT-OFF* */
|
|
91 FLAG
|
|
92 sfocus (ic, mode) /* Set FOCUS window */
|
|
93 XIC ic;
|
|
94 FLAG mode;
|
|
95 /* *INDENT-ON* */
|
|
96
|
|
97 {
|
|
98 Window gfocus;
|
|
99 VALUABLE *focus;
|
|
100 int res;
|
|
101
|
|
102 if ((mode != DUMMY) && (focuson == OK))
|
|
103 {
|
|
104 cls (prdisp);
|
|
105 prstatus ("Test of XSetICValues() for change \"Focus Window\"...");
|
|
106 if (ufocus == window1.win)
|
|
107 {
|
|
108 cwcolor (ufname, pixel[cmflag][1]);
|
|
109 ufocus = window2.win;
|
|
110 ufname = window2.name;
|
|
111 cwcolor (ufname, pixel[cmflag][0]);
|
|
112 }
|
|
113 else if (ufocus == window2.win)
|
|
114 {
|
|
115 cwcolor (ufname, pixel[cmflag][1]);
|
|
116 ufocus = window3.win;
|
|
117 ufname = window3.name;
|
|
118 cwcolor (ufname, pixel[cmflag][0]);
|
|
119 }
|
|
120 else if (ufocus == window3.win)
|
|
121 {
|
|
122 cwcolor (ufname, pixel[cmflag][1]);
|
|
123 ufocus = window1.win;
|
|
124 ufname = window1.name;
|
|
125 cwcolor (ufname, pixel[cmflag][0]);
|
|
126 }
|
|
127 XSetICValues (ic, XNFocusWindow, ufocus, NULL);
|
|
128 prstatus ("done.");
|
|
129 prstatus ("Test of XGetICValues() \"FocusWindow\"...");
|
|
130 XGetICValues (ic, XNFocusWindow, &gfocus, NULL);
|
|
131 prstatus ("done.");
|
|
132 res = 0;
|
|
133 focus = mkstruct (FW, HEX, ufocus, gfocus);
|
|
134 res = verval (focus);
|
|
135 cls (prdisp);
|
|
136 prveres (res);
|
|
137 if (res != NOERR)
|
|
138 {
|
|
139 prprint ("Test of XSetICValues() \"FocusWindow\" is failed.\n");
|
|
140 prprint ("FocusWindow has not changed.\n\n");
|
|
141 prprint ("I will destroy IC and continue test.\n");
|
|
142 prprint ("Check log file after this test.\n\n");
|
|
143 fprintf (icfp, "...Test of XSetICValues() \"FocusWindow\" is failed.\n\n");
|
|
144 prpng ();
|
|
145 return (DIC);
|
|
146 }
|
|
147 prprint ("Test of XSetICValues() \"FocusWindow\" is succeeded.\n");
|
|
148 prprint ("FocusWindow has changed.\n\n");
|
|
149 prprint ("Check your own eyes and move next test.\n\n");
|
|
150 fprintf (icfp, "...Test of XSetICValues() \"FocusWindow\" is succeeded.\n\n");
|
|
151 prpok ();
|
|
152 return (COMP);
|
|
153 }
|
|
154 else
|
|
155 {
|
|
156 cls (prdisp);
|
|
157 prprint ("You can't check this test.\n\n");
|
|
158 prprint ("Retry after \"Focus1\" test.\n\n");
|
|
159 fprintf (icfp, "...Retry after \"Focus1\" test.\n\n");
|
|
160 }
|
|
161 return (COMP);
|
|
162 }
|
|
163
|
|
164
|
|
165 /* *INDENT-OFF* */
|
|
166 FLAG
|
|
167 sresource (ic, mode) /* Set RESOURCE name/class */
|
|
168 XIC ic;
|
|
169 FLAG mode;
|
|
170 /* *INDENT-ON* */
|
|
171
|
|
172 {
|
|
173 int sum;
|
|
174 int cnt, res;
|
|
175 RESOURCE gres;
|
|
176 VALUABLE *resource[ARRAY_MAX];
|
|
177
|
|
178 if (mode == ONSP)
|
|
179 {
|
|
180 prerrfunc ();
|
|
181 return (COMP);
|
|
182 }
|
|
183 else
|
|
184 {
|
|
185 cls (prdisp);
|
|
186 prstatus ("Test of XSetICValues() for change \"Resource Name\",\"Resource Class\"...");
|
|
187 if (!strcmp (ures.name, "xim"))
|
|
188 ures.name = "xima";
|
|
189 else if (!strcmp (ures.name, "xima"))
|
|
190 ures.name = "ximb";
|
|
191 else if (!strcmp (ures.name, "ximb"))
|
|
192 ures.name = "xim";
|
|
193 if (!strcmp (ures.class, "Xim"))
|
|
194 ures.class = "Xima";
|
|
195 else if (!strcmp (ures.class, "Xima"))
|
|
196 ures.class = "Ximb";
|
|
197 else if (!strcmp (ures.class, "Ximb"))
|
|
198 ures.class = "Xim";
|
|
199 XSetICValues (ic, XNResourceName, ures.name, XNResourceClass, ures.class, NULL);
|
|
200 prstatus ("done.");
|
|
201 prstatus ("Test of XGetICValues() \"resource name/class\"...");
|
|
202 XGetICValues (ic, XNResourceName, &gres.name, XNResourceClass, &gres.class, NULL);
|
|
203 prstatus ("done.");
|
|
204 sum = 0;
|
|
205 resource[0] = mkstruct (RN, STR, ures.name, gres.name);
|
|
206 resource[1] = mkstruct (RC, STR, ures.class, gres.class);
|
|
207 for (cnt = 0; cnt < CHKRES; cnt++)
|
|
208 {
|
|
209 res = verval (resource[cnt]);
|
|
210 sum += res;
|
|
211 }
|
|
212 cls (prdisp);
|
|
213 prveres (sum);
|
|
214 if (sum != NOERR)
|
|
215 {
|
|
216 prprint ("Test of XSetICValues() \"ResourceName/Class\" is failed.\n");
|
|
217 prprint ("ResourceName/ResourceClass has not changed.\n\n");
|
|
218 prprint ("I will destroy IC and continue test.\n");
|
|
219 prprint ("Check log file after this test.\n\n");
|
|
220 fprintf (icfp, "...Test of XSetICValues() \"ResourceName/Class\" is failed.\n\n");
|
|
221 prpng ();
|
|
222 return (DIC);
|
|
223 }
|
|
224 prprint ("Test of XSetICValues() \"ResourceName/Class\" is succeeded.\n");
|
|
225 prprint ("ResourceName/ResourceClass has changed.\n\n");
|
|
226 prprint ("Check your own eyes and move next test\n\n");
|
|
227 fprintf (icfp, "...Test of XSetICValues() \"ResourceName/Class\" is succeeded.\n\n");
|
|
228 prpok ();
|
|
229 return (COMP);
|
|
230 }
|
|
231 }
|