annotate oldXMenu/Internal.c @ 104575:c5622417a2ae

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