annotate src/extw-Xt.c @ 5001:714d854d00e9

Automatic merge
author Ben Wing <ben@xemacs.org>
date Sun, 07 Feb 2010 05:23:07 -0600
parents 4fbcce3f6097
children 2aa9cd456ae7
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1 /* Common code between client and shell widgets -- Xt only.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2 Copyright (C) 1993, 1994 Sun Microsystems, Inc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4 This library is free software; you can redistribute it and/or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5 modify it under the terms of the GNU Library General Public
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6 License as published by the Free Software Foundation; either
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7 version 2 of the License, or (at your option) any later version.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9 This library is distributed in the hope that it will be useful,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12 Library General Public License for more details.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14 You should have received a copy of the GNU Library General Public
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15 License along with this library; if not, write to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17 Boston, MA 02111-1307, USA. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19 /* Synched up with: Not in FSF. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21 /* Written by Ben Wing, September 1993. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23 #ifdef emacs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25 #include <config.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27 #ifndef EXTERNAL_WIDGET
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28 ERROR! This ought not be getting compiled if EXTERNAL_WIDGET is undefined
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30
2110
f18c80177dfe [xemacs-hg @ 2004-06-03 10:10:45 by didierv]
didierv
parents: 2108
diff changeset
31 EXTERN_C void fatal (const char *fmt, ...);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 #else /* not emacs */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33 static void fatal (char *msg);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36 #include <X11/Intrinsic.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37 #include <X11/IntrinsicP.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 #include <stdlib.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 #include <stdio.h>
4331
4fbcce3f6097 Don't use undocumented Xt functions in external widget.
Mike Sperber <sperber@deinprogramm.de>
parents: 2114
diff changeset
40 #include "compiler.h"
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 #include "extw-Xt.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 #ifdef DEBUG_WIDGET
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 static int geom_masks[] = {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 CWX, CWY, CWWidth, CWHeight, CWBorderWidth, CWSibling, CWStackMode,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47 XtCWQueryOnly };
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48 static char *geom_mask_strings[] = {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 "CWX", "CWY", "CWWidth", "CWHeight", "CWBorderWidth",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 "CWSibling", "CWStackMode", "XtCWQueryOnly" };
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 static int stack_modes[] = {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 Below, TopIf, BottomIf, Opposite, XtSMDontChange };
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53 static char *stack_mode_strings[] = {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 "Below", "TopIf", "BottomIf", "Opposite", "XtSMDontChange" };
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 print_geometry_structure(XtWidgetGeometry *xwg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 int num = sizeof(geom_masks)/sizeof(int);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 int i;
2108
8de911beca70 [xemacs-hg @ 2004-06-02 09:16:14 by didierv]
didierv
parents: 1094
diff changeset
61
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62 printf (" masks:");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 for (i=0; i<num; i++)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 if (xwg->request_mode & geom_masks[i])
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 printf (" %s", geom_mask_strings[i]);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 printf ("\n");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67 printf (" x:%d y:%d\n", xwg->x, xwg->y);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 printf (" width:%d height:%d border_width:%d\n", xwg->width,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 xwg->height, xwg->border_width);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 printf (" sibling: %x\n", xwg->sibling);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 printf (" stack_mode: ");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 for (i=0, num=sizeof(stack_modes)/sizeof(int); i<num; i++)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73 if (xwg->stack_mode == stack_modes[i]) {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 printf ("%s", stack_mode_strings[i]);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 printf ("\n");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81 print_geometry_result (XtGeometryResult res)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83 printf ("result: %s\n",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84 res == XtGeometryYes ? "XtGeometryYes" :
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85 res == XtGeometryNo ? "XtGeometryNo" :
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86 res == XtGeometryAlmost ? "XtGeometryAlmost" :
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87 res == XtGeometryDone ? "XtGeometryDone" :
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88 "unknown");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93 #ifndef emacs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96 fatal (char *msg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98 fprintf (stderr, "%s", msg);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99 exit (1);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104 /* put a geometry specification in the specified property on the window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105 of the specified widget, and send a notification message to tell the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106 client-side widget about this. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109 extw_send_geometry_value(Display *display, Window win, Atom property,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110 en_extw_notify type, XtWidgetGeometry *xwg,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111 long data0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113 if (xwg != NULL)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114 XChangeProperty(display, win, property,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
115 a_EXTW_WIDGET_GEOMETRY, 32, PropModeReplace,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116 (unsigned char *) xwg, sizeof(*xwg)/sizeof(int));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117 extw_send_notify_3(display, win, type, data0, 0, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
119
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
120 /* get the geometry specification stored in the specified property of the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
121 specified widget's window. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
122
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
123 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
124 extw_get_geometry_value(Display *display, Window win, Atom property,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
125 XtWidgetGeometry *xwg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
126 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
127 Atom dummy;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
128 int format;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
129 unsigned long nitems, bytes_after;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
130 unsigned char *prop;
2108
8de911beca70 [xemacs-hg @ 2004-06-02 09:16:14 by didierv]
didierv
parents: 1094
diff changeset
131
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
132 if (XGetWindowProperty(display, win, property, 0,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
133 sizeof(*xwg)/4, False, a_EXTW_WIDGET_GEOMETRY,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
134 &dummy, &format, &nitems, &bytes_after,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
135 &prop) != Success)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
136 goto error;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137 if (format != 8*sizeof(int) || bytes_after) {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
138 XFree((char *) prop);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139 goto error;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
140 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
141 *xwg = * (XtWidgetGeometry *) prop;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
142 return;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
143
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
144 error:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
145 fatal("Unable to retrieve property for widget-geometry");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
146 #if 0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
147 XtAppErrorMsg(XtWidgetToApplicationContext((Widget)w),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
148 "invalidProperty","get_geometry_value",XtCXtToolkitError,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149 "Unable to retrieve property for widget-geometry",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
150 (String *)NULL, (Cardinal *)NULL);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
151 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
152 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
153
4331
4fbcce3f6097 Don't use undocumented Xt functions in external widget.
Mike Sperber <sperber@deinprogramm.de>
parents: 2114
diff changeset
154 typedef struct
4fbcce3f6097 Don't use undocumented Xt functions in external widget.
Mike Sperber <sperber@deinprogramm.de>
parents: 2114
diff changeset
155 {
4fbcce3f6097 Don't use undocumented Xt functions in external widget.
Mike Sperber <sperber@deinprogramm.de>
parents: 2114
diff changeset
156 Widget w;
4fbcce3f6097 Don't use undocumented Xt functions in external widget.
Mike Sperber <sperber@deinprogramm.de>
parents: 2114
diff changeset
157 unsigned long request_num;
4fbcce3f6097 Don't use undocumented Xt functions in external widget.
Mike Sperber <sperber@deinprogramm.de>
parents: 2114
diff changeset
158 en_extw_notify type;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
159 } QueryStruct;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
160
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
161 /* check if an event is of the sort we're looking for */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
163 static Bool
4331
4fbcce3f6097 Don't use undocumented Xt functions in external widget.
Mike Sperber <sperber@deinprogramm.de>
parents: 2114
diff changeset
164 isMine(XEvent *event, QueryStruct *q)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
165 {
4331
4fbcce3f6097 Don't use undocumented Xt functions in external widget.
Mike Sperber <sperber@deinprogramm.de>
parents: 2114
diff changeset
166 Widget w = q->w;
2108
8de911beca70 [xemacs-hg @ 2004-06-02 09:16:14 by didierv]
didierv
parents: 1094
diff changeset
167
4331
4fbcce3f6097 Don't use undocumented Xt functions in external widget.
Mike Sperber <sperber@deinprogramm.de>
parents: 2114
diff changeset
168 if ( (event->xany.display != XtDisplay(w)) || (event->xany.window != XtWindow(w)) )
4fbcce3f6097 Don't use undocumented Xt functions in external widget.
Mike Sperber <sperber@deinprogramm.de>
parents: 2114
diff changeset
169 {
4fbcce3f6097 Don't use undocumented Xt functions in external widget.
Mike Sperber <sperber@deinprogramm.de>
parents: 2114
diff changeset
170 return FALSE;
4fbcce3f6097 Don't use undocumented Xt functions in external widget.
Mike Sperber <sperber@deinprogramm.de>
parents: 2114
diff changeset
171 }
4fbcce3f6097 Don't use undocumented Xt functions in external widget.
Mike Sperber <sperber@deinprogramm.de>
parents: 2114
diff changeset
172 if (event->xany.serial >= q->request_num)
4fbcce3f6097 Don't use undocumented Xt functions in external widget.
Mike Sperber <sperber@deinprogramm.de>
parents: 2114
diff changeset
173 {
4fbcce3f6097 Don't use undocumented Xt functions in external widget.
Mike Sperber <sperber@deinprogramm.de>
parents: 2114
diff changeset
174 if (event->type == ClientMessage &&
4fbcce3f6097 Don't use undocumented Xt functions in external widget.
Mike Sperber <sperber@deinprogramm.de>
parents: 2114
diff changeset
175 event->xclient.message_type == a_EXTW_NOTIFY &&
4fbcce3f6097 Don't use undocumented Xt functions in external widget.
Mike Sperber <sperber@deinprogramm.de>
parents: 2114
diff changeset
176 event->xclient.data.l[0] == 1 - extw_which_side &&
4fbcce3f6097 Don't use undocumented Xt functions in external widget.
Mike Sperber <sperber@deinprogramm.de>
parents: 2114
diff changeset
177 event->xclient.data.l[1] == (int) q->type)
4fbcce3f6097 Don't use undocumented Xt functions in external widget.
Mike Sperber <sperber@deinprogramm.de>
parents: 2114
diff changeset
178 {
4fbcce3f6097 Don't use undocumented Xt functions in external widget.
Mike Sperber <sperber@deinprogramm.de>
parents: 2114
diff changeset
179 return TRUE;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180 }
4331
4fbcce3f6097 Don't use undocumented Xt functions in external widget.
Mike Sperber <sperber@deinprogramm.de>
parents: 2114
diff changeset
181 }
4fbcce3f6097 Don't use undocumented Xt functions in external widget.
Mike Sperber <sperber@deinprogramm.de>
parents: 2114
diff changeset
182 return FALSE;
4fbcce3f6097 Don't use undocumented Xt functions in external widget.
Mike Sperber <sperber@deinprogramm.de>
parents: 2114
diff changeset
183 }
4fbcce3f6097 Don't use undocumented Xt functions in external widget.
Mike Sperber <sperber@deinprogramm.de>
parents: 2114
diff changeset
184
4fbcce3f6097 Don't use undocumented Xt functions in external widget.
Mike Sperber <sperber@deinprogramm.de>
parents: 2114
diff changeset
185 void responseTimeOut(XtPointer clientData, XtIntervalId * UNUSED (id))
4fbcce3f6097 Don't use undocumented Xt functions in external widget.
Mike Sperber <sperber@deinprogramm.de>
parents: 2114
diff changeset
186 {
4fbcce3f6097 Don't use undocumented Xt functions in external widget.
Mike Sperber <sperber@deinprogramm.de>
parents: 2114
diff changeset
187 Bool *expired=(Bool *)clientData;
4fbcce3f6097 Don't use undocumented Xt functions in external widget.
Mike Sperber <sperber@deinprogramm.de>
parents: 2114
diff changeset
188 *expired=TRUE;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
189 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
190
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
191 /* wait for a ClientMessage of the specified type from the other widget, or
4331
4fbcce3f6097 Don't use undocumented Xt functions in external widget.
Mike Sperber <sperber@deinprogramm.de>
parents: 2114
diff changeset
192 time-out. isMine() determines whether an event matches.
4fbcce3f6097 Don't use undocumented Xt functions in external widget.
Mike Sperber <sperber@deinprogramm.de>
parents: 2114
diff changeset
193 Took out the call to _XtWaitForSomething and replaced it with public
4fbcce3f6097 Don't use undocumented Xt functions in external widget.
Mike Sperber <sperber@deinprogramm.de>
parents: 2114
diff changeset
194 Xt api's.
4fbcce3f6097 Don't use undocumented Xt functions in external widget.
Mike Sperber <sperber@deinprogramm.de>
parents: 2114
diff changeset
195 */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
196
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
197 Bool
2108
8de911beca70 [xemacs-hg @ 2004-06-02 09:16:14 by didierv]
didierv
parents: 1094
diff changeset
198 extw_wait_for_response (Widget w, XEvent *event, unsigned long request_num,
8de911beca70 [xemacs-hg @ 2004-06-02 09:16:14 by didierv]
didierv
parents: 1094
diff changeset
199 en_extw_notify type, unsigned long timeout)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
200 {
2108
8de911beca70 [xemacs-hg @ 2004-06-02 09:16:14 by didierv]
didierv
parents: 1094
diff changeset
201 XtAppContext app = XtWidgetToApplicationContext(w);
4331
4fbcce3f6097 Don't use undocumented Xt functions in external widget.
Mike Sperber <sperber@deinprogramm.de>
parents: 2114
diff changeset
202 XtInputMask inputMask;
2108
8de911beca70 [xemacs-hg @ 2004-06-02 09:16:14 by didierv]
didierv
parents: 1094
diff changeset
203 QueryStruct q;
4331
4fbcce3f6097 Don't use undocumented Xt functions in external widget.
Mike Sperber <sperber@deinprogramm.de>
parents: 2114
diff changeset
204 Bool expired;
4fbcce3f6097 Don't use undocumented Xt functions in external widget.
Mike Sperber <sperber@deinprogramm.de>
parents: 2114
diff changeset
205 XtIntervalId id;
2108
8de911beca70 [xemacs-hg @ 2004-06-02 09:16:14 by didierv]
didierv
parents: 1094
diff changeset
206
8de911beca70 [xemacs-hg @ 2004-06-02 09:16:14 by didierv]
didierv
parents: 1094
diff changeset
207 q.w = w;
8de911beca70 [xemacs-hg @ 2004-06-02 09:16:14 by didierv]
didierv
parents: 1094
diff changeset
208 q.request_num = request_num;
8de911beca70 [xemacs-hg @ 2004-06-02 09:16:14 by didierv]
didierv
parents: 1094
diff changeset
209 q.type = type;
4331
4fbcce3f6097 Don't use undocumented Xt functions in external widget.
Mike Sperber <sperber@deinprogramm.de>
parents: 2114
diff changeset
210 expired=FALSE;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
211
4331
4fbcce3f6097 Don't use undocumented Xt functions in external widget.
Mike Sperber <sperber@deinprogramm.de>
parents: 2114
diff changeset
212 id=XtAppAddTimeOut(app, timeout, responseTimeOut,&expired);
4fbcce3f6097 Don't use undocumented Xt functions in external widget.
Mike Sperber <sperber@deinprogramm.de>
parents: 2114
diff changeset
213 while (!expired)
2108
8de911beca70 [xemacs-hg @ 2004-06-02 09:16:14 by didierv]
didierv
parents: 1094
diff changeset
214 {
4331
4fbcce3f6097 Don't use undocumented Xt functions in external widget.
Mike Sperber <sperber@deinprogramm.de>
parents: 2114
diff changeset
215 inputMask=XtAppPending(app);
4fbcce3f6097 Don't use undocumented Xt functions in external widget.
Mike Sperber <sperber@deinprogramm.de>
parents: 2114
diff changeset
216 if (inputMask & XtIMXEvent)
4fbcce3f6097 Don't use undocumented Xt functions in external widget.
Mike Sperber <sperber@deinprogramm.de>
parents: 2114
diff changeset
217 {
4fbcce3f6097 Don't use undocumented Xt functions in external widget.
Mike Sperber <sperber@deinprogramm.de>
parents: 2114
diff changeset
218 XtAppNextEvent(app, event);
4fbcce3f6097 Don't use undocumented Xt functions in external widget.
Mike Sperber <sperber@deinprogramm.de>
parents: 2114
diff changeset
219 if (isMine(event,&q))
4fbcce3f6097 Don't use undocumented Xt functions in external widget.
Mike Sperber <sperber@deinprogramm.de>
parents: 2114
diff changeset
220 {
4fbcce3f6097 Don't use undocumented Xt functions in external widget.
Mike Sperber <sperber@deinprogramm.de>
parents: 2114
diff changeset
221 if (!expired) XtRemoveTimeOut(id);
4fbcce3f6097 Don't use undocumented Xt functions in external widget.
Mike Sperber <sperber@deinprogramm.de>
parents: 2114
diff changeset
222 return True;
4fbcce3f6097 Don't use undocumented Xt functions in external widget.
Mike Sperber <sperber@deinprogramm.de>
parents: 2114
diff changeset
223 }
4fbcce3f6097 Don't use undocumented Xt functions in external widget.
Mike Sperber <sperber@deinprogramm.de>
parents: 2114
diff changeset
224 else
4fbcce3f6097 Don't use undocumented Xt functions in external widget.
Mike Sperber <sperber@deinprogramm.de>
parents: 2114
diff changeset
225 {
4fbcce3f6097 Don't use undocumented Xt functions in external widget.
Mike Sperber <sperber@deinprogramm.de>
parents: 2114
diff changeset
226 /* Do Nothing and go back to waiting */
4fbcce3f6097 Don't use undocumented Xt functions in external widget.
Mike Sperber <sperber@deinprogramm.de>
parents: 2114
diff changeset
227 }
4fbcce3f6097 Don't use undocumented Xt functions in external widget.
Mike Sperber <sperber@deinprogramm.de>
parents: 2114
diff changeset
228 }
4fbcce3f6097 Don't use undocumented Xt functions in external widget.
Mike Sperber <sperber@deinprogramm.de>
parents: 2114
diff changeset
229 if (inputMask & XtIMTimer)
4fbcce3f6097 Don't use undocumented Xt functions in external widget.
Mike Sperber <sperber@deinprogramm.de>
parents: 2114
diff changeset
230 {
4fbcce3f6097 Don't use undocumented Xt functions in external widget.
Mike Sperber <sperber@deinprogramm.de>
parents: 2114
diff changeset
231 /* Process the expired timer */
4fbcce3f6097 Don't use undocumented Xt functions in external widget.
Mike Sperber <sperber@deinprogramm.de>
parents: 2114
diff changeset
232 XtAppProcessEvent(app,XtIMTimer);
4fbcce3f6097 Don't use undocumented Xt functions in external widget.
Mike Sperber <sperber@deinprogramm.de>
parents: 2114
diff changeset
233 }
2108
8de911beca70 [xemacs-hg @ 2004-06-02 09:16:14 by didierv]
didierv
parents: 1094
diff changeset
234 }
4331
4fbcce3f6097 Don't use undocumented Xt functions in external widget.
Mike Sperber <sperber@deinprogramm.de>
parents: 2114
diff changeset
235 /* Must have expired */
4fbcce3f6097 Don't use undocumented Xt functions in external widget.
Mike Sperber <sperber@deinprogramm.de>
parents: 2114
diff changeset
236 return False;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
237 }