1 /*
2 * wmslib/src/but/box.c, part of wmslib (Library functions)
3 * Copyright (C) 1994-1997 William Shubert.
4 * See "configure.h.in" for more copyright information.
5 */
6
7 #include <configure.h>
8
9 #ifdef X11_DISP
10
11 #ifdef STDC_HEADERS
12 #include <stdlib.h>
13 #include <unistd.h>
14 #endif /* STDC_HEADERS */
15 #include <stdio.h>
16 #include <X11/Xlib.h>
17 #include <X11/Xutil.h>
18 #include <X11/cursorfont.h>
19 #include <X11/Xatom.h>
20 #include <X11/keysym.h>
21 #include <sys/time.h>
22 #ifdef HAVE_SYS_SELECT_H
23 #include <sys/select.h>
24 #endif
25 #include <but/but.h>
26 #include <but/box.h>
27 #include <but/ctext.h>
28
29
30 /**********************************************************************
31 * Data Types
32 **********************************************************************/
33 typedef struct Box_struct {
34 Pixmap ulmap, lrmap;
35 int ulcolor, lrcolor;
36 } Box;
37
38 typedef struct BoxFilled_struct {
39 Pixmap ulmap, lrmap, cmap;
40 int ulcolor, lrcolor, ccolor;
41 } BoxFilled;
42
43
44 /**********************************************************************
45 * Foward Declarations
46 **********************************************************************/
47 static void box_draw(But *but, int x, int y, int w, int h);
48 static void boxFilled_draw(But *but, int x, int y, int w, int h);
49 static ButOut curve(int x, int y, int radius, int start, int sweep,
50 XPoint *pts);
51 static ButOut box_destroy(But *but);
52 static ButOut boxFilled_destroy(But *but);
53 static bool boxFilled_resize(But *but, int oldX, int oldY,
54 int oldW, int oldH);
55 static ButOut box_mmove(But *but, int x, int y);
56
57 #define CIRCLE 64 /* Points to make a full circle. */
58
59
60 /**********************************************************************
61 * Globals
62 **********************************************************************/
63 static ButAction box_action = {
64 box_mmove, NULL, NULL, NULL, NULL, NULL,
65 box_draw, box_destroy, but_flags, NULL, NULL};
66
67 static ButAction boxFilled_action = {
68 NULL, NULL, NULL, NULL, NULL, NULL,
69 boxFilled_draw, boxFilled_destroy, but_flags, NULL, boxFilled_resize};
70
71
72 /**********************************************************************
73 * Functions
74 **********************************************************************/
butBox_create(ButWin * win,int layer,int flags)75 But *butBox_create(ButWin *win, int layer, int flags) {
76 But *but;
77 Box *box;
78
79 box = (Box *)wms_malloc(sizeof(Box));
80 but = but_create(win, box, &box_action);
81 but->layer = layer;
82 but->flags = flags;
83 box->ulcolor = BUT_LIT;
84 box->lrcolor = BUT_SHAD;
85 box->ulmap = None;
86 box->lrmap = None;
87 but_init(but);
88 return(but);
89 }
90
91
butBox_setColors(But * but,int ul,int lr)92 void butBox_setColors(But *but, int ul, int lr) {
93 Box *box = but->iPacket;
94
95 assert(but->action == &box_action);
96 if (ul >= 0) {
97 box->ulcolor = ul;
98 box->ulmap = None;
99 }
100 if (lr >= 0) {
101 box->lrcolor = lr;
102 box->lrmap = None;
103 }
104 but_draw(but);
105 }
106
107
butBox_setPixmaps(But * but,Pixmap ul,Pixmap lr)108 void butBox_setPixmaps(But *but, Pixmap ul, Pixmap lr) {
109 Box *box = but->iPacket;
110
111 assert(but->action == &box_action);
112 if (ul != None)
113 box->ulmap = ul;
114 if (lr != None)
115 box->lrmap = lr;
116 but_draw(but);
117 }
118
119
box_draw(But * but,int x,int y,int w,int h)120 static void box_draw(But *but, int x, int y, int w, int h) {
121 ButEnv *env = but->win->env;
122 int butbw = env->stdButBw;
123 Box *box = but->iPacket;
124
125 if ((x < but->x + butbw) ||
126 (x+w > but->x + but->w - butbw) ||
127 (y < but->y + butbw) ||
128 (y+h > but->y + but->h - butbw)) {
129 but_drawBox(but->win, but->x, but->y, but->w, but->h,0, butbw, 0,
130 box->ulcolor, box->lrcolor, box->ulmap, box->lrmap);
131 }
132 }
133
134
box_destroy(But * but)135 static ButOut box_destroy(But *but) {
136 wms_free(but->iPacket);
137 return(0);
138 }
139
140
but_drawBox(ButWin * win,int x,int y,int w,int h,int bstate,int bw,int angles,int ulcolor,int lrcolor,Pixmap ulmap,Pixmap lrmap)141 void but_drawBox(ButWin *win, int x, int y, int w, int h, int bstate,
142 int bw, int angles, int ulcolor, int lrcolor,
143 Pixmap ulmap, Pixmap lrmap) {
144 ButEnv *env = win->env;
145 Display *dpy = env->dpy;
146 XPoint points[(CIRCLE/8+1)*4 + (CIRCLE/4+1)*2 + 1];
147 int abw = (bw * 1448 + 511) / 1024, h2 = h/2;
148 int rounding = env->font0h / 2;
149 int pnum = 0;
150 int xOff = win->xOff, yOff = win->yOff;
151 bool forceTiled;
152
153 /* For arrows:
154 * a----- h2 = c.y - a.y
155 * / b____ abw = d.x - c.x
156 * / /
157 * c_d
158 * \ \
159 */
160 if (angles & BUT_ALEFT) {
161 points[pnum ].x = x + abw + h2 - bw - xOff;
162 points[pnum++].y = y + bw - yOff;
163 points[pnum ].x = x + abw - xOff;
164 points[pnum++].y = y + h2 - yOff;
165 points[pnum ].x = x - xOff;
166 points[pnum++].y = y + h2 - yOff;
167 points[pnum ].x = x + h2 - xOff;
168 points[pnum++].y = y - yOff;
169 } else if (angles & BUT_RLEFT) {
170 pnum += curve(x+rounding-xOff, y+ rounding-yOff, rounding-bw,
171 90,90, points+pnum);
172 pnum += curve(x+rounding-xOff, y+h-rounding-yOff, rounding-bw,
173 180,45, points+pnum);
174 pnum += curve(x+rounding-xOff, y+h-rounding-yOff, rounding,
175 225,-45, points+pnum);
176 pnum += curve(x+rounding-xOff, y+ rounding-yOff, rounding,
177 180,-90, points+pnum);
178 } else { /* Square left edge. */
179 points[pnum ].x = x + bw - xOff;
180 points[pnum++].y = y + bw - yOff;
181 points[pnum ].x = x + bw - xOff;
182 points[pnum++].y = y + h - bw - yOff;
183 points[pnum ].x = x - xOff;
184 points[pnum++].y = y + h - yOff;
185 points[pnum ].x = x - xOff;
186 points[pnum++].y = y - yOff;
187 }
188 if (angles & BUT_ARIGHT) {
189 points[pnum ].x = x + w - h2 - xOff;
190 points[pnum++].y = y - yOff;
191 points[pnum ].x = x + w - xOff;
192 points[pnum++].y = y + h2 - yOff;
193 points[pnum ].x = x + w - abw - xOff;
194 points[pnum++].y = y + h2 - yOff;
195 points[pnum ].x = x + w - (abw + h2) + (abw-bw) - xOff;
196 points[pnum++].y = y + bw - yOff;
197 } else if (angles & BUT_RRIGHT) {
198 pnum += curve(x+w-rounding-xOff, y+rounding-yOff, rounding,
199 90,-45, points+pnum);
200 pnum += curve(x+w-rounding-xOff, y+rounding-yOff, rounding-bw,
201 0,45, points+pnum);
202 } else { /* Square right edge. */
203 points[pnum ].x = x + w - xOff;
204 points[pnum++].y = y - yOff;
205 points[pnum ].x = x + w - bw - xOff;
206 points[pnum++].y = y + bw - yOff;
207 }
208
209 points[pnum] = points[0];
210 assert(pnum < sizeof(points) / sizeof(points[0]));
211 forceTiled = FALSE;
212 if (bstate == 0) {
213 if (ulmap == None) {
214 butEnv_setXFg(env, ulcolor);
215 } else {
216 forceTiled = TRUE;
217 XSetFillStyle(env->dpy, env->gc, FillTiled);
218 XSetTile(env->dpy, env->gc, ulmap);
219 }
220 } else {
221 if (lrmap == None) {
222 butEnv_setXFg(env, lrcolor);
223 } else {
224 forceTiled = TRUE;
225 XSetFillStyle(env->dpy, env->gc, FillTiled);
226 XSetTile(env->dpy, env->gc, lrmap);
227 }
228 }
229 XFillPolygon(dpy, win->win, env->gc, points, pnum, Nonconvex,
230 CoordModeOrigin);
231
232 h2 = (h + 1) / 2;
233 pnum = 0;
234 if (angles & BUT_ALEFT) {
235 points[pnum ].x = x + abw + h2 - bw - xOff;
236 points[pnum++].y = y + h - bw - yOff;
237 points[pnum ].x = x + abw - xOff;
238 points[pnum++].y = y + h - h2 - yOff;
239 points[pnum ].x = x - xOff;
240 points[pnum++].y = y + h - h2 - yOff;
241 points[pnum ].x = x + h2 - xOff;
242 points[pnum++].y = y + h - yOff;
243 } else if (angles & BUT_RLEFT) {
244 pnum += curve(x+rounding-xOff, y+h-rounding-yOff, rounding-bw,
245 270,-45, points+pnum);
246 pnum += curve(x+rounding-xOff, y+h-rounding-yOff, rounding,
247 225,45, points+pnum);
248 } else { /* Square left edge. */
249 points[pnum ].x = x + bw - xOff;
250 points[pnum++].y = y + h - bw - yOff;
251 points[pnum ].x = x - xOff;
252 points[pnum++].y = y + h - yOff;
253 }
254 if (angles & BUT_ARIGHT) {
255 points[pnum ].x = x + w - h2 - xOff;
256 points[pnum++].y = y + h - yOff;
257 points[pnum ].x = x + w - xOff;
258 points[pnum++].y = y + h - h2 - yOff;
259 points[pnum ].x = x + w - abw - xOff;
260 points[pnum++].y = y + h - h2 - yOff;
261 points[pnum ].x = x + w - (abw + h2) + (abw-bw) - xOff;
262 points[pnum++].y = y + h - bw - yOff;
263 } else if (angles & BUT_RRIGHT) {
264 pnum += curve(x+w-rounding-xOff, y+h-rounding-yOff, rounding,
265 270,90, points+pnum);
266 pnum += curve(x+w-rounding-xOff, y+rounding-yOff, rounding,
267 0,45, points+pnum);
268 pnum += curve(x+w-rounding-xOff, y+rounding-yOff, rounding-bw,
269 45,-45, points+pnum);
270 pnum += curve(x+w-rounding-xOff, y+h-rounding-yOff, rounding-bw,
271 0,-90, points+pnum);
272 } else { /* Square right edge. */
273 points[pnum ].x = x + w - xOff;
274 points[pnum++].y = y + h - yOff;
275 points[pnum ].x = x + w - xOff;
276 points[pnum++].y = y - yOff;
277 points[pnum ].x = x + w - bw - xOff;
278 points[pnum++].y = y + bw - yOff;
279 points[pnum ].x = x + w - bw - xOff;
280 points[pnum++].y = y + h - bw - yOff;
281 }
282 points[pnum] = points[0];
283 assert(pnum < sizeof(points) / sizeof(points[0]));
284 if (bstate == 0) {
285 if (lrmap == None) {
286 if (forceTiled) {
287 XSetFillStyle(env->dpy, env->gc, FillSolid);
288 forceTiled = FALSE;
289 }
290 butEnv_setXFg(env, lrcolor);
291 } else {
292 forceTiled = TRUE;
293 XSetFillStyle(env->dpy, env->gc, FillTiled);
294 XSetTile(env->dpy, env->gc, lrmap);
295 }
296 } else {
297 if (ulmap == None) {
298 if (forceTiled) {
299 XSetFillStyle(env->dpy, env->gc, FillSolid);
300 forceTiled = FALSE;
301 }
302 butEnv_setXFg(env, ulcolor);
303 } else {
304 if (!forceTiled) {
305 XSetFillStyle(env->dpy, env->gc, FillTiled);
306 forceTiled = TRUE;
307 }
308 XSetTile(env->dpy, env->gc, ulmap);
309 }
310 }
311 XFillPolygon(dpy, win->win, env->gc, points, pnum, Nonconvex,
312 CoordModeOrigin);
313 if (forceTiled)
314 butEnv_stdFill(env);
315 }
316
317
curve(int x,int y,int radius,int start,int sweep,XPoint * pts)318 static ButOut curve(int x, int y, int radius, int start, int sweep,
319 XPoint *pts) {
320 const int circRadius = 2048;
321 static const int cosine[CIRCLE] = {
322 2048, 2038, 2009, 1960, 1892, 1806, 1703, 1583,
323 1448, 1299, 1138, 965, 784, 595, 400, 201,
324
325 0, -201, -400, -595, -784, -965,-1138,-1299,
326 -1448,-1583,-1703,-1806, -1892,-1960,-2009,-2038,
327
328 -2048,-2038,-2009,-1960, -1892,-1806,-1703,-1583,
329 -1448,-1299,-1138, -965, -784, -595, -400, -201,
330
331 0, 201, 400, 595, 784, 965, 1138, 1299,
332 1448, 1583, 1703, 1806, 1892, 1960, 2009, 2038};
333 int i, step, count = 0, limit, round, cv;
334
335 start = (start * CIRCLE) / 360;
336 sweep = (sweep * CIRCLE) / 360;
337 if (sweep > 0)
338 step = 1;
339 else
340 step = -1;
341 limit = step*sweep;
342 for (i = start, count = 0; count <= limit; i += step, ++count) {
343 cv = cosine[i & (CIRCLE-1)];
344 if (cv < 0)
345 round = -circRadius/2;
346 else
347 round = circRadius/2;
348 pts[count].x = x + (cv * radius + round) / circRadius;
349 cv = cosine[(CIRCLE/4 + i) & (CIRCLE-1)];
350 if (cv < 0)
351 round = -circRadius/2;
352 else
353 round = circRadius/2;
354 pts[count].y = y + (cv * radius + round) / circRadius;
355 }
356 return(count);
357 }
358
359
but_drawCt(ButWin * win,int flags,int fgpic,int bgpic,int pbgpic,int x,int y,int w,int h,int bw,const char * text,int angles,int fontnum)360 void but_drawCt(ButWin *win, int flags, int fgpic, int bgpic, int pbgpic,
361 int x, int y, int w, int h, int bw, const char *text,
362 int angles, int fontnum) {
363 ButEnv *env = win->env;
364
365 but_drawCtb(win, flags, fgpic, bgpic, pbgpic, x, y, w, h, bw, angles);
366 if (!(flags & BUT_PRESSABLE)) {
367 XSetFillStyle(env->dpy, env->gc, FillStippled);
368 XSetForeground(env->dpy, env->gc, env->colors[fgpic]);
369 } else
370 butEnv_setXFg(env, fgpic);
371 if ((flags & BUT_PRESSED) && (flags & BUT_TWITCHED)) {
372 x += bw/2;
373 y += bw/2;
374 }
375 butWin_write(win, x + (w - butEnv_textWidth(env, text, fontnum))/2,
376 y + (h - butEnv_fontH(env, fontnum)) / 2, text, fontnum);
377 if (!(flags & BUT_PRESSABLE)) {
378 butEnv_stdFill(env);
379 }
380 }
381
382
but_drawCtb(ButWin * win,int flags,int fgpic,int bgpic,int pbgpic,int x,int y,int w,int h,int bw,int angles)383 void but_drawCtb(ButWin *win, int flags, int fgpic, int bgpic, int pbgpic,
384 int x, int y, int w, int h, int bw, int angles) {
385 ButEnv *env = win->env;
386
387 but_drawBox(win, x, y, w, h,
388 flags & (BUT_PRESSED|BUT_NETPRESS), bw,
389 angles, BUT_LIT, BUT_SHAD, None, None);
390 if ((flags & (BUT_PRESSED|BUT_NETPRESS)) &&
391 (flags & (BUT_TWITCHED|BUT_NETTWITCH|BUT_KEYPRESSED|BUT_NETKEY)))
392 bgpic = pbgpic;
393 butEnv_setXFg(env, bgpic);
394 x -= win->xOff;
395 y -= win->yOff;
396 if (angles) {
397 XPoint points[CIRCLE + 5];
398 int npoints = 0, abw = (bw * 1448 + 511) / 1024, rnd = env->font0h / 2;
399
400 if (angles & BUT_ALEFT) {
401 points[npoints ].x = x + abw + h/2 - bw;
402 points[npoints++].y = y + bw;
403 points[npoints ].x = x + abw;
404 points[npoints++].y = y + h/2;
405 points[npoints ].x = x + abw + (h+1)/2 - bw;
406 points[npoints++].y = y + h - bw;
407 } else if (angles & BUT_RLEFT) {
408 npoints += curve(x+rnd,y+rnd, rnd-bw, 90,90, points+npoints);
409 npoints += curve(x+rnd,y+h-rnd, rnd-bw, 180,90, points+npoints);
410 } else {
411 points[npoints ].x = x + bw;
412 points[npoints++].y = y + bw;
413 points[npoints ].x = x + bw;
414 points[npoints++].y = y + h - bw;
415 }
416 if (angles & BUT_ARIGHT) {
417 points[npoints ].x = x + w - abw - (h+1)/2 + bw;
418 points[npoints++].y = y + h - bw;
419 points[npoints ].x = x + w - abw;
420 points[npoints++].y = y + h/2;
421 points[npoints ].x = x + w - abw - h/2 + bw;
422 points[npoints++].y = y + bw;
423 } else if (angles & BUT_RRIGHT) {
424 npoints += curve(x+w-rnd,y+h-rnd, rnd-bw, 270,90, points+npoints);
425 npoints += curve(x+w-rnd,y+rnd, rnd-bw, 0,90, points+npoints);
426 } else {
427 points[npoints ].x = x + w - bw;
428 points[npoints++].y = y + h - bw;
429 points[npoints ].x = x + w - bw;
430 points[npoints++].y = y + bw;
431 }
432 points[npoints] = points[0];
433 assert(npoints < CIRCLE+5);
434 XFillPolygon(env->dpy, win->win, env->gc, points, npoints, Convex,
435 CoordModeOrigin);
436 } else
437 XFillRectangle(env->dpy, win->win, env->gc, x+bw, y+bw, w-2*bw, h-2*bw);
438 }
439
440
butBoxFilled_create(ButWin * win,int layer,int flags)441 But *butBoxFilled_create(ButWin *win, int layer, int flags) {
442 But *but;
443 BoxFilled *box;
444
445 box = (BoxFilled *)wms_malloc(sizeof(BoxFilled));
446 but = but_create(win, box, &boxFilled_action);
447 but->layer = layer;
448 but->flags = flags | BUT_OPAQUE;
449 box->ulcolor = BUT_LIT;
450 box->lrcolor = BUT_SHAD;
451 box->ccolor = BUT_BG;
452 box->ulmap = None;
453 box->lrmap = None;
454 box->cmap = None;
455 but_init(but);
456 return(but);
457 }
458
459
butBoxFilled_setColors(But * but,int ul,int lr,int c)460 void butBoxFilled_setColors(But *but, int ul, int lr, int c) {
461 BoxFilled *box = but->iPacket;
462
463 assert(but->action == &boxFilled_action);
464 if (ul >= 0) {
465 box->ulcolor = ul;
466 box->ulmap = None;
467 }
468 if (lr >= 0) {
469 box->lrcolor = lr;
470 box->lrmap = None;
471 }
472 if (c >= 0) {
473 box->ccolor = c;
474 box->cmap = None;
475 }
476 but_draw(but);
477 }
478
479
butBoxFilled_setPixmaps(But * but,Pixmap ul,Pixmap lr,Pixmap c)480 void butBoxFilled_setPixmaps(But *but, Pixmap ul, Pixmap lr, Pixmap c) {
481 BoxFilled *box = but->iPacket;
482
483 assert(but->action == &boxFilled_action);
484 if (ul != None)
485 box->ulmap = ul;
486 if (lr != None)
487 box->lrmap = lr;
488 if (c != None)
489 box->cmap = c;
490 but_draw(but);
491 }
492
493
boxFilled_draw(But * but,int x,int y,int w,int h)494 static void boxFilled_draw(But *but, int x, int y, int w, int h) {
495 ButWin *win = but->win;
496 ButEnv *env = win->env;
497 int butbw = env->stdButBw;
498 BoxFilled *box = but->iPacket;
499
500 if ((x < but->x + butbw) ||
501 (x+w > but->x + but->w - butbw) ||
502 (y < but->y + butbw) ||
503 (y+h > but->y + but->h - butbw)) {
504 but_drawBox(but->win, but->x, but->y, but->w, but->h,0, butbw, 0,
505 box->ulcolor, box->lrcolor, box->ulmap, box->lrmap);
506 }
507 if ((x >= but->x + but->w - butbw) || (y >= but->y + but->h - butbw) ||
508 (x + w <= but->x + butbw) || (y+h <= but->y + butbw))
509 return;
510 if (x < but->x + butbw) {
511 w -= but->x + butbw - x;
512 x = but->x + butbw;
513 }
514 if (y < but->y + butbw) {
515 h -= but->y + butbw - y;
516 y = but->y + butbw;
517 }
518 if (x+w > but->x + but->w - butbw)
519 w = but->x + but->w - butbw - x;
520 if (y+h > but->y + but->h - butbw)
521 h = but->y + but->h - butbw - y;
522 if (box->cmap == None) {
523 butEnv_setXFg(env, box->ccolor);
524 XFillRectangle(env->dpy, win->win, env->gc, x-win->xOff, y-win->yOff,
525 w,h);
526 } else {
527 if (env->colorp)
528 XSetFillStyle(env->dpy, env->gc, FillTiled);
529 XSetTile(env->dpy, env->gc, box->cmap);
530 XFillRectangle(env->dpy, but->win->win, env->gc,
531 x-win->xOff, y-win->yOff, w,h);
532 if (env->colorp)
533 XSetFillStyle(env->dpy, env->gc, FillSolid);
534 }
535 }
536
537
boxFilled_destroy(But * but)538 static ButOut boxFilled_destroy(But *but) {
539 wms_free(but->iPacket);
540 return(0);
541 }
542
543
544 /*
545 * This resize redraws only the needed parts of the screen.
546 */
boxFilled_resize(But * but,int oldX,int oldY,int oldW,int oldH)547 static bool boxFilled_resize(But *but, int oldX, int oldY,
548 int oldW, int oldH) {
549 int x, y, w, h, bw;
550
551 bw = but->win->env->stdButBw;
552 x = but->x;
553 y = but->y;
554 w = but->w;
555 h = but->h;
556
557 if ((oldW < 1) || (oldH < 1)) {
558 butWin_redraw(but->win, x, y, w, h);
559 } else if ((x + w < oldX) || (y + h < oldY) ||
560 (oldX + oldW < x) || (oldY + oldH < y)) {
561 butWin_redraw(but->win, oldX, oldY, oldW, oldH);
562 butWin_redraw(but->win, x, y, w, h);
563 } else {
564 if (x < oldX)
565 butWin_redraw(but->win, x, y, oldX + bw - x, h);
566 else if (oldX < x)
567 butWin_redraw(but->win, oldX, oldY, x + bw - oldX, oldH);
568
569 if (y < oldY)
570 butWin_redraw(but->win, x, y, w, oldY + bw - y);
571 else if (oldY < y)
572 butWin_redraw(but->win, oldX, oldY, oldW, y + bw - oldY);
573
574 if (x + w < oldX + oldW)
575 butWin_redraw(but->win, x + w - bw, oldY,
576 oldX + oldW + bw - x - w, oldH);
577 else if (oldX + oldW < x + w)
578 butWin_redraw(but->win, oldX + oldW - bw, y,
579 x + w + bw - oldX - oldW, h);
580
581 if (y + h < oldY + oldH)
582 butWin_redraw(but->win, oldX, y + h - bw,
583 oldW, oldY + oldH + bw - y - h);
584 else if (oldY + oldH < y + h)
585 butWin_redraw(but->win, x, oldY + oldH - bw,
586 w, y + h + bw - oldY - oldH);
587 }
588 return(FALSE);
589 }
590
591
box_mmove(But * but,int x,int y)592 static ButOut box_mmove(But *but, int x, int y) {
593 int bw = butEnv_stdBw(but->win->env);
594
595 if (((x >= but->x) && (x < but->x + bw)) ||
596 ((y >= but->y) && (y < but->y + bw)) ||
597 ((x >= but->x + but->w - bw) && (x < but->x + but->w)) ||
598 ((y >= but->y + but->h - bw) && (y < but->y + but->h)))
599 return(BUTOUT_CAUGHT);
600 else
601 return(0);
602 }
603
604
605 #endif
606