annotate oldXMenu/Internal.c @ 76493:e5e12c57c640

(sigchld_handler): Change type of pid to pid_t. Scan deleted_pid_list explicitly to avoid using Fmember which don't know about mark bits and make_fixnum_or_float which may malloc. Reported by Andreas Schwab.
author Chong Yidong <cyd@stupidchicken.com>
date Sat, 17 Mar 2007 18:16:03 +0000
parents 365a8de87f1f
children 95361d2f1ff8 edf631bdbb7a ec58e5c426ef
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
76170
365a8de87f1f Add GPL for FSF copyright. Adjust FSF copyright years based on
Glenn Morris <rgm@gnu.org>
parents: 75348
diff changeset
1 /* Copyright Massachusetts Institute of Technology 1985 */
365a8de87f1f Add GPL for FSF copyright. Adjust FSF copyright years based on
Glenn Morris <rgm@gnu.org>
parents: 75348
diff changeset
2
25858
Dave Love <fx@gnu.org>
parents:
diff changeset
3 #include "copyright.h"
Dave Love <fx@gnu.org>
parents:
diff changeset
4
76170
365a8de87f1f Add GPL for FSF copyright. Adjust FSF copyright years based on
Glenn Morris <rgm@gnu.org>
parents: 75348
diff changeset
5 /*
365a8de87f1f Add GPL for FSF copyright. Adjust FSF copyright years based on
Glenn Morris <rgm@gnu.org>
parents: 75348
diff changeset
6 Copyright (C) 1993, 1996, 2001, 2002, 2003, 2004, 2005, 2006,
365a8de87f1f Add GPL for FSF copyright. Adjust FSF copyright years based on
Glenn Morris <rgm@gnu.org>
parents: 75348
diff changeset
7 2007 Free Software Foundation, Inc.
365a8de87f1f Add GPL for FSF copyright. Adjust FSF copyright years based on
Glenn Morris <rgm@gnu.org>
parents: 75348
diff changeset
8
365a8de87f1f Add GPL for FSF copyright. Adjust FSF copyright years based on
Glenn Morris <rgm@gnu.org>
parents: 75348
diff changeset
9 This program is free software; you can redistribute it and/or modify
365a8de87f1f Add GPL for FSF copyright. Adjust FSF copyright years based on
Glenn Morris <rgm@gnu.org>
parents: 75348
diff changeset
10 it under the terms of the GNU General Public License as published by
365a8de87f1f Add GPL for FSF copyright. Adjust FSF copyright years based on
Glenn Morris <rgm@gnu.org>
parents: 75348
diff changeset
11 the Free Software Foundation; either version 2, or (at your option)
365a8de87f1f Add GPL for FSF copyright. Adjust FSF copyright years based on
Glenn Morris <rgm@gnu.org>
parents: 75348
diff changeset
12 any later version.
365a8de87f1f Add GPL for FSF copyright. Adjust FSF copyright years based on
Glenn Morris <rgm@gnu.org>
parents: 75348
diff changeset
13
365a8de87f1f Add GPL for FSF copyright. Adjust FSF copyright years based on
Glenn Morris <rgm@gnu.org>
parents: 75348
diff changeset
14 This program is distributed in the hope that it will be useful,
365a8de87f1f Add GPL for FSF copyright. Adjust FSF copyright years based on
Glenn Morris <rgm@gnu.org>
parents: 75348
diff changeset
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
365a8de87f1f Add GPL for FSF copyright. Adjust FSF copyright years based on
Glenn Morris <rgm@gnu.org>
parents: 75348
diff changeset
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
365a8de87f1f Add GPL for FSF copyright. Adjust FSF copyright years based on
Glenn Morris <rgm@gnu.org>
parents: 75348
diff changeset
17 GNU General Public License for more details.
365a8de87f1f Add GPL for FSF copyright. Adjust FSF copyright years based on
Glenn Morris <rgm@gnu.org>
parents: 75348
diff changeset
18
365a8de87f1f Add GPL for FSF copyright. Adjust FSF copyright years based on
Glenn Morris <rgm@gnu.org>
parents: 75348
diff changeset
19 You should have received a copy of the GNU General Public License
365a8de87f1f Add GPL for FSF copyright. Adjust FSF copyright years based on
Glenn Morris <rgm@gnu.org>
parents: 75348
diff changeset
20 along with this program; see the file COPYING. If not, write to the
365a8de87f1f Add GPL for FSF copyright. Adjust FSF copyright years based on
Glenn Morris <rgm@gnu.org>
parents: 75348
diff changeset
21 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
365a8de87f1f Add GPL for FSF copyright. Adjust FSF copyright years based on
Glenn Morris <rgm@gnu.org>
parents: 75348
diff changeset
22 Boston, MA 02110-1301, USA. */
365a8de87f1f Add GPL for FSF copyright. Adjust FSF copyright years based on
Glenn Morris <rgm@gnu.org>
parents: 75348
diff changeset
23
25858
Dave Love <fx@gnu.org>
parents:
diff changeset
24
Dave Love <fx@gnu.org>
parents:
diff changeset
25 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
26 * XMenu: MIT Project Athena, X Window system menu package
Dave Love <fx@gnu.org>
parents:
diff changeset
27 *
Dave Love <fx@gnu.org>
parents:
diff changeset
28 * XMenuInternal.c - XMenu internal (not user visible) routines.
Dave Love <fx@gnu.org>
parents:
diff changeset
29 *
Dave Love <fx@gnu.org>
parents:
diff changeset
30 * Author: Tony Della Fera, DEC
Dave Love <fx@gnu.org>
parents:
diff changeset
31 * November, 1985
Dave Love <fx@gnu.org>
parents:
diff changeset
32 *
Dave Love <fx@gnu.org>
parents:
diff changeset
33 */
Dave Love <fx@gnu.org>
parents:
diff changeset
34
Dave Love <fx@gnu.org>
parents:
diff changeset
35 #include <config.h>
Dave Love <fx@gnu.org>
parents:
diff changeset
36 #include "XMenuInt.h"
Dave Love <fx@gnu.org>
parents:
diff changeset
37
Dave Love <fx@gnu.org>
parents:
diff changeset
38 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
39 * Toggle color macro.
Dave Love <fx@gnu.org>
parents:
diff changeset
40 */
Dave Love <fx@gnu.org>
parents:
diff changeset
41 #define toggle_color(x) \
Dave Love <fx@gnu.org>
parents:
diff changeset
42 ((x) == menu->bkgnd_color ? menu->s_frg_color : menu->bkgnd_color)
Dave Love <fx@gnu.org>
parents:
diff changeset
43
Dave Love <fx@gnu.org>
parents:
diff changeset
44 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
45 * Internal Window creation queue sizes.
Dave Love <fx@gnu.org>
parents:
diff changeset
46 */
Dave Love <fx@gnu.org>
parents:
diff changeset
47 #define S_QUE_SIZE 300
Dave Love <fx@gnu.org>
parents:
diff changeset
48 #define P_QUE_SIZE 20
Dave Love <fx@gnu.org>
parents:
diff changeset
49 #define BUFFER_SIZE (S_QUE_SIZE >= P_QUE_SIZE ? S_QUE_SIZE : P_QUE_SIZE)
Dave Love <fx@gnu.org>
parents:
diff changeset
50
Dave Love <fx@gnu.org>
parents:
diff changeset
51
Dave Love <fx@gnu.org>
parents:
diff changeset
52 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
53 * XMWinQue - Internal window creation queue datatype.
Dave Love <fx@gnu.org>
parents:
diff changeset
54 */
Dave Love <fx@gnu.org>
parents:
diff changeset
55 typedef struct _xmwinquedef {
Dave Love <fx@gnu.org>
parents:
diff changeset
56 int sq_size;
Dave Love <fx@gnu.org>
parents:
diff changeset
57 XMSelect *sq[S_QUE_SIZE];
Dave Love <fx@gnu.org>
parents:
diff changeset
58 XMSelect **sq_ptr;
Dave Love <fx@gnu.org>
parents:
diff changeset
59 int pq_size;
Dave Love <fx@gnu.org>
parents:
diff changeset
60 XMPane *pq[P_QUE_SIZE];
Dave Love <fx@gnu.org>
parents:
diff changeset
61 XMPane **pq_ptr;
Dave Love <fx@gnu.org>
parents:
diff changeset
62 } XMWinQue;
Dave Love <fx@gnu.org>
parents:
diff changeset
63
Dave Love <fx@gnu.org>
parents:
diff changeset
64 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
65 * _XMWinQue - Internal static window creation queue.
Dave Love <fx@gnu.org>
parents:
diff changeset
66 */
Dave Love <fx@gnu.org>
parents:
diff changeset
67 static Bool _XMWinQueIsInit = False;
Dave Love <fx@gnu.org>
parents:
diff changeset
68 static XMWinQue _XMWinQue;
Dave Love <fx@gnu.org>
parents:
diff changeset
69
Dave Love <fx@gnu.org>
parents:
diff changeset
70 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
71 * _XMErrorCode - Global XMenu error code.
Dave Love <fx@gnu.org>
parents:
diff changeset
72 */
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 25858
diff changeset
73 int _XMErrorCode = XME_NO_ERROR;
25858
Dave Love <fx@gnu.org>
parents:
diff changeset
74 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
75 * _XMErrorList - Global XMenu error code description strings.
Dave Love <fx@gnu.org>
parents:
diff changeset
76 */
Dave Love <fx@gnu.org>
parents:
diff changeset
77 char *
Dave Love <fx@gnu.org>
parents:
diff changeset
78 _XMErrorList[XME_CODE_COUNT] = {
Dave Love <fx@gnu.org>
parents:
diff changeset
79 "No error", /* XME_NO_ERROR */
Dave Love <fx@gnu.org>
parents:
diff changeset
80 "Menu not initialized", /* XME_NOT_INIT */
Dave Love <fx@gnu.org>
parents:
diff changeset
81 "Argument out of bounds", /* XME_ARG_BOUNDS */
Dave Love <fx@gnu.org>
parents:
diff changeset
82 "Pane not found", /* XME_P_NOT_FOUND */
Dave Love <fx@gnu.org>
parents:
diff changeset
83 "Selection not found", /* XME_S_NOT_FOUND */
Dave Love <fx@gnu.org>
parents:
diff changeset
84 "Invalid menu style parameter", /* XME_STYLE_PARAM */
Dave Love <fx@gnu.org>
parents:
diff changeset
85 "Unable to grab mouse", /* XME_GRAB_MOUSE */
Dave Love <fx@gnu.org>
parents:
diff changeset
86 "Unable to interpret locator", /* XME_INTERP_LOC */
Dave Love <fx@gnu.org>
parents:
diff changeset
87 "Unable to calloc memory", /* XME_CALLOC */
Dave Love <fx@gnu.org>
parents:
diff changeset
88 "Unable to create XAssocTable", /* XME_CREATE_ASSOC */
Dave Love <fx@gnu.org>
parents:
diff changeset
89 "Unable to store bitmap", /* XME_STORE_BITMAP */
Dave Love <fx@gnu.org>
parents:
diff changeset
90 "Unable to make tile pixmaps", /* XME_MAKE_TILES */
Dave Love <fx@gnu.org>
parents:
diff changeset
91 "Unable to make pixmap", /* XME_MAKE_PIXMAP */
Dave Love <fx@gnu.org>
parents:
diff changeset
92 "Unable to create cursor", /* XME_CREATE_CURSOR */
Dave Love <fx@gnu.org>
parents:
diff changeset
93 "Unable to open font", /* XME_OPEN_FONT */
Dave Love <fx@gnu.org>
parents:
diff changeset
94 "Unable to create windows", /* XME_CREATE_WINDOW */
Dave Love <fx@gnu.org>
parents:
diff changeset
95 "Unable to create transparencies", /* XME_CREATE_TRANSP */
Dave Love <fx@gnu.org>
parents:
diff changeset
96 };
Dave Love <fx@gnu.org>
parents:
diff changeset
97
Dave Love <fx@gnu.org>
parents:
diff changeset
98 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
99 * _XMEventHandler - Internal event handler variable.
Dave Love <fx@gnu.org>
parents:
diff changeset
100 */
Dave Love <fx@gnu.org>
parents:
diff changeset
101 int (*_XMEventHandler)() = NULL;
Dave Love <fx@gnu.org>
parents:
diff changeset
102
Dave Love <fx@gnu.org>
parents:
diff changeset
103
Dave Love <fx@gnu.org>
parents:
diff changeset
104
Dave Love <fx@gnu.org>
parents:
diff changeset
105 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
106 * _XMWinQueInit - Internal routine to initialize the window
Dave Love <fx@gnu.org>
parents:
diff changeset
107 * queue.
Dave Love <fx@gnu.org>
parents:
diff changeset
108 */
Dave Love <fx@gnu.org>
parents:
diff changeset
109 _XMWinQueInit()
Dave Love <fx@gnu.org>
parents:
diff changeset
110 {
Dave Love <fx@gnu.org>
parents:
diff changeset
111 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
112 * If the queue is not initialized initialize it.
Dave Love <fx@gnu.org>
parents:
diff changeset
113 */
Dave Love <fx@gnu.org>
parents:
diff changeset
114 if (!_XMWinQueIsInit) {
Dave Love <fx@gnu.org>
parents:
diff changeset
115 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
116 * Blank the queue structure.
Dave Love <fx@gnu.org>
parents:
diff changeset
117 */
Dave Love <fx@gnu.org>
parents:
diff changeset
118 register int i;
Dave Love <fx@gnu.org>
parents:
diff changeset
119
Dave Love <fx@gnu.org>
parents:
diff changeset
120 for (i = 0; i < S_QUE_SIZE; i++)
Dave Love <fx@gnu.org>
parents:
diff changeset
121 _XMWinQue.sq[i] = 0;
Dave Love <fx@gnu.org>
parents:
diff changeset
122
Dave Love <fx@gnu.org>
parents:
diff changeset
123 for (i = 0; i < P_QUE_SIZE; i++)
Dave Love <fx@gnu.org>
parents:
diff changeset
124 _XMWinQue.pq[i] = 0;
Dave Love <fx@gnu.org>
parents:
diff changeset
125
Dave Love <fx@gnu.org>
parents:
diff changeset
126 _XMWinQue.sq_size = _XMWinQue.pq_size = 0;
Dave Love <fx@gnu.org>
parents:
diff changeset
127
Dave Love <fx@gnu.org>
parents:
diff changeset
128 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
129 * Initialize the next free location pointers.
Dave Love <fx@gnu.org>
parents:
diff changeset
130 */
Dave Love <fx@gnu.org>
parents:
diff changeset
131 _XMWinQue.sq_ptr = _XMWinQue.sq;
Dave Love <fx@gnu.org>
parents:
diff changeset
132 _XMWinQue.pq_ptr = _XMWinQue.pq;
Dave Love <fx@gnu.org>
parents:
diff changeset
133 }
Dave Love <fx@gnu.org>
parents:
diff changeset
134 }
Dave Love <fx@gnu.org>
parents:
diff changeset
135
Dave Love <fx@gnu.org>
parents:
diff changeset
136
Dave Love <fx@gnu.org>
parents:
diff changeset
137
Dave Love <fx@gnu.org>
parents:
diff changeset
138 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
139 * _XMWinQueAddPane - Internal routine to add a pane to the pane
Dave Love <fx@gnu.org>
parents:
diff changeset
140 * window queue.
Dave Love <fx@gnu.org>
parents:
diff changeset
141 */
Dave Love <fx@gnu.org>
parents:
diff changeset
142 int
Dave Love <fx@gnu.org>
parents:
diff changeset
143 _XMWinQueAddPane(display, menu, p_ptr)
Dave Love <fx@gnu.org>
parents:
diff changeset
144 register Display *display;
Dave Love <fx@gnu.org>
parents:
diff changeset
145 register XMenu *menu; /* Menu being manipulated. */
Dave Love <fx@gnu.org>
parents:
diff changeset
146 register XMPane *p_ptr; /* XMPane being queued. */
Dave Love <fx@gnu.org>
parents:
diff changeset
147 {
Dave Love <fx@gnu.org>
parents:
diff changeset
148 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
149 * If the queue is currently full then flush it.
Dave Love <fx@gnu.org>
parents:
diff changeset
150 */
Dave Love <fx@gnu.org>
parents:
diff changeset
151 if (_XMWinQue.pq_size == P_QUE_SIZE) {
Dave Love <fx@gnu.org>
parents:
diff changeset
152 if (_XMWinQueFlush(display, menu, 0, 0) == _FAILURE) return(_FAILURE);
Dave Love <fx@gnu.org>
parents:
diff changeset
153 }
Dave Love <fx@gnu.org>
parents:
diff changeset
154
Dave Love <fx@gnu.org>
parents:
diff changeset
155 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
156 * Insert the new XMPane pointer and increment the queue pointer
Dave Love <fx@gnu.org>
parents:
diff changeset
157 * and the queue size.
Dave Love <fx@gnu.org>
parents:
diff changeset
158 */
Dave Love <fx@gnu.org>
parents:
diff changeset
159 *_XMWinQue.pq_ptr = p_ptr;
Dave Love <fx@gnu.org>
parents:
diff changeset
160 _XMWinQue.pq_ptr++;
Dave Love <fx@gnu.org>
parents:
diff changeset
161 _XMWinQue.pq_size++;
Dave Love <fx@gnu.org>
parents:
diff changeset
162
Dave Love <fx@gnu.org>
parents:
diff changeset
163 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
164 * All went well, return successfully.
Dave Love <fx@gnu.org>
parents:
diff changeset
165 */
Dave Love <fx@gnu.org>
parents:
diff changeset
166 _XMErrorCode = XME_NO_ERROR;
Dave Love <fx@gnu.org>
parents:
diff changeset
167 return(_SUCCESS);
Dave Love <fx@gnu.org>
parents:
diff changeset
168 }
Dave Love <fx@gnu.org>
parents:
diff changeset
169
Dave Love <fx@gnu.org>
parents:
diff changeset
170
Dave Love <fx@gnu.org>
parents:
diff changeset
171
Dave Love <fx@gnu.org>
parents:
diff changeset
172 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
173 * _XMWinQueAddSelection - Internal routine to add a selection to
Dave Love <fx@gnu.org>
parents:
diff changeset
174 * the selection window queue.
Dave Love <fx@gnu.org>
parents:
diff changeset
175 */
Dave Love <fx@gnu.org>
parents:
diff changeset
176 int
Dave Love <fx@gnu.org>
parents:
diff changeset
177 _XMWinQueAddSelection(display, menu, s_ptr)
Dave Love <fx@gnu.org>
parents:
diff changeset
178 register Display *display;
Dave Love <fx@gnu.org>
parents:
diff changeset
179 register XMenu *menu; /* Menu being manipulated. */
Dave Love <fx@gnu.org>
parents:
diff changeset
180 register XMSelect *s_ptr; /* XMSelection being queued. */
Dave Love <fx@gnu.org>
parents:
diff changeset
181 {
Dave Love <fx@gnu.org>
parents:
diff changeset
182 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
183 * If this entry will overflow the queue then flush it.
Dave Love <fx@gnu.org>
parents:
diff changeset
184 */
Dave Love <fx@gnu.org>
parents:
diff changeset
185 if (_XMWinQue.sq_size == S_QUE_SIZE) {
Dave Love <fx@gnu.org>
parents:
diff changeset
186 if (_XMWinQueFlush(display, menu, 0, 0) == _FAILURE) return(_FAILURE);
Dave Love <fx@gnu.org>
parents:
diff changeset
187 }
Dave Love <fx@gnu.org>
parents:
diff changeset
188
Dave Love <fx@gnu.org>
parents:
diff changeset
189 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
190 * Insert the new XMSelect pointer and increment the queue pointer
Dave Love <fx@gnu.org>
parents:
diff changeset
191 * and the queue size.
Dave Love <fx@gnu.org>
parents:
diff changeset
192 */
Dave Love <fx@gnu.org>
parents:
diff changeset
193 *_XMWinQue.sq_ptr = s_ptr;
Dave Love <fx@gnu.org>
parents:
diff changeset
194 _XMWinQue.sq_ptr++;
Dave Love <fx@gnu.org>
parents:
diff changeset
195 _XMWinQue.sq_size++;
Dave Love <fx@gnu.org>
parents:
diff changeset
196
Dave Love <fx@gnu.org>
parents:
diff changeset
197 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
198 * All went well, return successfully.
Dave Love <fx@gnu.org>
parents:
diff changeset
199 */
Dave Love <fx@gnu.org>
parents:
diff changeset
200 _XMErrorCode = XME_NO_ERROR;
Dave Love <fx@gnu.org>
parents:
diff changeset
201 return(_SUCCESS);
Dave Love <fx@gnu.org>
parents:
diff changeset
202 }
Dave Love <fx@gnu.org>
parents:
diff changeset
203
Dave Love <fx@gnu.org>
parents:
diff changeset
204
Dave Love <fx@gnu.org>
parents:
diff changeset
205
Dave Love <fx@gnu.org>
parents:
diff changeset
206 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
207 * _XMWinQueFlush - Internal routine to flush the pane and
Dave Love <fx@gnu.org>
parents:
diff changeset
208 * selection window queues.
Dave Love <fx@gnu.org>
parents:
diff changeset
209 */
Dave Love <fx@gnu.org>
parents:
diff changeset
210 int
Dave Love <fx@gnu.org>
parents:
diff changeset
211 _XMWinQueFlush(display, menu, pane, select)
Dave Love <fx@gnu.org>
parents:
diff changeset
212 register Display *display;
Dave Love <fx@gnu.org>
parents:
diff changeset
213 register XMenu *menu; /* Menu being manipulated. */
Dave Love <fx@gnu.org>
parents:
diff changeset
214 register XMPane *pane; /* Current pane. */
Dave Love <fx@gnu.org>
parents:
diff changeset
215 {
Dave Love <fx@gnu.org>
parents:
diff changeset
216 register int pq_index; /* Pane queue index. */
Dave Love <fx@gnu.org>
parents:
diff changeset
217 register int sq_index; /* Selection queue index. */
Dave Love <fx@gnu.org>
parents:
diff changeset
218 register XMPane *p_ptr; /* XMPane pointer. */
Dave Love <fx@gnu.org>
parents:
diff changeset
219 register XMSelect *s_ptr; /* XMSelect pointer. */
Dave Love <fx@gnu.org>
parents:
diff changeset
220 unsigned long valuemask; /* Which attributes to set. */
Dave Love <fx@gnu.org>
parents:
diff changeset
221 XSetWindowAttributes *attributes; /* Attributes to be set. */
Dave Love <fx@gnu.org>
parents:
diff changeset
222
Dave Love <fx@gnu.org>
parents:
diff changeset
223 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
224 * If the pane window queue is not empty...
Dave Love <fx@gnu.org>
parents:
diff changeset
225 */
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 25858
diff changeset
226
25858
Dave Love <fx@gnu.org>
parents:
diff changeset
227 if (_XMWinQue.pq_size > 0) {
Dave Love <fx@gnu.org>
parents:
diff changeset
228 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
229 * set up attributes for pane window to be created.
Dave Love <fx@gnu.org>
parents:
diff changeset
230 */
Dave Love <fx@gnu.org>
parents:
diff changeset
231 valuemask = (CWBackPixmap | CWBorderPixel | CWOverrideRedirect);
Dave Love <fx@gnu.org>
parents:
diff changeset
232 attributes = (XSetWindowAttributes *)malloc(sizeof(XSetWindowAttributes));
Dave Love <fx@gnu.org>
parents:
diff changeset
233 attributes->border_pixel = menu->p_bdr_color;
Dave Love <fx@gnu.org>
parents:
diff changeset
234 attributes->background_pixmap = menu->inact_pixmap;
Dave Love <fx@gnu.org>
parents:
diff changeset
235 attributes->override_redirect = True;
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 25858
diff changeset
236
25858
Dave Love <fx@gnu.org>
parents:
diff changeset
237 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
238 * Create all the pending panes in order, so that the
Dave Love <fx@gnu.org>
parents:
diff changeset
239 * current pane will be on top, with the others
Dave Love <fx@gnu.org>
parents:
diff changeset
240 * stacked appropriately under it.
Dave Love <fx@gnu.org>
parents:
diff changeset
241 */
Dave Love <fx@gnu.org>
parents:
diff changeset
242 for (pq_index = _XMWinQue.pq_size - 1;
Dave Love <fx@gnu.org>
parents:
diff changeset
243 pq_index >= 0;
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 25858
diff changeset
244 pq_index--)
25858
Dave Love <fx@gnu.org>
parents:
diff changeset
245 {
Dave Love <fx@gnu.org>
parents:
diff changeset
246 p_ptr = _XMWinQue.pq[pq_index]; /* Retrieve next pane. */
Dave Love <fx@gnu.org>
parents:
diff changeset
247 if (p_ptr == pane) break;
Dave Love <fx@gnu.org>
parents:
diff changeset
248 p_ptr->window = XCreateWindow(display,
Dave Love <fx@gnu.org>
parents:
diff changeset
249 menu->parent,
Dave Love <fx@gnu.org>
parents:
diff changeset
250 p_ptr->window_x,
Dave Love <fx@gnu.org>
parents:
diff changeset
251 p_ptr->window_y,
Dave Love <fx@gnu.org>
parents:
diff changeset
252 p_ptr->window_w,
Dave Love <fx@gnu.org>
parents:
diff changeset
253 p_ptr->window_h,
Dave Love <fx@gnu.org>
parents:
diff changeset
254 menu->p_bdr_width,
Dave Love <fx@gnu.org>
parents:
diff changeset
255 CopyFromParent,
Dave Love <fx@gnu.org>
parents:
diff changeset
256 InputOutput,
Dave Love <fx@gnu.org>
parents:
diff changeset
257 CopyFromParent,
Dave Love <fx@gnu.org>
parents:
diff changeset
258 valuemask,
Dave Love <fx@gnu.org>
parents:
diff changeset
259 attributes);
Dave Love <fx@gnu.org>
parents:
diff changeset
260 XMakeAssoc(display, menu->assoc_tab, p_ptr->window, p_ptr);
Dave Love <fx@gnu.org>
parents:
diff changeset
261 XSelectInput(display, p_ptr->window, menu->p_events);
Dave Love <fx@gnu.org>
parents:
diff changeset
262 }
Dave Love <fx@gnu.org>
parents:
diff changeset
263 for (pq_index = 0;
Dave Love <fx@gnu.org>
parents:
diff changeset
264 pq_index < _XMWinQue.pq_size;
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 25858
diff changeset
265 pq_index++)
25858
Dave Love <fx@gnu.org>
parents:
diff changeset
266 {
Dave Love <fx@gnu.org>
parents:
diff changeset
267 p_ptr = _XMWinQue.pq[pq_index]; /* Retrieve next pane. */
Dave Love <fx@gnu.org>
parents:
diff changeset
268 p_ptr->window = XCreateWindow(display,
Dave Love <fx@gnu.org>
parents:
diff changeset
269 menu->parent,
Dave Love <fx@gnu.org>
parents:
diff changeset
270 p_ptr->window_x,
Dave Love <fx@gnu.org>
parents:
diff changeset
271 p_ptr->window_y,
Dave Love <fx@gnu.org>
parents:
diff changeset
272 p_ptr->window_w,
Dave Love <fx@gnu.org>
parents:
diff changeset
273 p_ptr->window_h,
Dave Love <fx@gnu.org>
parents:
diff changeset
274 menu->p_bdr_width,
Dave Love <fx@gnu.org>
parents:
diff changeset
275 CopyFromParent,
Dave Love <fx@gnu.org>
parents:
diff changeset
276 InputOutput,
Dave Love <fx@gnu.org>
parents:
diff changeset
277 CopyFromParent,
Dave Love <fx@gnu.org>
parents:
diff changeset
278 valuemask,
Dave Love <fx@gnu.org>
parents:
diff changeset
279 attributes);
Dave Love <fx@gnu.org>
parents:
diff changeset
280 XMakeAssoc(display, menu->assoc_tab, p_ptr->window, p_ptr);
Dave Love <fx@gnu.org>
parents:
diff changeset
281 XSelectInput(display, p_ptr->window, menu->p_events);
Dave Love <fx@gnu.org>
parents:
diff changeset
282 if (p_ptr == pane) break;
Dave Love <fx@gnu.org>
parents:
diff changeset
283 }
Dave Love <fx@gnu.org>
parents:
diff changeset
284
Dave Love <fx@gnu.org>
parents:
diff changeset
285 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
286 * Reset the pane queue pointer and size.
Dave Love <fx@gnu.org>
parents:
diff changeset
287 */
Dave Love <fx@gnu.org>
parents:
diff changeset
288 _XMWinQue.pq_size = 0;
Dave Love <fx@gnu.org>
parents:
diff changeset
289 _XMWinQue.pq_ptr = _XMWinQue.pq;
Dave Love <fx@gnu.org>
parents:
diff changeset
290 }
Dave Love <fx@gnu.org>
parents:
diff changeset
291
Dave Love <fx@gnu.org>
parents:
diff changeset
292 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
293 * If the selection window queue is not empty...
Dave Love <fx@gnu.org>
parents:
diff changeset
294 */
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 25858
diff changeset
295
25858
Dave Love <fx@gnu.org>
parents:
diff changeset
296 if (_XMWinQue.sq_size > 0) {
Dave Love <fx@gnu.org>
parents:
diff changeset
297
Dave Love <fx@gnu.org>
parents:
diff changeset
298 for (sq_index = 0; sq_index < _XMWinQue.sq_size; sq_index++) {
Dave Love <fx@gnu.org>
parents:
diff changeset
299 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
300 * Retrieve the XMSelect pointer.
Dave Love <fx@gnu.org>
parents:
diff changeset
301 */
Dave Love <fx@gnu.org>
parents:
diff changeset
302 s_ptr = _XMWinQue.sq[sq_index];
Dave Love <fx@gnu.org>
parents:
diff changeset
303 s_ptr->window = XCreateWindow(display,
Dave Love <fx@gnu.org>
parents:
diff changeset
304 s_ptr->parent_p->window,
Dave Love <fx@gnu.org>
parents:
diff changeset
305 s_ptr->window_x,
Dave Love <fx@gnu.org>
parents:
diff changeset
306 s_ptr->window_y,
Dave Love <fx@gnu.org>
parents:
diff changeset
307 s_ptr->window_w,
Dave Love <fx@gnu.org>
parents:
diff changeset
308 s_ptr->window_h,
Dave Love <fx@gnu.org>
parents:
diff changeset
309 0, /* border width*/
Dave Love <fx@gnu.org>
parents:
diff changeset
310 CopyFromParent,
Dave Love <fx@gnu.org>
parents:
diff changeset
311 InputOnly,
Dave Love <fx@gnu.org>
parents:
diff changeset
312 CopyFromParent,
Dave Love <fx@gnu.org>
parents:
diff changeset
313 0,
Dave Love <fx@gnu.org>
parents:
diff changeset
314 attributes);
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 25858
diff changeset
315
25858
Dave Love <fx@gnu.org>
parents:
diff changeset
316 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
317 * Insert the new window id and its
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 25858
diff changeset
318 * associated XMSelect structure into the
25858
Dave Love <fx@gnu.org>
parents:
diff changeset
319 * association table.
Dave Love <fx@gnu.org>
parents:
diff changeset
320 */
Dave Love <fx@gnu.org>
parents:
diff changeset
321 XMakeAssoc(display, menu->assoc_tab, s_ptr->window, s_ptr);
Dave Love <fx@gnu.org>
parents:
diff changeset
322 XSelectInput(display, s_ptr->window, menu->s_events);
Dave Love <fx@gnu.org>
parents:
diff changeset
323 }
Dave Love <fx@gnu.org>
parents:
diff changeset
324
Dave Love <fx@gnu.org>
parents:
diff changeset
325 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
326 * Reset the selection queue pointer and size.
Dave Love <fx@gnu.org>
parents:
diff changeset
327 */
Dave Love <fx@gnu.org>
parents:
diff changeset
328 _XMWinQue.sq_size = 0;
Dave Love <fx@gnu.org>
parents:
diff changeset
329 _XMWinQue.sq_ptr = _XMWinQue.sq;
Dave Love <fx@gnu.org>
parents:
diff changeset
330 }
Dave Love <fx@gnu.org>
parents:
diff changeset
331
Dave Love <fx@gnu.org>
parents:
diff changeset
332 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
333 * Flush X's internal queues.
Dave Love <fx@gnu.org>
parents:
diff changeset
334 */
Dave Love <fx@gnu.org>
parents:
diff changeset
335 XFlush(display);
Dave Love <fx@gnu.org>
parents:
diff changeset
336
Dave Love <fx@gnu.org>
parents:
diff changeset
337 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
338 * All went well, return successfully.
Dave Love <fx@gnu.org>
parents:
diff changeset
339 */
Dave Love <fx@gnu.org>
parents:
diff changeset
340 _XMErrorCode = XME_NO_ERROR;
Dave Love <fx@gnu.org>
parents:
diff changeset
341 return(_SUCCESS);
Dave Love <fx@gnu.org>
parents:
diff changeset
342 }
Dave Love <fx@gnu.org>
parents:
diff changeset
343
Dave Love <fx@gnu.org>
parents:
diff changeset
344
Dave Love <fx@gnu.org>
parents:
diff changeset
345
Dave Love <fx@gnu.org>
parents:
diff changeset
346 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
347 * _XMGetPanePtr - Given a menu pointer and a pane index number, return
Dave Love <fx@gnu.org>
parents:
diff changeset
348 * a pane pointer that points to the indexed pane.
Dave Love <fx@gnu.org>
parents:
diff changeset
349 */
Dave Love <fx@gnu.org>
parents:
diff changeset
350 XMPane *
Dave Love <fx@gnu.org>
parents:
diff changeset
351 _XMGetPanePtr(menu, p_num)
Dave Love <fx@gnu.org>
parents:
diff changeset
352 register XMenu *menu; /* Menu to find the pane in. */
Dave Love <fx@gnu.org>
parents:
diff changeset
353 register int p_num; /* Index number of pane to find. */
Dave Love <fx@gnu.org>
parents:
diff changeset
354 {
Dave Love <fx@gnu.org>
parents:
diff changeset
355 register XMPane *p_ptr; /* Pane pointer to be returned. */
Dave Love <fx@gnu.org>
parents:
diff changeset
356 register int i; /* Loop counter. */
Dave Love <fx@gnu.org>
parents:
diff changeset
357
Dave Love <fx@gnu.org>
parents:
diff changeset
358 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
359 * Is the pane number out of range?
Dave Love <fx@gnu.org>
parents:
diff changeset
360 */
Dave Love <fx@gnu.org>
parents:
diff changeset
361 if ((p_num < 0) || (p_num > (menu->p_count - 1))) {
Dave Love <fx@gnu.org>
parents:
diff changeset
362 _XMErrorCode = XME_P_NOT_FOUND;
Dave Love <fx@gnu.org>
parents:
diff changeset
363 return(NULL);
Dave Love <fx@gnu.org>
parents:
diff changeset
364 }
Dave Love <fx@gnu.org>
parents:
diff changeset
365
Dave Love <fx@gnu.org>
parents:
diff changeset
366 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
367 * Find the right pane.
Dave Love <fx@gnu.org>
parents:
diff changeset
368 */
Dave Love <fx@gnu.org>
parents:
diff changeset
369 p_ptr = menu->p_list->next;
Dave Love <fx@gnu.org>
parents:
diff changeset
370 for (i = 0; i < p_num; i++) p_ptr = p_ptr->next;
Dave Love <fx@gnu.org>
parents:
diff changeset
371
Dave Love <fx@gnu.org>
parents:
diff changeset
372 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
373 * Return successfully.
Dave Love <fx@gnu.org>
parents:
diff changeset
374 */
Dave Love <fx@gnu.org>
parents:
diff changeset
375 _XMErrorCode = XME_NO_ERROR;
Dave Love <fx@gnu.org>
parents:
diff changeset
376 return(p_ptr);
Dave Love <fx@gnu.org>
parents:
diff changeset
377 }
Dave Love <fx@gnu.org>
parents:
diff changeset
378
Dave Love <fx@gnu.org>
parents:
diff changeset
379
Dave Love <fx@gnu.org>
parents:
diff changeset
380
Dave Love <fx@gnu.org>
parents:
diff changeset
381 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
382 * _XMGetSelectionPtr - Given pane pointer and a selection index number,
Dave Love <fx@gnu.org>
parents:
diff changeset
383 * return a selection pointer that points to the
Dave Love <fx@gnu.org>
parents:
diff changeset
384 * indexed selection.
Dave Love <fx@gnu.org>
parents:
diff changeset
385 */
Dave Love <fx@gnu.org>
parents:
diff changeset
386 XMSelect *
Dave Love <fx@gnu.org>
parents:
diff changeset
387 _XMGetSelectionPtr(p_ptr, s_num)
Dave Love <fx@gnu.org>
parents:
diff changeset
388 register XMPane *p_ptr; /* Pane to find the selection in. */
Dave Love <fx@gnu.org>
parents:
diff changeset
389 register int s_num; /* Index number of the selection to find. */
Dave Love <fx@gnu.org>
parents:
diff changeset
390 {
Dave Love <fx@gnu.org>
parents:
diff changeset
391 register XMSelect *s_ptr; /* Selection pointer to be returned. */
Dave Love <fx@gnu.org>
parents:
diff changeset
392 register int i; /* Loop counter. */
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 25858
diff changeset
393
25858
Dave Love <fx@gnu.org>
parents:
diff changeset
394 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
395 * Is the selection number out of range?
Dave Love <fx@gnu.org>
parents:
diff changeset
396 */
Dave Love <fx@gnu.org>
parents:
diff changeset
397 if ((s_num < 0) || (s_num > (p_ptr->s_count - 1))) {
Dave Love <fx@gnu.org>
parents:
diff changeset
398 _XMErrorCode = XME_S_NOT_FOUND;
Dave Love <fx@gnu.org>
parents:
diff changeset
399 return(NULL);
Dave Love <fx@gnu.org>
parents:
diff changeset
400 }
Dave Love <fx@gnu.org>
parents:
diff changeset
401
Dave Love <fx@gnu.org>
parents:
diff changeset
402 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
403 * Find the right selection.
Dave Love <fx@gnu.org>
parents:
diff changeset
404 */
Dave Love <fx@gnu.org>
parents:
diff changeset
405 s_ptr = p_ptr->s_list->next;
Dave Love <fx@gnu.org>
parents:
diff changeset
406 for (i = 0; i < s_num; i++) s_ptr = s_ptr->next;
Dave Love <fx@gnu.org>
parents:
diff changeset
407
Dave Love <fx@gnu.org>
parents:
diff changeset
408 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
409 * Return successfully.
Dave Love <fx@gnu.org>
parents:
diff changeset
410 */
Dave Love <fx@gnu.org>
parents:
diff changeset
411 _XMErrorCode = XME_NO_ERROR;
Dave Love <fx@gnu.org>
parents:
diff changeset
412 return(s_ptr);
Dave Love <fx@gnu.org>
parents:
diff changeset
413 }
Dave Love <fx@gnu.org>
parents:
diff changeset
414
Dave Love <fx@gnu.org>
parents:
diff changeset
415
Dave Love <fx@gnu.org>
parents:
diff changeset
416
Dave Love <fx@gnu.org>
parents:
diff changeset
417 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
418 * _XMRecomputeGlobals - Internal subroutine to recompute menu wide
Dave Love <fx@gnu.org>
parents:
diff changeset
419 * global values.
Dave Love <fx@gnu.org>
parents:
diff changeset
420 */
Dave Love <fx@gnu.org>
parents:
diff changeset
421 _XMRecomputeGlobals(display, menu)
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 25858
diff changeset
422 register Display *display; /*X11 display variable. */
25858
Dave Love <fx@gnu.org>
parents:
diff changeset
423 register XMenu *menu; /* Menu object to compute from. */
Dave Love <fx@gnu.org>
parents:
diff changeset
424 {
Dave Love <fx@gnu.org>
parents:
diff changeset
425 register XMPane *p_ptr; /* Pane pointer. */
Dave Love <fx@gnu.org>
parents:
diff changeset
426 register XMSelect *s_ptr; /* Selection pointer. */
Dave Love <fx@gnu.org>
parents:
diff changeset
427
Dave Love <fx@gnu.org>
parents:
diff changeset
428 register int max_p_label = 0; /* Maximum pane label width. */
Dave Love <fx@gnu.org>
parents:
diff changeset
429 register int max_s_label = 0; /* Maximum selection label width. */
Dave Love <fx@gnu.org>
parents:
diff changeset
430 register int s_count = 0; /* Maximum selection count. */
Dave Love <fx@gnu.org>
parents:
diff changeset
431
Dave Love <fx@gnu.org>
parents:
diff changeset
432 int p_s_pad; /* Pane <-> selection padding. */
Dave Love <fx@gnu.org>
parents:
diff changeset
433 int p_s_diff; /* Pane <-> selection separation. */
Dave Love <fx@gnu.org>
parents:
diff changeset
434
Dave Love <fx@gnu.org>
parents:
diff changeset
435 int p_height; /* Pane window height. */
Dave Love <fx@gnu.org>
parents:
diff changeset
436 int p_width; /* Pane window width. */
Dave Love <fx@gnu.org>
parents:
diff changeset
437 int s_width; /* Selection window width. */
Dave Love <fx@gnu.org>
parents:
diff changeset
438
Dave Love <fx@gnu.org>
parents:
diff changeset
439 int screen; /* DefaultScreen holder. */
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 25858
diff changeset
440
25858
Dave Love <fx@gnu.org>
parents:
diff changeset
441 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
442 * For each pane...
Dave Love <fx@gnu.org>
parents:
diff changeset
443 */
Dave Love <fx@gnu.org>
parents:
diff changeset
444 for (
Dave Love <fx@gnu.org>
parents:
diff changeset
445 p_ptr = menu->p_list->next;
Dave Love <fx@gnu.org>
parents:
diff changeset
446 p_ptr != menu->p_list;
Dave Love <fx@gnu.org>
parents:
diff changeset
447 p_ptr = p_ptr->next
Dave Love <fx@gnu.org>
parents:
diff changeset
448 ){
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 25858
diff changeset
449
25858
Dave Love <fx@gnu.org>
parents:
diff changeset
450 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
451 * Recompute maximum pane label width.
Dave Love <fx@gnu.org>
parents:
diff changeset
452 */
Dave Love <fx@gnu.org>
parents:
diff changeset
453 max_p_label = max(max_p_label, p_ptr->label_width);
Dave Love <fx@gnu.org>
parents:
diff changeset
454
Dave Love <fx@gnu.org>
parents:
diff changeset
455 /*
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 25858
diff changeset
456 * Recompute maximum selection count.
25858
Dave Love <fx@gnu.org>
parents:
diff changeset
457 */
Dave Love <fx@gnu.org>
parents:
diff changeset
458 s_count = max(s_count, p_ptr->s_count);
Dave Love <fx@gnu.org>
parents:
diff changeset
459
Dave Love <fx@gnu.org>
parents:
diff changeset
460 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
461 * For each selection in the current pane...
Dave Love <fx@gnu.org>
parents:
diff changeset
462 */
Dave Love <fx@gnu.org>
parents:
diff changeset
463 for (
Dave Love <fx@gnu.org>
parents:
diff changeset
464 s_ptr = p_ptr->s_list->next;
Dave Love <fx@gnu.org>
parents:
diff changeset
465 s_ptr != p_ptr->s_list;
Dave Love <fx@gnu.org>
parents:
diff changeset
466 s_ptr = s_ptr->next
Dave Love <fx@gnu.org>
parents:
diff changeset
467 ){
Dave Love <fx@gnu.org>
parents:
diff changeset
468
Dave Love <fx@gnu.org>
parents:
diff changeset
469 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
470 * Recompute maximum selection label width.
Dave Love <fx@gnu.org>
parents:
diff changeset
471 */
Dave Love <fx@gnu.org>
parents:
diff changeset
472 max_s_label = max(max_s_label, s_ptr->label_width);
Dave Love <fx@gnu.org>
parents:
diff changeset
473 }
Dave Love <fx@gnu.org>
parents:
diff changeset
474 }
Dave Love <fx@gnu.org>
parents:
diff changeset
475
Dave Love <fx@gnu.org>
parents:
diff changeset
476 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
477 * Recompute pane height.
Dave Love <fx@gnu.org>
parents:
diff changeset
478 */
Dave Love <fx@gnu.org>
parents:
diff changeset
479 p_height = (menu->flag_height << 1) + (menu->s_y_off * s_count);
Dave Love <fx@gnu.org>
parents:
diff changeset
480
Dave Love <fx@gnu.org>
parents:
diff changeset
481 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
482 * Recompute horizontal padding between the pane window and the
Dave Love <fx@gnu.org>
parents:
diff changeset
483 * selection windows.
Dave Love <fx@gnu.org>
parents:
diff changeset
484 */
Dave Love <fx@gnu.org>
parents:
diff changeset
485 p_s_pad = menu->p_x_off << 1;
Dave Love <fx@gnu.org>
parents:
diff changeset
486
Dave Love <fx@gnu.org>
parents:
diff changeset
487 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
488 * Recompute pane and selection window widths.
Dave Love <fx@gnu.org>
parents:
diff changeset
489 * This is done by first computing the window sizes from the maximum
Dave Love <fx@gnu.org>
parents:
diff changeset
490 * label widths. If the spacing between the selection window and the
Dave Love <fx@gnu.org>
parents:
diff changeset
491 * containing pane window is less than the pane selection padding value
Dave Love <fx@gnu.org>
parents:
diff changeset
492 * (twice the pane X offset) then change the size of the pane to be
Dave Love <fx@gnu.org>
parents:
diff changeset
493 * the size of the selection window plus the padding. If, however the
Dave Love <fx@gnu.org>
parents:
diff changeset
494 * spacing between the selection window and the containing pane window
Dave Love <fx@gnu.org>
parents:
diff changeset
495 * is more than the pane selection padding value increase the size of
Dave Love <fx@gnu.org>
parents:
diff changeset
496 * the selection to its maximum possible value (the pane width minus
Dave Love <fx@gnu.org>
parents:
diff changeset
497 * the pane selection padding value).
Dave Love <fx@gnu.org>
parents:
diff changeset
498 */
Dave Love <fx@gnu.org>
parents:
diff changeset
499 p_width = max_p_label + p_s_pad;
Dave Love <fx@gnu.org>
parents:
diff changeset
500 s_width = max_s_label + (menu->s_fnt_pad << 1) + (menu->s_bdr_width << 1);
Dave Love <fx@gnu.org>
parents:
diff changeset
501 p_s_diff = p_width - s_width;
Dave Love <fx@gnu.org>
parents:
diff changeset
502 if (p_s_diff < p_s_pad) {
Dave Love <fx@gnu.org>
parents:
diff changeset
503 p_width = s_width + p_s_pad;
Dave Love <fx@gnu.org>
parents:
diff changeset
504 }
Dave Love <fx@gnu.org>
parents:
diff changeset
505 else if (p_s_diff > p_s_pad) {
Dave Love <fx@gnu.org>
parents:
diff changeset
506 s_width = p_width - p_s_pad;
Dave Love <fx@gnu.org>
parents:
diff changeset
507 }
Dave Love <fx@gnu.org>
parents:
diff changeset
508
Dave Love <fx@gnu.org>
parents:
diff changeset
509 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
510 * Reset menu wide global values.
Dave Love <fx@gnu.org>
parents:
diff changeset
511 */
Dave Love <fx@gnu.org>
parents:
diff changeset
512 menu->s_count = s_count;
Dave Love <fx@gnu.org>
parents:
diff changeset
513 menu->p_height = p_height;
Dave Love <fx@gnu.org>
parents:
diff changeset
514 menu->p_width = p_width;
Dave Love <fx@gnu.org>
parents:
diff changeset
515 menu->s_width = s_width;
Dave Love <fx@gnu.org>
parents:
diff changeset
516
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 25858
diff changeset
517 /*
25858
Dave Love <fx@gnu.org>
parents:
diff changeset
518 * Ensure that the origin of the menu is placed so that
Dave Love <fx@gnu.org>
parents:
diff changeset
519 * None of the panes ore selections are off the screen.
Dave Love <fx@gnu.org>
parents:
diff changeset
520 */
Dave Love <fx@gnu.org>
parents:
diff changeset
521 screen = DefaultScreen(display);
Dave Love <fx@gnu.org>
parents:
diff changeset
522 if (menu->x_pos + menu->width > DisplayWidth(display, screen))
Dave Love <fx@gnu.org>
parents:
diff changeset
523 menu->x_pos = DisplayWidth(display, screen) - menu->width;
Dave Love <fx@gnu.org>
parents:
diff changeset
524 else if (menu->x_pos < 0) menu->x_pos = 0;
Dave Love <fx@gnu.org>
parents:
diff changeset
525 if(menu->y_pos + menu->height > DisplayHeight(display, screen))
Dave Love <fx@gnu.org>
parents:
diff changeset
526 menu->y_pos = DisplayHeight(display, screen) - menu->height;
Dave Love <fx@gnu.org>
parents:
diff changeset
527 else if (menu->y_pos < 0) menu->y_pos = 0;
Dave Love <fx@gnu.org>
parents:
diff changeset
528 }
Dave Love <fx@gnu.org>
parents:
diff changeset
529
Dave Love <fx@gnu.org>
parents:
diff changeset
530
Dave Love <fx@gnu.org>
parents:
diff changeset
531 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
532 * _XMRecomputePane - Internal subroutine to recompute pane
Dave Love <fx@gnu.org>
parents:
diff changeset
533 * window dependencies.
Dave Love <fx@gnu.org>
parents:
diff changeset
534 */
Dave Love <fx@gnu.org>
parents:
diff changeset
535 int
Dave Love <fx@gnu.org>
parents:
diff changeset
536 _XMRecomputePane(display, menu, p_ptr, p_num)
Dave Love <fx@gnu.org>
parents:
diff changeset
537 register Display *display; /* Standard X display variable. */
Dave Love <fx@gnu.org>
parents:
diff changeset
538 register XMenu *menu; /* Menu object being recomputed. */
Dave Love <fx@gnu.org>
parents:
diff changeset
539 register XMPane *p_ptr; /* Pane pointer. */
Dave Love <fx@gnu.org>
parents:
diff changeset
540 register int p_num; /* Pane sequence number. */
Dave Love <fx@gnu.org>
parents:
diff changeset
541 {
Dave Love <fx@gnu.org>
parents:
diff changeset
542 register int window_x; /* Recomputed window X coordinate. */
Dave Love <fx@gnu.org>
parents:
diff changeset
543 register int window_y; /* Recomputed window Y coordinate. */
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 25858
diff changeset
544
25858
Dave Love <fx@gnu.org>
parents:
diff changeset
545 unsigned long change_mask; /* Value mask to reconfigure window. */
Dave Love <fx@gnu.org>
parents:
diff changeset
546 XWindowChanges *changes; /* Values to use in configure window. */
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 25858
diff changeset
547
25858
Dave Love <fx@gnu.org>
parents:
diff changeset
548 register Bool config_p = False; /* Reconfigure pane window? */
Dave Love <fx@gnu.org>
parents:
diff changeset
549
Dave Love <fx@gnu.org>
parents:
diff changeset
550 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
551 * Update the pane serial number.
Dave Love <fx@gnu.org>
parents:
diff changeset
552 */
Dave Love <fx@gnu.org>
parents:
diff changeset
553 p_ptr->serial = p_num;
Dave Love <fx@gnu.org>
parents:
diff changeset
554
Dave Love <fx@gnu.org>
parents:
diff changeset
555 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
556 * Recompute window X and Y coordinates.
Dave Love <fx@gnu.org>
parents:
diff changeset
557 */
Dave Love <fx@gnu.org>
parents:
diff changeset
558 switch (menu->menu_style) {
Dave Love <fx@gnu.org>
parents:
diff changeset
559 case LEFT:
Dave Love <fx@gnu.org>
parents:
diff changeset
560 window_x = menu->p_x_off * ((menu->p_count - 1) - p_num);
Dave Love <fx@gnu.org>
parents:
diff changeset
561 window_y = menu->p_y_off * ((menu->p_count - 1) - p_num);
Dave Love <fx@gnu.org>
parents:
diff changeset
562 break;
Dave Love <fx@gnu.org>
parents:
diff changeset
563 case RIGHT:
Dave Love <fx@gnu.org>
parents:
diff changeset
564 window_x = menu->p_x_off * p_num;
Dave Love <fx@gnu.org>
parents:
diff changeset
565 window_y = menu->p_y_off * ((menu->p_count - 1) - p_num);
Dave Love <fx@gnu.org>
parents:
diff changeset
566 break;
Dave Love <fx@gnu.org>
parents:
diff changeset
567 case CENTER:
Dave Love <fx@gnu.org>
parents:
diff changeset
568 window_x = 0;
Dave Love <fx@gnu.org>
parents:
diff changeset
569 window_y = menu->p_y_off * ((menu->p_count - 1) - p_num);
Dave Love <fx@gnu.org>
parents:
diff changeset
570 break;
Dave Love <fx@gnu.org>
parents:
diff changeset
571 default:
Dave Love <fx@gnu.org>
parents:
diff changeset
572 /* Error! Invalid style parameter. */
Dave Love <fx@gnu.org>
parents:
diff changeset
573 _XMErrorCode = XME_STYLE_PARAM;
Dave Love <fx@gnu.org>
parents:
diff changeset
574 return(_FAILURE);
Dave Love <fx@gnu.org>
parents:
diff changeset
575 }
Dave Love <fx@gnu.org>
parents:
diff changeset
576 window_x += menu->x_pos;
Dave Love <fx@gnu.org>
parents:
diff changeset
577 window_y += menu->y_pos;
Dave Love <fx@gnu.org>
parents:
diff changeset
578
Dave Love <fx@gnu.org>
parents:
diff changeset
579 /*
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 25858
diff changeset
580 * If the newly compute pane coordinates differ from the
25858
Dave Love <fx@gnu.org>
parents:
diff changeset
581 * current coordinates, reset the current coordinates and
Dave Love <fx@gnu.org>
parents:
diff changeset
582 * reconfigure the pane.
Dave Love <fx@gnu.org>
parents:
diff changeset
583 */
Dave Love <fx@gnu.org>
parents:
diff changeset
584 if (
Dave Love <fx@gnu.org>
parents:
diff changeset
585 (window_x != p_ptr->window_x) ||
Dave Love <fx@gnu.org>
parents:
diff changeset
586 (window_y != p_ptr->window_y)
Dave Love <fx@gnu.org>
parents:
diff changeset
587 ){
Dave Love <fx@gnu.org>
parents:
diff changeset
588 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
589 * Reset the coordinates and schedule
Dave Love <fx@gnu.org>
parents:
diff changeset
590 * the pane for reconfiguration.
Dave Love <fx@gnu.org>
parents:
diff changeset
591 */
Dave Love <fx@gnu.org>
parents:
diff changeset
592 p_ptr->window_x = window_x;
Dave Love <fx@gnu.org>
parents:
diff changeset
593 p_ptr->window_y = window_y;
Dave Love <fx@gnu.org>
parents:
diff changeset
594 config_p = True;
Dave Love <fx@gnu.org>
parents:
diff changeset
595 }
Dave Love <fx@gnu.org>
parents:
diff changeset
596
Dave Love <fx@gnu.org>
parents:
diff changeset
597 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
598 * If the local pane width and height differs from the
Dave Love <fx@gnu.org>
parents:
diff changeset
599 * menu pane width and height, reset the local values.
Dave Love <fx@gnu.org>
parents:
diff changeset
600 */
Dave Love <fx@gnu.org>
parents:
diff changeset
601 if (
Dave Love <fx@gnu.org>
parents:
diff changeset
602 (p_ptr->window_w != menu->p_width) ||
Dave Love <fx@gnu.org>
parents:
diff changeset
603 (p_ptr->window_h != menu->p_height)
Dave Love <fx@gnu.org>
parents:
diff changeset
604 ){
Dave Love <fx@gnu.org>
parents:
diff changeset
605 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
606 * Reset window width and height and schedule
Dave Love <fx@gnu.org>
parents:
diff changeset
607 * the pane for reconfiguration.
Dave Love <fx@gnu.org>
parents:
diff changeset
608 */
Dave Love <fx@gnu.org>
parents:
diff changeset
609 p_ptr->window_w = menu->p_width;
Dave Love <fx@gnu.org>
parents:
diff changeset
610 p_ptr->window_h = menu->p_height;
Dave Love <fx@gnu.org>
parents:
diff changeset
611 config_p = True;
Dave Love <fx@gnu.org>
parents:
diff changeset
612 }
Dave Love <fx@gnu.org>
parents:
diff changeset
613
Dave Love <fx@gnu.org>
parents:
diff changeset
614 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
615 * If we need to reconfigure the pane window do it now.
Dave Love <fx@gnu.org>
parents:
diff changeset
616 */
Dave Love <fx@gnu.org>
parents:
diff changeset
617 if (config_p == True) {
Dave Love <fx@gnu.org>
parents:
diff changeset
618 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
619 * If the pane window has already been created then
Dave Love <fx@gnu.org>
parents:
diff changeset
620 * reconfigure the existing window, otherwise queue
Dave Love <fx@gnu.org>
parents:
diff changeset
621 * it for creation with the new configuration.
Dave Love <fx@gnu.org>
parents:
diff changeset
622 */
Dave Love <fx@gnu.org>
parents:
diff changeset
623 if (p_ptr->window) {
Dave Love <fx@gnu.org>
parents:
diff changeset
624 change_mask = (CWX | CWY | CWWidth | CWHeight);
Dave Love <fx@gnu.org>
parents:
diff changeset
625 changes = (XWindowChanges *)malloc(sizeof(XWindowChanges));
Dave Love <fx@gnu.org>
parents:
diff changeset
626 changes->x = p_ptr->window_x;
Dave Love <fx@gnu.org>
parents:
diff changeset
627 changes->y = p_ptr->window_y;
Dave Love <fx@gnu.org>
parents:
diff changeset
628 changes->width = p_ptr->window_w;
Dave Love <fx@gnu.org>
parents:
diff changeset
629 changes->height = p_ptr->window_h;
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 25858
diff changeset
630
25858
Dave Love <fx@gnu.org>
parents:
diff changeset
631 XConfigureWindow(
Dave Love <fx@gnu.org>
parents:
diff changeset
632 display,
Dave Love <fx@gnu.org>
parents:
diff changeset
633 p_ptr->window,
Dave Love <fx@gnu.org>
parents:
diff changeset
634 change_mask,
Dave Love <fx@gnu.org>
parents:
diff changeset
635 changes
Dave Love <fx@gnu.org>
parents:
diff changeset
636 );
Dave Love <fx@gnu.org>
parents:
diff changeset
637 free(changes);
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 25858
diff changeset
638
25858
Dave Love <fx@gnu.org>
parents:
diff changeset
639 }
Dave Love <fx@gnu.org>
parents:
diff changeset
640 else {
Dave Love <fx@gnu.org>
parents:
diff changeset
641 if (_XMWinQueAddPane(display, menu, p_ptr) == _FAILURE) {
Dave Love <fx@gnu.org>
parents:
diff changeset
642 return(_FAILURE);
Dave Love <fx@gnu.org>
parents:
diff changeset
643 }
Dave Love <fx@gnu.org>
parents:
diff changeset
644 }
Dave Love <fx@gnu.org>
parents:
diff changeset
645 }
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 25858
diff changeset
646
25858
Dave Love <fx@gnu.org>
parents:
diff changeset
647 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
648 * Recompute label X position.
Dave Love <fx@gnu.org>
parents:
diff changeset
649 */
Dave Love <fx@gnu.org>
parents:
diff changeset
650 switch (menu->p_style) {
Dave Love <fx@gnu.org>
parents:
diff changeset
651 case LEFT:
Dave Love <fx@gnu.org>
parents:
diff changeset
652 p_ptr->label_x = menu->p_x_off + menu->p_fnt_pad;
Dave Love <fx@gnu.org>
parents:
diff changeset
653 break;
Dave Love <fx@gnu.org>
parents:
diff changeset
654 case RIGHT:
Dave Love <fx@gnu.org>
parents:
diff changeset
655 p_ptr->label_x = menu->p_width -
Dave Love <fx@gnu.org>
parents:
diff changeset
656 (p_ptr->label_width + menu->p_x_off + menu->p_fnt_pad);
Dave Love <fx@gnu.org>
parents:
diff changeset
657 break;
Dave Love <fx@gnu.org>
parents:
diff changeset
658 case CENTER:
Dave Love <fx@gnu.org>
parents:
diff changeset
659 p_ptr->label_x = (menu->p_width - p_ptr->label_width) >> 1;
Dave Love <fx@gnu.org>
parents:
diff changeset
660 break;
Dave Love <fx@gnu.org>
parents:
diff changeset
661 default:
Dave Love <fx@gnu.org>
parents:
diff changeset
662 /* Error! Invalid style parameter. */
Dave Love <fx@gnu.org>
parents:
diff changeset
663 _XMErrorCode = XME_STYLE_PARAM;
Dave Love <fx@gnu.org>
parents:
diff changeset
664 return(_FAILURE);
Dave Love <fx@gnu.org>
parents:
diff changeset
665 }
Dave Love <fx@gnu.org>
parents:
diff changeset
666 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
667 * Recompute label Y positions.
Dave Love <fx@gnu.org>
parents:
diff changeset
668 */
Dave Love <fx@gnu.org>
parents:
diff changeset
669 p_ptr->label_uy = menu->p_fnt_pad + menu->p_fnt_info->max_bounds.ascent;
Dave Love <fx@gnu.org>
parents:
diff changeset
670 p_ptr->label_ly = (menu->p_height - menu->p_fnt_pad - menu->p_fnt_info->max_bounds.descent);
Dave Love <fx@gnu.org>
parents:
diff changeset
671
Dave Love <fx@gnu.org>
parents:
diff changeset
672 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
673 * All went well, return successfully.
Dave Love <fx@gnu.org>
parents:
diff changeset
674 */
Dave Love <fx@gnu.org>
parents:
diff changeset
675 _XMErrorCode = XME_NO_ERROR;
Dave Love <fx@gnu.org>
parents:
diff changeset
676 return(_SUCCESS);
Dave Love <fx@gnu.org>
parents:
diff changeset
677 }
Dave Love <fx@gnu.org>
parents:
diff changeset
678
Dave Love <fx@gnu.org>
parents:
diff changeset
679
Dave Love <fx@gnu.org>
parents:
diff changeset
680
Dave Love <fx@gnu.org>
parents:
diff changeset
681 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
682 * _XMRecomputeSelection - Internal subroutine to recompute
Dave Love <fx@gnu.org>
parents:
diff changeset
683 * selection window dependencies.
Dave Love <fx@gnu.org>
parents:
diff changeset
684 */
Dave Love <fx@gnu.org>
parents:
diff changeset
685 int
Dave Love <fx@gnu.org>
parents:
diff changeset
686 _XMRecomputeSelection(display, menu, s_ptr, s_num)
Dave Love <fx@gnu.org>
parents:
diff changeset
687 register Display *display;
Dave Love <fx@gnu.org>
parents:
diff changeset
688 register XMenu *menu; /* Menu object being recomputed. */
Dave Love <fx@gnu.org>
parents:
diff changeset
689 register XMSelect *s_ptr; /* Selection pointer. */
Dave Love <fx@gnu.org>
parents:
diff changeset
690 register int s_num; /* Selection sequence number. */
Dave Love <fx@gnu.org>
parents:
diff changeset
691 {
Dave Love <fx@gnu.org>
parents:
diff changeset
692 register Bool config_s = False; /* Reconfigure selection window? */
Dave Love <fx@gnu.org>
parents:
diff changeset
693 XWindowChanges *changes; /* Values to change in configure. */
Dave Love <fx@gnu.org>
parents:
diff changeset
694 unsigned long change_mask; /* Value mask for XConfigureWindow. */
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 25858
diff changeset
695
25858
Dave Love <fx@gnu.org>
parents:
diff changeset
696 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
697 * If the selection serial numbers are out of order, begin
Dave Love <fx@gnu.org>
parents:
diff changeset
698 * resequencing selections. Recompute selection window coordinates
Dave Love <fx@gnu.org>
parents:
diff changeset
699 * and serial number.
Dave Love <fx@gnu.org>
parents:
diff changeset
700 *
Dave Love <fx@gnu.org>
parents:
diff changeset
701 * When selections are created they are given a serial number of
Dave Love <fx@gnu.org>
parents:
diff changeset
702 * -1, this causes this routine to give a new selection
Dave Love <fx@gnu.org>
parents:
diff changeset
703 * its initial coordinates and serial number.
Dave Love <fx@gnu.org>
parents:
diff changeset
704 */
Dave Love <fx@gnu.org>
parents:
diff changeset
705 if (s_ptr->serial != s_num) {
Dave Love <fx@gnu.org>
parents:
diff changeset
706 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
707 * Fix the sequence number.
Dave Love <fx@gnu.org>
parents:
diff changeset
708 */
Dave Love <fx@gnu.org>
parents:
diff changeset
709 s_ptr->serial = s_num;
Dave Love <fx@gnu.org>
parents:
diff changeset
710 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
711 * Recompute window X and Y coordinates.
Dave Love <fx@gnu.org>
parents:
diff changeset
712 */
Dave Love <fx@gnu.org>
parents:
diff changeset
713 s_ptr->window_x = menu->s_x_off;
Dave Love <fx@gnu.org>
parents:
diff changeset
714 s_ptr->window_y = menu->flag_height + (menu->s_y_off * s_num);
Dave Love <fx@gnu.org>
parents:
diff changeset
715 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
716 * We must reconfigure the window.
Dave Love <fx@gnu.org>
parents:
diff changeset
717 */
Dave Love <fx@gnu.org>
parents:
diff changeset
718 config_s = True;
Dave Love <fx@gnu.org>
parents:
diff changeset
719 }
Dave Love <fx@gnu.org>
parents:
diff changeset
720
Dave Love <fx@gnu.org>
parents:
diff changeset
721 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
722 * If the local selection width and height differs from the
Dave Love <fx@gnu.org>
parents:
diff changeset
723 * menu selection width and height, reset the local values.
Dave Love <fx@gnu.org>
parents:
diff changeset
724 */
Dave Love <fx@gnu.org>
parents:
diff changeset
725 if (
Dave Love <fx@gnu.org>
parents:
diff changeset
726 (s_ptr->window_w != menu->s_width) ||
Dave Love <fx@gnu.org>
parents:
diff changeset
727 (s_ptr->window_h != menu->s_height)
Dave Love <fx@gnu.org>
parents:
diff changeset
728 ){
Dave Love <fx@gnu.org>
parents:
diff changeset
729 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
730 * We must reconfigure the window.
Dave Love <fx@gnu.org>
parents:
diff changeset
731 */
Dave Love <fx@gnu.org>
parents:
diff changeset
732 config_s = True;
Dave Love <fx@gnu.org>
parents:
diff changeset
733 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
734 * Reset window width and height.
Dave Love <fx@gnu.org>
parents:
diff changeset
735 */
Dave Love <fx@gnu.org>
parents:
diff changeset
736 s_ptr->window_w = menu->s_width;
Dave Love <fx@gnu.org>
parents:
diff changeset
737 s_ptr->window_h = menu->s_height;
Dave Love <fx@gnu.org>
parents:
diff changeset
738 }
Dave Love <fx@gnu.org>
parents:
diff changeset
739
Dave Love <fx@gnu.org>
parents:
diff changeset
740 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
741 * If we need to reconfigure the selection window do it now.
Dave Love <fx@gnu.org>
parents:
diff changeset
742 */
Dave Love <fx@gnu.org>
parents:
diff changeset
743 if (config_s == True) {
Dave Love <fx@gnu.org>
parents:
diff changeset
744 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
745 * If the selection window has already been created then
Dave Love <fx@gnu.org>
parents:
diff changeset
746 * reconfigure the existing window, otherwise queue it
Dave Love <fx@gnu.org>
parents:
diff changeset
747 * for creation with the new configuration.
Dave Love <fx@gnu.org>
parents:
diff changeset
748 */
Dave Love <fx@gnu.org>
parents:
diff changeset
749 if (s_ptr->window) {
Dave Love <fx@gnu.org>
parents:
diff changeset
750 changes = (XWindowChanges *)malloc(sizeof(XWindowChanges));
Dave Love <fx@gnu.org>
parents:
diff changeset
751 change_mask = (CWX | CWY | CWWidth | CWHeight);
Dave Love <fx@gnu.org>
parents:
diff changeset
752 changes = (XWindowChanges *)malloc(sizeof(XWindowChanges));
Dave Love <fx@gnu.org>
parents:
diff changeset
753 changes->x = s_ptr->window_x;
Dave Love <fx@gnu.org>
parents:
diff changeset
754 changes->y = s_ptr->window_y;
Dave Love <fx@gnu.org>
parents:
diff changeset
755 changes->width = s_ptr->window_w;
Dave Love <fx@gnu.org>
parents:
diff changeset
756 changes->height = s_ptr->window_h;
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 25858
diff changeset
757
25858
Dave Love <fx@gnu.org>
parents:
diff changeset
758 XConfigureWindow(
Dave Love <fx@gnu.org>
parents:
diff changeset
759 display,
Dave Love <fx@gnu.org>
parents:
diff changeset
760 s_ptr->window,
Dave Love <fx@gnu.org>
parents:
diff changeset
761 change_mask,
Dave Love <fx@gnu.org>
parents:
diff changeset
762 changes
Dave Love <fx@gnu.org>
parents:
diff changeset
763 );
Dave Love <fx@gnu.org>
parents:
diff changeset
764 free(changes);
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 25858
diff changeset
765
25858
Dave Love <fx@gnu.org>
parents:
diff changeset
766 }
Dave Love <fx@gnu.org>
parents:
diff changeset
767 else {
Dave Love <fx@gnu.org>
parents:
diff changeset
768 if (_XMWinQueAddSelection(display, menu, s_ptr) == _FAILURE) {
Dave Love <fx@gnu.org>
parents:
diff changeset
769 return(_FAILURE);
Dave Love <fx@gnu.org>
parents:
diff changeset
770 }
Dave Love <fx@gnu.org>
parents:
diff changeset
771 }
Dave Love <fx@gnu.org>
parents:
diff changeset
772 }
Dave Love <fx@gnu.org>
parents:
diff changeset
773
Dave Love <fx@gnu.org>
parents:
diff changeset
774 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
775 * Recompute label X position.
Dave Love <fx@gnu.org>
parents:
diff changeset
776 */
Dave Love <fx@gnu.org>
parents:
diff changeset
777 switch (menu->s_style) {
Dave Love <fx@gnu.org>
parents:
diff changeset
778 case LEFT:
Dave Love <fx@gnu.org>
parents:
diff changeset
779 s_ptr->label_x = menu->s_bdr_width + menu->s_fnt_pad + s_ptr->window_x;
Dave Love <fx@gnu.org>
parents:
diff changeset
780 break;
Dave Love <fx@gnu.org>
parents:
diff changeset
781 case RIGHT:
Dave Love <fx@gnu.org>
parents:
diff changeset
782 s_ptr->label_x = s_ptr->window_x + menu->s_width -
Dave Love <fx@gnu.org>
parents:
diff changeset
783 (s_ptr->label_width + menu->s_bdr_width + menu->s_fnt_pad);
Dave Love <fx@gnu.org>
parents:
diff changeset
784 break;
Dave Love <fx@gnu.org>
parents:
diff changeset
785 case CENTER:
Dave Love <fx@gnu.org>
parents:
diff changeset
786 s_ptr->label_x = s_ptr->window_x + ((menu->s_width - s_ptr->label_width) >> 1);
Dave Love <fx@gnu.org>
parents:
diff changeset
787 break;
Dave Love <fx@gnu.org>
parents:
diff changeset
788 default:
Dave Love <fx@gnu.org>
parents:
diff changeset
789 /* Error! Invalid style parameter. */
Dave Love <fx@gnu.org>
parents:
diff changeset
790 _XMErrorCode = XME_STYLE_PARAM;
Dave Love <fx@gnu.org>
parents:
diff changeset
791 return(_FAILURE);
Dave Love <fx@gnu.org>
parents:
diff changeset
792 }
Dave Love <fx@gnu.org>
parents:
diff changeset
793 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
794 * Recompute label Y position.
Dave Love <fx@gnu.org>
parents:
diff changeset
795 */
Dave Love <fx@gnu.org>
parents:
diff changeset
796 s_ptr->label_y = s_ptr->window_y + menu->s_fnt_info->max_bounds.ascent + menu->s_fnt_pad + menu->s_bdr_width;
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 25858
diff changeset
797
25858
Dave Love <fx@gnu.org>
parents:
diff changeset
798 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
799 * All went well, return successfully.
Dave Love <fx@gnu.org>
parents:
diff changeset
800 */
Dave Love <fx@gnu.org>
parents:
diff changeset
801 _XMErrorCode = XME_NO_ERROR;
Dave Love <fx@gnu.org>
parents:
diff changeset
802 return(_SUCCESS);
Dave Love <fx@gnu.org>
parents:
diff changeset
803 }
Dave Love <fx@gnu.org>
parents:
diff changeset
804
Dave Love <fx@gnu.org>
parents:
diff changeset
805
Dave Love <fx@gnu.org>
parents:
diff changeset
806
Dave Love <fx@gnu.org>
parents:
diff changeset
807 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
808 * _XMTransToOrigin - Internal subroutine to translate the point at
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 25858
diff changeset
809 * the center of the current pane and selection to the
25858
Dave Love <fx@gnu.org>
parents:
diff changeset
810 * the menu origin.
Dave Love <fx@gnu.org>
parents:
diff changeset
811 *
Dave Love <fx@gnu.org>
parents:
diff changeset
812 * WARNING! ****** Be certain that all menu dependencies have been
Dave Love <fx@gnu.org>
parents:
diff changeset
813 * recomputed before calling this routine or
Dave Love <fx@gnu.org>
parents:
diff changeset
814 * unpredictable results will follow.
Dave Love <fx@gnu.org>
parents:
diff changeset
815 */
Dave Love <fx@gnu.org>
parents:
diff changeset
816 _XMTransToOrigin(display, menu, p_ptr, s_ptr, x_pos, y_pos, orig_x, orig_y)
Dave Love <fx@gnu.org>
parents:
diff changeset
817 Display *display; /* Not used. Included for consistency. */
Dave Love <fx@gnu.org>
parents:
diff changeset
818 register XMenu *menu; /* Menu being computed against. */
Dave Love <fx@gnu.org>
parents:
diff changeset
819 register XMPane *p_ptr; /* Current pane pointer. */
Dave Love <fx@gnu.org>
parents:
diff changeset
820 register XMSelect *s_ptr; /* Current selection pointer. */
Dave Love <fx@gnu.org>
parents:
diff changeset
821 int x_pos; /* X coordinate of point to translate. */
Dave Love <fx@gnu.org>
parents:
diff changeset
822 int y_pos; /* Y coordinate of point to translate. */
Dave Love <fx@gnu.org>
parents:
diff changeset
823 int *orig_x; /* Return value X coord. of the menu origin. */
Dave Love <fx@gnu.org>
parents:
diff changeset
824 int *orig_y; /* Return value Y coord. of the menu origin. */
Dave Love <fx@gnu.org>
parents:
diff changeset
825 {
Dave Love <fx@gnu.org>
parents:
diff changeset
826 register int l_orig_x; /* Local X coordinate of the menu origin. */
Dave Love <fx@gnu.org>
parents:
diff changeset
827 register int l_orig_y; /* Local Y coordinate of the menu origin. */
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 25858
diff changeset
828
25858
Dave Love <fx@gnu.org>
parents:
diff changeset
829 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
830 * Translate the menu origin such that the cursor hot point will be in the
Dave Love <fx@gnu.org>
parents:
diff changeset
831 * center of the desired current selection and pane.
Dave Love <fx@gnu.org>
parents:
diff changeset
832 * If the current selection pointer is NULL then assume that the hot point
Dave Love <fx@gnu.org>
parents:
diff changeset
833 * will be in the center of the current pane flag.
Dave Love <fx@gnu.org>
parents:
diff changeset
834 */
Dave Love <fx@gnu.org>
parents:
diff changeset
835
Dave Love <fx@gnu.org>
parents:
diff changeset
836 if (s_ptr == NULL) {
Dave Love <fx@gnu.org>
parents:
diff changeset
837 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
838 * Translate from the center of the pane flag to the upper left
Dave Love <fx@gnu.org>
parents:
diff changeset
839 * of the current pane window.
Dave Love <fx@gnu.org>
parents:
diff changeset
840 */
Dave Love <fx@gnu.org>
parents:
diff changeset
841 l_orig_x = x_pos - (menu->p_width >> 1) - menu->p_bdr_width;
Dave Love <fx@gnu.org>
parents:
diff changeset
842 l_orig_y = y_pos - (menu->flag_height >> 1) - menu->p_bdr_width;
Dave Love <fx@gnu.org>
parents:
diff changeset
843 }
Dave Love <fx@gnu.org>
parents:
diff changeset
844 else {
Dave Love <fx@gnu.org>
parents:
diff changeset
845 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
846 * First translate from the center of the current selection
Dave Love <fx@gnu.org>
parents:
diff changeset
847 * to the upper left of the current selection window.
Dave Love <fx@gnu.org>
parents:
diff changeset
848 */
Dave Love <fx@gnu.org>
parents:
diff changeset
849 l_orig_x = x_pos - (menu->s_width >> 1);
Dave Love <fx@gnu.org>
parents:
diff changeset
850 l_orig_y = y_pos - (menu->s_height >> 1);
Dave Love <fx@gnu.org>
parents:
diff changeset
851
Dave Love <fx@gnu.org>
parents:
diff changeset
852 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
853 * Then translate to the upper left of the current pane window.
Dave Love <fx@gnu.org>
parents:
diff changeset
854 */
Dave Love <fx@gnu.org>
parents:
diff changeset
855 l_orig_x -= (s_ptr->window_x + menu->p_bdr_width);
Dave Love <fx@gnu.org>
parents:
diff changeset
856 l_orig_y -= (s_ptr->window_y + menu->p_bdr_width);
Dave Love <fx@gnu.org>
parents:
diff changeset
857 }
Dave Love <fx@gnu.org>
parents:
diff changeset
858
Dave Love <fx@gnu.org>
parents:
diff changeset
859 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
860 * Finally translate to the upper left of the menu.
Dave Love <fx@gnu.org>
parents:
diff changeset
861 */
Dave Love <fx@gnu.org>
parents:
diff changeset
862 l_orig_x -= (p_ptr->window_x - menu->x_pos);
Dave Love <fx@gnu.org>
parents:
diff changeset
863 l_orig_y -= (p_ptr->window_y - menu->y_pos);
Dave Love <fx@gnu.org>
parents:
diff changeset
864
Dave Love <fx@gnu.org>
parents:
diff changeset
865 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
866 * Set the return values.
Dave Love <fx@gnu.org>
parents:
diff changeset
867 */
Dave Love <fx@gnu.org>
parents:
diff changeset
868 *orig_x = l_orig_x;
Dave Love <fx@gnu.org>
parents:
diff changeset
869 *orig_y = l_orig_y;
Dave Love <fx@gnu.org>
parents:
diff changeset
870 }
Dave Love <fx@gnu.org>
parents:
diff changeset
871
Dave Love <fx@gnu.org>
parents:
diff changeset
872 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
873 * _XMRefreshPane - Internal subroutine to completely refresh
Dave Love <fx@gnu.org>
parents:
diff changeset
874 * the contents of a pane.
Dave Love <fx@gnu.org>
parents:
diff changeset
875 */
Dave Love <fx@gnu.org>
parents:
diff changeset
876 _XMRefreshPane(display, menu, pane)
Dave Love <fx@gnu.org>
parents:
diff changeset
877 register Display *display;
Dave Love <fx@gnu.org>
parents:
diff changeset
878 register XMenu *menu;
Dave Love <fx@gnu.org>
parents:
diff changeset
879 register XMPane *pane;
Dave Love <fx@gnu.org>
parents:
diff changeset
880 {
Dave Love <fx@gnu.org>
parents:
diff changeset
881 register XMSelect *s_list = pane->s_list;
Dave Love <fx@gnu.org>
parents:
diff changeset
882 register XMSelect *s_ptr;
Dave Love <fx@gnu.org>
parents:
diff changeset
883
Dave Love <fx@gnu.org>
parents:
diff changeset
884 /*
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 25858
diff changeset
885 * First clear the pane.
25858
Dave Love <fx@gnu.org>
parents:
diff changeset
886 */
Dave Love <fx@gnu.org>
parents:
diff changeset
887 XClearWindow(display, pane->window);
Dave Love <fx@gnu.org>
parents:
diff changeset
888 if (!pane->activated) {
Dave Love <fx@gnu.org>
parents:
diff changeset
889 XFillRectangle(display,
Dave Love <fx@gnu.org>
parents:
diff changeset
890 pane->window,
Dave Love <fx@gnu.org>
parents:
diff changeset
891 menu->inverse_select_GC,
Dave Love <fx@gnu.org>
parents:
diff changeset
892 pane->label_x - menu->p_fnt_pad,
Dave Love <fx@gnu.org>
parents:
diff changeset
893 pane->label_uy - menu->p_fnt_info->max_bounds.ascent - menu->p_fnt_pad,
Dave Love <fx@gnu.org>
parents:
diff changeset
894 pane->label_width + (menu->p_fnt_pad << 1),
Dave Love <fx@gnu.org>
parents:
diff changeset
895 menu->flag_height);
Dave Love <fx@gnu.org>
parents:
diff changeset
896
Dave Love <fx@gnu.org>
parents:
diff changeset
897 XFillRectangle(display,
Dave Love <fx@gnu.org>
parents:
diff changeset
898 pane->window,
Dave Love <fx@gnu.org>
parents:
diff changeset
899 menu->inverse_select_GC,
Dave Love <fx@gnu.org>
parents:
diff changeset
900 pane->label_x - menu->p_fnt_pad,
Dave Love <fx@gnu.org>
parents:
diff changeset
901 pane->label_ly - menu->p_fnt_info->max_bounds.ascent - menu->p_fnt_pad,
Dave Love <fx@gnu.org>
parents:
diff changeset
902 pane->label_width + (menu->p_fnt_pad << 1),
Dave Love <fx@gnu.org>
parents:
diff changeset
903 menu->flag_height);
Dave Love <fx@gnu.org>
parents:
diff changeset
904 }
Dave Love <fx@gnu.org>
parents:
diff changeset
905 if (!pane->active) {
Dave Love <fx@gnu.org>
parents:
diff changeset
906 XDrawString(display,
Dave Love <fx@gnu.org>
parents:
diff changeset
907 pane->window,
Dave Love <fx@gnu.org>
parents:
diff changeset
908 menu->inact_GC,
Dave Love <fx@gnu.org>
parents:
diff changeset
909 pane->label_x, pane->label_uy,
Dave Love <fx@gnu.org>
parents:
diff changeset
910 pane->label, pane->label_length);
Dave Love <fx@gnu.org>
parents:
diff changeset
911 XDrawString(display,
Dave Love <fx@gnu.org>
parents:
diff changeset
912 pane->window,
Dave Love <fx@gnu.org>
parents:
diff changeset
913 menu->inact_GC,
Dave Love <fx@gnu.org>
parents:
diff changeset
914 pane->label_x, pane->label_ly,
Dave Love <fx@gnu.org>
parents:
diff changeset
915 pane->label, pane->label_length);
Dave Love <fx@gnu.org>
parents:
diff changeset
916 }
Dave Love <fx@gnu.org>
parents:
diff changeset
917 else {
Dave Love <fx@gnu.org>
parents:
diff changeset
918 XDrawString(display,
Dave Love <fx@gnu.org>
parents:
diff changeset
919 pane->window,
Dave Love <fx@gnu.org>
parents:
diff changeset
920 menu->pane_GC,
Dave Love <fx@gnu.org>
parents:
diff changeset
921 pane->label_x, pane->label_uy,
Dave Love <fx@gnu.org>
parents:
diff changeset
922 pane->label, pane->label_length);
Dave Love <fx@gnu.org>
parents:
diff changeset
923 XDrawString(display,
Dave Love <fx@gnu.org>
parents:
diff changeset
924 pane->window,
Dave Love <fx@gnu.org>
parents:
diff changeset
925 menu->pane_GC,
Dave Love <fx@gnu.org>
parents:
diff changeset
926 pane->label_x, pane->label_ly,
Dave Love <fx@gnu.org>
parents:
diff changeset
927 pane->label, pane->label_length);
Dave Love <fx@gnu.org>
parents:
diff changeset
928
Dave Love <fx@gnu.org>
parents:
diff changeset
929 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
930 * Finally refresh each selection if the pane is activated.
Dave Love <fx@gnu.org>
parents:
diff changeset
931 */
Dave Love <fx@gnu.org>
parents:
diff changeset
932 if (pane->activated) {
Dave Love <fx@gnu.org>
parents:
diff changeset
933 for (s_ptr = s_list->next; s_ptr != s_list; s_ptr = s_ptr->next)
Dave Love <fx@gnu.org>
parents:
diff changeset
934 _XMRefreshSelection(display, menu, s_ptr);
Dave Love <fx@gnu.org>
parents:
diff changeset
935 }
Dave Love <fx@gnu.org>
parents:
diff changeset
936 }
Dave Love <fx@gnu.org>
parents:
diff changeset
937 }
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 25858
diff changeset
938
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 25858
diff changeset
939
25858
Dave Love <fx@gnu.org>
parents:
diff changeset
940
Dave Love <fx@gnu.org>
parents:
diff changeset
941
Dave Love <fx@gnu.org>
parents:
diff changeset
942 /*
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 25858
diff changeset
943 * _XMRefreshSelection - Internal subroutine that refreshes
25858
Dave Love <fx@gnu.org>
parents:
diff changeset
944 * a single selection window.
Dave Love <fx@gnu.org>
parents:
diff changeset
945 */
Dave Love <fx@gnu.org>
parents:
diff changeset
946 _XMRefreshSelection(display, menu, select)
Dave Love <fx@gnu.org>
parents:
diff changeset
947 register Display *display;
Dave Love <fx@gnu.org>
parents:
diff changeset
948 register XMenu *menu;
Dave Love <fx@gnu.org>
parents:
diff changeset
949 register XMSelect *select;
Dave Love <fx@gnu.org>
parents:
diff changeset
950 {
Dave Love <fx@gnu.org>
parents:
diff changeset
951 register int width = select->window_w;
Dave Love <fx@gnu.org>
parents:
diff changeset
952 register int height = select->window_h;
Dave Love <fx@gnu.org>
parents:
diff changeset
953 register int bdr_width = menu->s_bdr_width;
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 25858
diff changeset
954
25858
Dave Love <fx@gnu.org>
parents:
diff changeset
955 if (select->type == SEPARATOR) {
Dave Love <fx@gnu.org>
parents:
diff changeset
956 XDrawLine(display,
Dave Love <fx@gnu.org>
parents:
diff changeset
957 select->parent_p->window,
Dave Love <fx@gnu.org>
parents:
diff changeset
958 menu->normal_select_GC,
Dave Love <fx@gnu.org>
parents:
diff changeset
959 select->window_x,
Dave Love <fx@gnu.org>
parents:
diff changeset
960 select->window_y + height / 2,
Dave Love <fx@gnu.org>
parents:
diff changeset
961 select->window_x + width,
Dave Love <fx@gnu.org>
parents:
diff changeset
962 select->window_y + height / 2);
Dave Love <fx@gnu.org>
parents:
diff changeset
963 }
Dave Love <fx@gnu.org>
parents:
diff changeset
964 else if (select->activated) {
Dave Love <fx@gnu.org>
parents:
diff changeset
965 if (menu->menu_mode == INVERT) {
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 25858
diff changeset
966 XFillRectangle(display,
25858
Dave Love <fx@gnu.org>
parents:
diff changeset
967 select->parent_p->window,
Dave Love <fx@gnu.org>
parents:
diff changeset
968 menu->normal_select_GC,
Dave Love <fx@gnu.org>
parents:
diff changeset
969 select->window_x, select->window_y,
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 25858
diff changeset
970 width, height);
25858
Dave Love <fx@gnu.org>
parents:
diff changeset
971 XDrawString(display,
Dave Love <fx@gnu.org>
parents:
diff changeset
972 select->parent_p->window,
Dave Love <fx@gnu.org>
parents:
diff changeset
973 menu->inverse_select_GC,
Dave Love <fx@gnu.org>
parents:
diff changeset
974 select->label_x,
Dave Love <fx@gnu.org>
parents:
diff changeset
975 select->label_y,
Dave Love <fx@gnu.org>
parents:
diff changeset
976 select->label, select->label_length);
Dave Love <fx@gnu.org>
parents:
diff changeset
977 }
Dave Love <fx@gnu.org>
parents:
diff changeset
978 else {
Dave Love <fx@gnu.org>
parents:
diff changeset
979 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
980 * Using BOX mode.
Dave Love <fx@gnu.org>
parents:
diff changeset
981 * Since most drawing routines with arbitrary width lines
Dave Love <fx@gnu.org>
parents:
diff changeset
982 * are slow compared to raster-ops lets use a raster-op to
Dave Love <fx@gnu.org>
parents:
diff changeset
983 * draw the boxes.
Dave Love <fx@gnu.org>
parents:
diff changeset
984 */
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 25858
diff changeset
985
25858
Dave Love <fx@gnu.org>
parents:
diff changeset
986 XDrawRectangle(display,
Dave Love <fx@gnu.org>
parents:
diff changeset
987 select->parent_p->window,
Dave Love <fx@gnu.org>
parents:
diff changeset
988 menu->normal_select_GC,
Dave Love <fx@gnu.org>
parents:
diff changeset
989 select->window_x + (bdr_width >> 1),
Dave Love <fx@gnu.org>
parents:
diff changeset
990 select->window_y + (bdr_width >> 1 ),
Dave Love <fx@gnu.org>
parents:
diff changeset
991 width - bdr_width,
Dave Love <fx@gnu.org>
parents:
diff changeset
992 height - bdr_width);
Dave Love <fx@gnu.org>
parents:
diff changeset
993 XDrawString(display,
Dave Love <fx@gnu.org>
parents:
diff changeset
994 select->parent_p->window,
Dave Love <fx@gnu.org>
parents:
diff changeset
995 menu->normal_select_GC,
Dave Love <fx@gnu.org>
parents:
diff changeset
996 select->label_x,
Dave Love <fx@gnu.org>
parents:
diff changeset
997 select->label_y,
Dave Love <fx@gnu.org>
parents:
diff changeset
998 select->label, select->label_length);
Dave Love <fx@gnu.org>
parents:
diff changeset
999 }
Dave Love <fx@gnu.org>
parents:
diff changeset
1000 }
Dave Love <fx@gnu.org>
parents:
diff changeset
1001 else {
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 25858
diff changeset
1002 XClearArea(display,
25858
Dave Love <fx@gnu.org>
parents:
diff changeset
1003 select->parent_p->window,
Dave Love <fx@gnu.org>
parents:
diff changeset
1004 select->window_x, select->window_y,
Dave Love <fx@gnu.org>
parents:
diff changeset
1005 width, height,
Dave Love <fx@gnu.org>
parents:
diff changeset
1006 False);
Dave Love <fx@gnu.org>
parents:
diff changeset
1007 if (select->active) {
Dave Love <fx@gnu.org>
parents:
diff changeset
1008 XDrawString(display,
Dave Love <fx@gnu.org>
parents:
diff changeset
1009 select->parent_p->window,
Dave Love <fx@gnu.org>
parents:
diff changeset
1010 menu->normal_select_GC,
Dave Love <fx@gnu.org>
parents:
diff changeset
1011 select->label_x,
Dave Love <fx@gnu.org>
parents:
diff changeset
1012 select->label_y,
Dave Love <fx@gnu.org>
parents:
diff changeset
1013 select->label, select->label_length);
Dave Love <fx@gnu.org>
parents:
diff changeset
1014 }
Dave Love <fx@gnu.org>
parents:
diff changeset
1015 else {
Dave Love <fx@gnu.org>
parents:
diff changeset
1016 XDrawString(display,
Dave Love <fx@gnu.org>
parents:
diff changeset
1017 select->parent_p->window,
Dave Love <fx@gnu.org>
parents:
diff changeset
1018 menu->inact_GC,
Dave Love <fx@gnu.org>
parents:
diff changeset
1019 select->label_x,
Dave Love <fx@gnu.org>
parents:
diff changeset
1020 select->label_y,
Dave Love <fx@gnu.org>
parents:
diff changeset
1021 select->label, select->label_length);
Dave Love <fx@gnu.org>
parents:
diff changeset
1022 }
Dave Love <fx@gnu.org>
parents:
diff changeset
1023 }
Dave Love <fx@gnu.org>
parents:
diff changeset
1024 }
Dave Love <fx@gnu.org>
parents:
diff changeset
1025
52401
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 49600
diff changeset
1026 /* arch-tag: 3ac61957-0852-4e72-8b88-7dfab1a5dee9
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 49600
diff changeset
1027 (do not change this comment) */