annotate src/extw-Xt.c @ 5673:900a0a8796c3 r21-5-32

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