0
|
1 /*
|
|
2 * $Id: keyev.c,v 1.2 2001/06/14 18:16:11 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 * keyev.c v 1.0 Thu Mar 7 19:30:17 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 keyev (ic, mode) /* transaction of KEY EVent */
|
|
53 XIC ic;
|
|
54 FLAG mode;
|
|
55 /* *INDENT-ON* */
|
|
56 {
|
|
57 int cnt;
|
|
58 FLAG res;
|
|
59 FLAG funend;
|
|
60
|
|
61 XEvent event;
|
|
62
|
|
63 for (;;)
|
|
64 {
|
|
65 XNextEvent (dpy, &event);
|
|
66 switch (event.type)
|
|
67 {
|
|
68 case Expose:
|
|
69 dstrwin ();
|
|
70 break;
|
|
71 case KeyPress:
|
|
72 if (fltev (&event) == NG)
|
|
73 xlstr (ic, &event);
|
|
74 break;
|
|
75 case ButtonPress:
|
|
76 if (event.xbutton.window == strmode)
|
|
77 {
|
|
78 XClearWindow (dpy, strmode);
|
|
79 if (strflag == MB)
|
|
80 {
|
|
81 strflag = WC;
|
|
82 XDrawString (dpy, strmode, gc, MSTR_XY, "Mode: WC", strlen ("Mode: WC"));
|
|
83 }
|
|
84 else if (strflag == WC)
|
|
85 {
|
|
86 strflag = MB;
|
|
87 XDrawString (dpy, strmode, gc, MSTR_XY, "Mode: MB", strlen ("Mode: MB"));
|
|
88 }
|
|
89 XFlush (dpy);
|
|
90 }
|
|
91 else
|
|
92 {
|
|
93 funend = NG;
|
|
94 for (cnt = 0; (ftbl[cnt].mname != NULL) && (funend != OK); cnt++)
|
|
95 {
|
|
96 if (event.xbutton.window == *ftbl[cnt].mwin)
|
|
97 {
|
|
98 if (ftbl[cnt].flag == CHMOD)
|
|
99 {
|
|
100 XClearArea (dpy, window1.win, 0, 0, 0, 0, True);
|
|
101 return (MENU);
|
|
102 }
|
|
103 else
|
|
104 {
|
|
105 cwcolor (*ftbl[cnt].mwin, pixel[cmflag][0]);
|
|
106 res = (*ftbl[cnt].func) (ic, mode);
|
|
107 cwcolor (*ftbl[cnt].mwin, pixel[cmflag][1]);
|
|
108 if (res == COMP)
|
|
109 funend = OK;
|
|
110 else
|
|
111 return (res);
|
|
112 }
|
|
113 }
|
|
114 }
|
|
115 break;
|
|
116 }
|
|
117 }
|
|
118 }
|
|
119 }
|