2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
6 * These libraries and programs are free software; you can
7 * redistribute them and/or modify them under the terms of the GNU
8 * Lesser General Public License as published by the Free Software
9 * Foundation; either version 2 of the License, or (at your option)
12 * These libraries and programs are distributed in the hope that
13 * they will be useful, but WITHOUT ANY WARRANTY; without even the
14 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU Lesser General Public License for more
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with these libraries and programs; if not, write
20 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21 * Floor, Boston, MA 02110-1301 USA
26 * MsgP.h -- Private header file for DT messaging library
28 * $XConsortium: MsgP.h /main/3 1995/10/26 15:24:51 rswiston $
29 * $XConsortium: MsgP.h /main/3 1995/10/26 15:24:51 rswiston $
31 * (C) Copyright 1993, Hewlett-Packard, all rights reserved.
40 /* max property size (bytes) */
41 #define DT_MSG_MAX_PROP_SIZE (32768)
44 #define DT_MSG_XA_REQUEST "_DT_REQUEST"
45 #define DT_MSG_XA_NOTIFY "_DT_NOTIFY"
46 #define DT_MSG_XA_BROADCAST_REGISTRY "_DT_BROADCAST_REGISTRY"
51 typedef struct _DtMsgHandle {
52 char * pchName; /* handle "name" */
53 Atom atom; /* Selection/Broadcast atom */
54 Widget widget; /* Widget registering this handle */
55 char * pchPropName; /* property name */
56 Atom property; /* atomized property name */
59 struct _DtMsgServiceContext *
60 service_data; /* service data assoc w/ handle */
61 struct _DtMsgBroadcastData *
62 broadcast_data; /* broadcast data assoc w/ handle */
66 * _DtMessage handle accessor "functions"
68 #define DtMsgH_Name(h) ((h)->pchName)
69 #define DtMsgH_Widget(h) ((h)->widget)
70 #define DtMsgH_Atom(h) ((h)->atom)
71 #define DtMsgH_SvcData(h) ((h)->service_data)
72 #define DtMsgH_BcData(h) ((h)->broadcast_data)
73 #define DtMsgH_PropertyName(h) ((h)->pchPropName)
74 #define DtMsgH_PropertyAtom(h) ((h)->property)
75 #define DtMsgH_Shandle(h) ((h)->service_data->handle)
76 #define DtMsgH_RequestProc(h) ((h)->service_data->request_proc)
77 #define DtMsgH_ReceiveCD(h) ((h)->service_data->receive_client_data)
78 #define DtMsgH_LoseProc(h) ((h)->service_data->lose_proc)
79 #define DtMsgH_LoseCD(h) ((h)->service_data->lose_client_data)
80 #define DtMsgH_RegistryAtom(h) ((h)->broadcast_data->aRegistry)
81 #define DtMsgH_SharedWindow(h) ((h)->broadcast_data->winShared)
82 #define DtMsgH_SharedWidget(h) ((h)->broadcast_data->wShared)
83 #define DtMsgH_Listener(h) ((h)->broadcast_data->wListener)
84 #define DtMsgH_BreceiveProc(h) ((h)->broadcast_data->Breceive_proc)
85 #define DtMsgH_BclientData(h) ((h)->broadcast_data->Bclient_data)
86 #define DtMsgH_Bprops(h) ((h)->broadcast_data->props)
87 #define DtMsgH_BnumProps(h) ((h)->broadcast_data->numProps)
88 #define DtMsgH_BsizeProps(h) ((h)->broadcast_data->sizeProps)
89 #define DtMsgH_Breceivers(h) ((h)->broadcast_data->pReceivers)
90 #define DtMsgH_BnumReceivers(h) ((h)->broadcast_data->numReceivers)
91 #define DtMsgH_BsizeReceivers(h) ((h)->broadcast_data->sizeReceivers)
92 #define DtMsgH_BSenderInit(h) ((h)->broadcast_data->bSenderInitialized)
95 * Service context data
96 * (for client that offers a service)
98 typedef struct _DtMsgServiceContext {
100 DtMsgReceiveProc request_proc;
101 DtMsgStatusProc lose_proc;
102 Pointer receive_client_data;
103 Pointer lose_client_data;
104 } DtMsgServiceContext;
107 * Request context data
108 * (for client that makes a service request)
110 typedef struct _DtMsgRequestContext {
112 DtMsgReceiveProc reply_proc;
114 } DtMsgRequestContext;
118 * Reply message context data
119 * (for client replying to a request)
121 typedef struct _DtMsgReplyMessageContext {
126 } DtMsgReplyMessageContext;
130 * Broadcast sender data
133 /* number of props to allocate per memory request */
134 #define DT_MSG_PROP_INC_AMT 10
136 typedef struct _DtMsgBroadcastPerReceiverData {
137 Widget widget; /* widget of receiver */
138 Atom * propsUnread; /* list of props */
139 int numPropsUnread; /* number of props */
140 int sizePropsUnread; /* amt of space allocated */
141 } DtMsgBroadcastPerReceiverData;
143 typedef struct _DtMsgBroadcastData {
144 Atom aRegistry; /* registry atom name */
145 Window winShared; /* shared window */
146 Widget wShared; /* shared widget */
147 Widget wListener; /* child of shared window */
148 DtMsgReceiveProc Breceive_proc; /* broadcast receive proc */
149 Pointer Bclient_data; /* broadcast client data */
151 Boolean bSenderInitialized; /* true if ready for send */
152 Atom * props; /* props to use for messages */
153 int numProps; /* number of message props */
154 int sizeProps; /* number of props allocated */
155 DtMsgBroadcastPerReceiverData * pReceivers; /* rcvr data */
156 int numReceivers; /* number of receivers */
157 int sizeReceivers; /* amt of rcvr space allocated */
159 } DtMsgBroadcastData;
163 * Broadcast _DtMessage Registry definitions
166 /* registry entry size, in words */
167 #define DT_MSG_REGISTRY_ENTRY_SIZE 2
169 /* offsets within each registry entry */
170 #define DT_MSG_REGISTRY_NAME_OFFSET 0
171 #define DT_MSG_REGISTRY_WINDOW_OFFSET 1
173 /* Macros to compute offset */
174 #define MSG_GROUP_NAME(R, i) \
175 (R[((i)*DT_MSG_REGISTRY_ENTRY_SIZE)+DT_MSG_REGISTRY_NAME_OFFSET])
177 #define MSG_GROUP_WINDOW(R, i) \
178 (R[((i)*DT_MSG_REGISTRY_ENTRY_SIZE)+DT_MSG_REGISTRY_WINDOW_OFFSET])
181 #endif /* not defined _DT_MSG_P_H */
182 /***** END OF FILE ****/