annotate src/extw-Xt.c @ 5090:0ca81354c4c7

Further frame-geometry cleanups -------------------- ChangeLog entries follow: -------------------- man/ChangeLog addition: 2010-03-03 Ben Wing <ben@xemacs.org> * internals/internals.texi (Intro to Window and Frame Geometry): * internals/internals.texi (The Paned Area): * internals/internals.texi (The Displayable Area): Update to make note of e.g. the fact that the bottom gutter is actually above the minibuffer. src/ChangeLog addition: 2010-03-03 Ben Wing <ben@xemacs.org> * emacs.c: * emacs.c (assert_equal_failed): * lisp.h: * lisp.h (assert_equal): New fun assert_equal, asserting that two values == each other, and printing out both values upon failure. * frame-gtk.c (gtk_initialize_frame_size): * frame-impl.h: * frame-impl.h (FRAME_TOP_INTERNAL_BORDER_START): * frame-impl.h (FRAME_BOTTOM_INTERNAL_BORDER_START): * frame-impl.h (FRAME_LEFT_INTERNAL_BORDER_START): * frame-impl.h (FRAME_PANED_TOP_EDGE): * frame-impl.h (FRAME_NONPANED_SIZE): * frame-x.c (x_initialize_frame_size): * frame.c: * gutter.c (get_gutter_coords): * gutter.c (calculate_gutter_size): * gutter.h: * gutter.h (WINDOW_REAL_TOP_GUTTER_BOUNDS): * gutter.h (FRAME_TOP_GUTTER_BOUNDS): * input-method-xlib.c: * input-method-xlib.c (XIM_SetGeometry): * redisplay-output.c (clear_left_border): * redisplay-output.c (clear_right_border): * redisplay-output.c (redisplay_output_pixmap): * redisplay-output.c (redisplay_clear_region): * redisplay-output.c (redisplay_clear_top_of_window): * redisplay-output.c (redisplay_clear_to_window_end): * redisplay-xlike-inc.c (XLIKE_clear_frame): * redisplay.c: * redisplay.c (UPDATE_CACHE_RETURN): * redisplay.c (pixel_to_glyph_translation): * toolbar.c (update_frame_toolbars_geometry): * window.c (Fwindow_pixel_edges): Get rid of some redundant macros. Consistently use the FRAME_TOP_*_START, FRAME_RIGHT_*_END, etc. format. Rename FRAME_*_BORDER_* to FRAME_*_INTERNAL_BORDER_*. Comment out FRAME_BOTTOM_* for gutters and the paned area due to the uncertainty over where the paned area actually begins. (Eventually we should probably move the gutters outside the minibuffer so that the paned area is contiguous.) Use FRAME_PANED_* more often in the code to make things clearer. Update the diagram to show that the bottom gutter is inside the minibuffer (!) and that there are "junk boxes" when you have left and/or right gutters (dead boxes that are mistakenly left uncleared, unlike the corresponding scrollbar dead boxes). Update the text appropriately to cover the bottom gutter position, etc. Rewrite gutter-geometry code to use the FRAME_*_GUTTER_* in place of equivalent expressions referencing other frame elements, to make the code more portable in case we move around the gutter location. Cleanup FRAME_*_GUTTER_BOUNDS() in gutter.h. Add some #### GEOM! comments where I think code is incorrect -- typically, it wasn't fixed up properly when the gutter was added. Some cosmetic changes.
author Ben Wing <ben@xemacs.org>
date Wed, 03 Mar 2010 05:07:47 -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 }