1 /* $Id: IMProtoP.h,v 1.6 1995/05/17 09:15:02 ishisone Exp $ */
2 /*
3  * Copyright (c) 1994  Software Research Associates, Inc.
4  *
5  * Permission to use, copy, modify, and distribute this software and its
6  * documentation for any purpose and without fee is hereby granted, provided
7  * that the above copyright notice appear in all copies and that both that
8  * copyright notice and this permission notice appear in supporting
9  * documentation, and that the name of Software Research Associates not be
10  * used in advertising or publicity pertaining to distribution of the
11  * software without specific, written prior permission.  Software Research
12  * Associates makes no representations about the suitability of this software
13  * for any purpose.  It is provided "as is" without express or implied
14  * warranty.
15  *
16  * Author:  Makoto Ishisone, Software Research Associates, Inc., Japan
17  */
18 
19 #ifndef _IMProtocolP_h
20 #define _IMProtocolP_h
21 
22 #include "IMProto.h"
23 #include "im.h"
24 #include "FontBank.h"
25 #include "ConvCtrl.h"
26 #include "IOECall.h"
27 
28 typedef struct {
29     int dummy;
30 } IMProtocolClassPart;
31 
32 typedef struct _IMProtocolClassRec {
33     CoreClassPart		core_class;
34     IMProtocolClassPart		imProtocol_class;
35 } IMProtocolClassRec;
36 
37 extern IMProtocolClassRec imProtocolClassRec;
38 
39 
40 typedef struct {
41     /* resources */
42     String server_name;
43 
44     /*
45      * It is not difficult to handle multiple languages in a
46      * protocol widget, but we've determined not to do so
47      * for simplicity (at least for now).
48      */
49     String language;
50     String locales;
51     WidgetClass input_object_class;
52     WidgetClass display_object_class;
53     String default_fontlist;		/* default font list to be used */
54 
55     Pixel foreground;			/* default fg pixel */
56     String conversion_start_keys;	/* conversion start/end keys */
57     Dimension status_width;		/* default width of status area */
58     String transport_list;		/* transports to be used */
59 
60     /* private state */
61     Boolean use_tcp_transport;
62     Boolean use_unix_transport;
63     Boolean use_x_transport;
64     int tcp_port;			/* TCP port number */
65     int tcp_sock;			/* TCP socket descriptor */
66     XtInputId tcp_id;
67     String unix_path;			/* Unix domain socket pathname */
68     int unix_sock;			/* Unix domain socket descriptor */
69     XtInputId unix_id;
70     Boolean no_more_connections;
71     IMConnection *connection_list;
72     IMConverter converter;
73     long last_imid;
74     long last_icid;
75     IMIM *im_hash[IM_HASH_SIZE];
76     IMIC *ic_hash[IC_HASH_SIZE];
77     IMConnection *scheduler_queue;
78     IMTriggerKey *trigger_keys;		/* conversion start trigger keys */
79     int num_trigger_keys;
80     FontBank font_bank;
81     XFontStruct **default_fonts;
82     int num_default_fonts;
83     XIOEHandle ioe_handle;
84 
85     /* atoms */
86     Atom xim_xconnect;			/* "_XIM_XCONNECT" */
87     Atom xim_protocol;			/* "_XIM_PROTOCOL" */
88     Atom xim_moredata;			/* "_XIM_MOREDATA" */
89     Atom ctext_atom;			/* "COMPOUND_TEXT" */
90     Atom locales_atom;			/* "LOCALES" */
91     Atom transport_atom;		/* "TRANSPORT" */
92     Atom ki2comm_atom;			/* "_KINPUT2_COMM" */
93     Atom server_atom;			/* atom stored in XIM_SERVERS prop. */
94 } IMProtocolPart;
95 
96 typedef struct _IMProtocolRec {
97     CorePart		core;
98     IMProtocolPart	imp;
99 } IMProtocolRec;
100 
101 #define IM_IMHASH(w)	(((IMProtocolWidget)(w))->imp.im_hash)
102 #define IM_ICHASH(w)	(((IMProtocolWidget)(w))->imp.ic_hash)
103 #define IM_LASTIMID(w)	(((IMProtocolWidget)(w))->imp.last_imid)
104 #define IM_LASTICID(w)	(((IMProtocolWidget)(w))->imp.last_icid)
105 #define IM_QUEUE(w)	(((IMProtocolWidget)(w))->imp.scheduler_queue)
106 
107 #define ATOM_CTEXT(w)	(((IMProtocolWidget)(w))->imp.ctext_atom)
108 #define ATOM_LOCALES(w)	(((IMProtocolWidget)(w))->imp.locales_atom)
109 #define ATOM_TRANSPORT(w) (((IMProtocolWidget)(w))->imp.transport_atom)
110 #define ATOM_KI2COMM(w) (((IMProtocolWidget)(w))->imp.ki2comm_atom)
111 #define ATOM_XCONNECT(w) (((IMProtocolWidget)(w))->imp.xim_xconnect)
112 #define ATOM_PROTOCOL(w) (((IMProtocolWidget)(w))->imp.xim_protocol)
113 #define ATOM_MOREDATA(w) (((IMProtocolWidget)(w))->imp.xim_moredata)
114 
115 #endif
116