File: im.h

package info (click to toggle)
kinput2 3.0-9
  • links: PTS
  • area: main
  • in suites: potato
  • size: 2,644 kB
  • ctags: 4,647
  • sloc: ansic: 45,508; makefile: 98; sh: 12
file content (262 lines) | stat: -rw-r--r-- 7,075 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
/* $Id: im.h,v 1.9 1999/01/13 08:42:03 ishisone Exp $ */
/*
 * Copyright (c) 1994  Software Research Associates, Inc.
 *
 * Permission to use, copy, modify, and distribute this software and its
 * documentation for any purpose and without fee is hereby granted, provided
 * that the above copyright notice appear in all copies and that both that
 * copyright notice and this permission notice appear in supporting
 * documentation, and that the name of Software Research Associates not be
 * used in advertising or publicity pertaining to distribution of the
 * software without specific, written prior permission.  Software Research
 * Associates makes no representations about the suitability of this software
 * for any purpose.  It is provided "as is" without express or implied
 * warranty.
 *
 * Author:  Makoto Ishisone, Software Research Associates, Inc., Japan
 */

#ifndef _im_h
#define _im_h

#include <X11/IntrinsicP.h>
#include <X11/StringDefs.h>
#include <X11/Xos.h>
#include <X11/Xfuncs.h>

/* macros defined in the system header file cause problem... */
#undef major
#undef minor

#define EXT_DEBUG_VAR	debug_IMProtocol
#include "DebugPrint.h"
#include "AsyncErr.h"
#include "FontBank.h"
#include "ConvCtrl.h"

#include "imprtype.h"
#include "imbuf.h"
#include "imxport.h"
#include "imconst.h"

/*
 * Restrictions of attributes
 */

#define MIN_LINE_SPACING	2
#define MIN_AREA_WIDTH		16
#define MIN_AREA_HEIGHT		10

/*
 * IMDispatcher -- request dispatcher
 */

typedef int (*IMDispatcher)();


/*
 * IMConnection
 */

typedef struct _im_connection_ {
    /* protocol information */
    int major_protocol_version;
    int minor_protocol_version;
#ifdef XIM_BC
    int has_length_bug;
#endif
    int serial;				/* connection serial # (for debug) */
    Widget proto_widget;		/* protocol handler widget */

    /* transport information */
    IMTransport transport;

    int byte_order;			/* byte order of the client */
#define ORDER_UNKNOWN	0		/* order is yet unknown */
#define ORDER_BIG	1		/* big endian */
#define ORDER_LITTLE	2		/* little endian */

    /* communication buffer */
    IMBuffer in_buf;			/* input buffer */
    IMBuffer out_buf;			/* output buffer */
#define IM_INBUF(conn)	(&(conn)->in_buf)
#define IM_OUTBUF(conn)	(&(conn)->out_buf)

    IMDispatcher dispatcher;		/* request dispatch procedure */

    struct _im_im_ *im_list;		/* list of IMs on this connection */

#ifdef notyet
    /* authentication information */
    IMAuth *server_auth;		/* server authentication data */
    IMAuth *client_auth;		/* client authentication data */
#endif /* notyet */

    /* scheduler */
    int schedule;			/* type of operation to be performed */
#define SCHED_WRITE	1		/* flush output buffer */
#define SCHED_CLOSE	2		/* close down connection gently */
#define SCHED_SHUTDOWN	4		/* force shut down */
    struct _im_connection_ *queue_next;	/* output/close/shutdown queue */

    struct _im_connection_ *next;
} IMConnection;


/*
 * IMConverter -- information on the conversion engine
 */
typedef struct {
    char **supported_locales;		/* list of supported locales */
    int num_locales;
    WidgetClass input_object_class;
    WidgetClass display_object_class;
} IMConverter;


/*
 * IMTriggerKey -- conversion trigger key specification
 */
typedef struct {
    KeySym keysym;
    long modifiers;
    long check_modifiers;
} IMTriggerKey;


/*
 * IMExtensionMask -- bit mask of enabled extensions
 */
typedef unsigned long IMExtensionMask;	/* holds up to 32 extensions */


/*
 * IMIM -- per-IM structure
 */

typedef struct _im_im_ {
    unsigned int id;			/* input-method ID */
    IMConnection *connection;		/* connection this IM is on */
    struct _im_im_ *next;
    struct _im_im_ *hash_next;		/* for hash table */
    IMConverter *converter;		/* conversion engine */
    IMExtensionMask mask;		/* enabled extensions */
    struct _im_ic_ *ic_list;		/* list of all ICs belonging to this IM */
} IMIM;


/*
 * IMAttributes and IMPSAttributes -- IC attributes structure
 */

typedef struct {
    unsigned long set_mask;		/* shows attrs that have been set */
    unsigned long change_mask;		/* shows attrs that have changed */
#define ATTR_MASK_INPUT_STYLE	(1<<0)
#define ATTR_MASK_CLIENT	(1<<1)
#define ATTR_MASK_FOCUS		(1<<2)
    XIMStyle input_style;
    Window client;			/* client window */
    Window focus;			/* focus window */
} IMCommonAttributes;

typedef struct {
    unsigned long set_mask;		/* shows attrs that have been set */
    unsigned long change_mask;		/* shows attrs that have changed */
#define ATTR_MASK_AREA		(1<<0)
#define ATTR_MASK_FOREGROUND	(1<<1)
#define ATTR_MASK_BACKGROUND	(1<<2)
#define ATTR_MASK_COLORMAP	(1<<3)
#define ATTR_MASK_STD_COLORMAP	(1<<4)
#define ATTR_MASK_BG_PIXMAP	(1<<5)
#define ATTR_MASK_LINESPACE	(1<<6)
#define ATTR_MASK_CURSOR	(1<<7)
#define ATTR_MASK_AREA_NEEDED	(1<<8)
#define ATTR_MASK_FONT_SET	(1<<9)
#define ATTR_MASK_SPOT_LOCATION	(1<<10)
    XRectangle area;
    Pixel foreground, background;
    Colormap colormap;
    Atom std_colormap;
    Pixmap bg_pixmap;
    Position line_space;
    Cursor cursor;
    XRectangle area_needed;		/* width/height member are unused */
    String font_set;
    XPoint spot_location;		/* not used by status attr. */
} IMPSAttributes;


/*
 * IMPendingEvent -- record of delayed processing event
 */

typedef struct _im_pending_event_ {
    struct _im_ic_ *ic;
    int synchronous;
    XEvent event;
    struct _im_pending_event_ *next;
} IMPendingEvent;


/*
 * IMWindowProfile -- information about window
 */

typedef struct {
    Dimension width;
    Dimension height;
    Window root;
} IMWindowProfile;


/*
 * IMIC -- per-IC structure
 */

typedef struct _im_ic_ {
    unsigned int id;			/* input-context ID */
    IMIM *im;				/* IM this IC belongs to */
    Widget conversion;			/* conversion widget attached
					 * to this IC */
    struct _im_ic_ *next;
    struct _im_ic_ *hash_next;		/* for hash list */
    int state;				/* current IC state */
#define IC_SYNCING	1		/* waiting for SYNC_REPLY message */
#define IC_CONVERTING	2		/* in conversion mode */
    IMPendingEvent *pending_events;	/* pending events */
    int style;				/* input style */
#define IMSTYLE_SEPARATE	0	/* root window style */
#define IMSTYLE_OVER_THE_SPOT	1	/* over-the-spot style */
#define IMSTYLE_OFF_THE_SPOT	2	/* off-the-spot style */
#define IMSTYLE_ON_THE_SPOT	3	/* on-the-spot style */
    IMCommonAttributes common_attr;	/* general attributes */
    IMPSAttributes preedit_attr;	/* preedit specific attributes */
    IMPSAttributes status_attr;		/* status specific attributes */
    IMWindowProfile client_profile;	/* client widow profile */
    IMWindowProfile focus_profile;	/* focus window profile */
    XFontStruct **fonts;
    int num_fonts;
    XFontStruct **status_fonts;
    int num_status_fonts;
    Boolean resetting;
    Boolean in_preedit;
    Boolean in_status;
} IMIC;


/*
 * IM and IC hash table size
 */

#define IM_HASH_SIZE	32
#define IC_HASH_SIZE	128


/*
 * Public function declarations
 */

#include "imfuncs.h"

#endif /* _im_h */