summaryrefslogtreecommitdiff
path: root/x11/tvtwm/patches/patch-an
blob: 0bdac21f6e58c1b072b33d04c3c6480b49339f8c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
$NetBSD: patch-an,v 1.3 2000/09/11 00:58:30 wiz Exp $

--- menus.c.orig	Thu Feb  9 21:09:18 1995
+++ menus.c
@@ -191,6 +191,7 @@
 #include "gram.h"
 #include "screen.h"
 #include <X11/Xmu/CharSet.h>		/* for XmuCompareISOLatin1() */
+#include <X11/Xmu/Drawing.h>            /* for XmuLocateBitmapFile */
 #include "version.h"
 #include "vdt.h"
 #include "add_window.h"
@@ -228,8 +229,6 @@
 } MenuOrigins[MAXMENUDEPTH];
 static Cursor LastCursor;
 
-void WarpAlongRing(), WarpToWindow();
-
 extern char *Action;
 extern int Context;
 extern TwmWindow *ButtonWindow, *Tmp_win;
@@ -237,6 +236,12 @@
 extern char *InitFile;
 static void Identify();
 
+/* Local function prototypes */
+Bool Deferrable(int func);
+int DeferExecution(int context, int func, char *action, Cursor cursor);
+void WarpToWindow (TwmWindow *t);
+void WarpAlongRing (XButtonEvent *ev, Bool forward);
+
 #define MAX(x,y) ((x)>(y)?(x):(y))
 
 
@@ -527,7 +532,7 @@
 
 
 
-PaintEntry(mr, mi, exposure)
+void PaintEntry(mr, mi, exposure)
 MenuRoot *mr;
 MenuItem *mi;
 int exposure;
@@ -602,9 +607,9 @@
 #endif
 
 		    Scr->pullrightPm.pm = FindPixmap(Scr->pullrightPm.name,
-						&Scr->pullrightPm.width,
-						&Scr->pullrightPm.height,
-						&Scr->pullrightPm.isXpm,
+						&(Scr->pullrightPm.width),
+						&(Scr->pullrightPm.height),
+						&(Scr->pullrightPm.isXpm),
 						NULL,
 #ifdef XPM
 						ctrans, 2,
@@ -684,7 +689,7 @@
 
 
 
-PaintMenu(mr, e)
+void PaintMenu(mr, e)
 MenuRoot *mr;
 XEvent *e;
 {
@@ -710,7 +715,7 @@
 
 static Bool fromMenu;
 
-#if 1
+void
 UpdateMenu()
 {
     MenuItem *mi;
@@ -787,13 +792,8 @@
 	if (Event.type != MotionNotify)
 	    continue;
 
-#if 1
 	XQueryPointer( dpy, ActiveMenu->w, &aJunkRoot, &aJunkChild,
 	    &x_root, &y_root, &x, &y, &aJunkMask);
-#else
-	x = ((XMotionEvent *)&Event)->x;
-	y = ((XMotionEvent *)&Event)->y;
-#endif
 
 	/* if we are in the parent, pop back down, this should prevent
 	 * menus that are slow to pop up from hanging around too long.
@@ -910,137 +910,6 @@
     }
 
 }
-#else
-UpdateMenu()
-{
-    MenuItem       *mi;
-    int             i, x, y, x_root, y_root, entry;
-    int             done;
-    MenuItem       *badItem = NULL;
-    Window          aJunkRoot, aJunkChild;
-    unsigned int    aJunkMask;
-    static int      firstTime = True;
-
-    fromMenu = TRUE;
-
-    while (TRUE) {
-	while (XCheckMaskEvent(dpy, ButtonPressMask | ButtonReleaseMask |
-			       EnterWindowMask | ExposureMask, &Event)) {
-	    if (!DispatchEvent())
-		continue;
-
-	    if (Event.type == ButtonRelease || ActiveMenu == NULL) {
-		menuFromFrameOrWindowOrTitlebar = FALSE;
-		fromMenu = FALSE;
-		if (Scr->StayUpMenus) {
-		    if (firstTime == True) {
-			/* it was the first release of the button */
-			firstTime = False;
-		    }
-		    /* end if  */
-		    else {
-			/* thats the second we need to return now */
-			firstTime = True;
-			return;
-		    }				 /* end else  */
-		}
-		/* end if  */
-		else {
-		    return;
-		}				 /* end else  */
-	    }
-	    if (Event.type == Cancel) {
-		menuFromFrameOrWindowOrTitlebar = FALSE;
-		fromMenu = FALSE;
-		return;
-	    }
-	}
-
-	done = FALSE;
-	XQueryPointer(dpy, ActiveMenu->w, &aJunkRoot, &aJunkChild,
-		      &x_root, &y_root, &x, &y, &aJunkMask);
-
-	/* if we haven't received the enter notify yet, wait */
-	if (!ActiveMenu || !ActiveMenu->entered)
-	    continue;
-
-	XFindContext(dpy, ActiveMenu->w, ScreenContext, (caddr_t *) & Scr);
-
-	if (x < 0 || y < 0 ||
-	    x >= ActiveMenu->width || y >= ActiveMenu->height) {
-	    if (ActiveItem && ActiveItem->func != F_TITLE) {
-		ActiveItem->state = 0;
-		PaintEntry(ActiveMenu, ActiveItem, False);
-	    }
-	    ActiveItem = NULL;
-	    continue;
-	}
-	/* look for the entry that the mouse is in */
-	entry = y / Scr->EntryHeight;
-	for (i = 0, mi = ActiveMenu->first; mi != NULL; i++, mi = mi->next) {
-	    if (i == entry)
-		break;
-	}
-
-	/* if there is an active item, we might have to turn it off */
-	if (ActiveItem) {
-	    /* is the active item the one we are on ? */
-	    if (ActiveItem->item_num == entry && ActiveItem->state)
-		done = TRUE;
-
-	    /*
-	     * if we weren't on the active entry, let's turn the old active
-	     * one off
-	     */
-	    if (!done && ActiveItem->func != F_TITLE) {
-		ActiveItem->state = 0;
-		PaintEntry(ActiveMenu, ActiveItem, False);
-	    }
-	}
-	/*
-	 * if we weren't on the active item, change the active item and turn
-	 * it on
-	 */
-	if (!done) {
-	    ActiveItem = mi;
-	    if (ActiveItem->func != F_TITLE && !ActiveItem->state) {
-		ActiveItem->state = 1;
-		PaintEntry(ActiveMenu, ActiveItem, False);
-	    }
-	}
-	/* now check to see if we were over the arrow of a pull right entry */
-	if ((ActiveItem->func == F_MENU || ActiveItem->func == F_MENUFUNC) &&
-	    ((ActiveMenu->width - x) * 100 <
-	    (ActiveMenu->width * Scr->PopupSensitivity))) {
-	    MenuRoot       *save = ActiveMenu;
-	    int             savex = MenuOrigins[MenuDepth - 1].x;
-	    int             savey = MenuOrigins[MenuDepth - 1].y;
-	    if (MenuDepth < MAXMENUDEPTH) {
-		PopUpMenu(ActiveItem->sub,
-			  (savex + (int)(ActiveMenu->width
-					* (100-Scr->PopupSensitivity) / 100.0)),
-			  (savey + ActiveItem->item_num * Scr->EntryHeight)
-		/*
-		 * (savey + ActiveItem->item_num * Scr->EntryHeight +
-		 * (Scr->EntryHeight >> 1))
-			  */ , False);
-	    } else if (!badItem) {
-		XBell(dpy, 0);
-		badItem = ActiveItem;
-	    }
-	    /* if the menu did get popped up, unhighlight the active item */
-	    if (save != ActiveMenu && ActiveItem->state) {
-		ActiveItem->state = 0;
-		PaintEntry(save, ActiveItem, False);
-		ActiveItem = NULL;
-	    }
-	}
-	if (badItem != ActiveItem)
-	    badItem = NULL;
-	XFlush(dpy);
-    }
-}
-#endif
 
 
 
@@ -1205,7 +1074,7 @@
 
 
 
-MakeMenus()
+void MakeMenus(void)
 {
     MenuRoot *mr;
 
@@ -1220,7 +1089,7 @@
 
 
 
-MakeMenu(mr)
+void MakeMenu(mr)
 MenuRoot *mr;
 {
     MenuItem *start, *end, *cur, *tmp;
@@ -1472,10 +1341,11 @@
  *                                                                    *
  \********************************************************************/
 
+void
 HandleChangingMenus(menu)
 MenuRoot *menu;
 {
-    int WindowNameOffset, WindowNameCount;
+	int /*WindowNameOffset,*/ WindowNameCount;
     TwmWindow **WindowNames;
     TwmWindow *tmp_win2, *tmp_win3;
     TwmWindow **sortlist, *bakwin;
@@ -1524,8 +1394,8 @@
 		AddToMenu(menu,sortlist[loop]->name, (char *)sortlist[loop],
 			NULL, F_POPUP, NULLSTR, NULLSTR);
 	} else {
-	    WindowNameOffset=(char *)Scr->TwmRoot.next->name -
-				(char *)Scr->TwmRoot.next;
+/*	    WindowNameOffset=(char *)Scr->TwmRoot.next->name -
+	    (char *)Scr->TwmRoot.next;*/
 	    for(tmp_win = Scr->TwmRoot.next , WindowNameCount=0;
 		tmp_win != NULL;
 		tmp_win = tmp_win->next)
@@ -1665,7 +1535,7 @@
  ***********************************************************************
  */
 
-PopDownMenu()
+void PopDownMenu()
 {
     MenuRoot *tmp;
 
@@ -1770,19 +1640,19 @@
     Window w;
     TwmWindow *tmp_win;
 {
-  int lastx, lasty, width, height, bw2;
-  int namelen;
-  int stat;
+	int lastx, lasty, /*width, height,*/ bw2;
+/*  int namelen;
+  int stat;*/
   XEvent event;
-  Window junk;
+/*  Window junk;*/
 
-  namelen = strlen (tmp_win->name);
+/*  namelen = strlen (tmp_win->name);*/
   bw2 = tmp_win->frame_bw * 2;
   AddingW = tmp_win->attr.width + bw2;
   AddingH = tmp_win->attr.height + tmp_win->title_height + bw2;
-  width = (SIZE_HINDENT + XTextWidth (Scr->SizeFont.font,
+/*  width = (SIZE_HINDENT + XTextWidth (Scr->SizeFont.font,
 				      tmp_win->name, namelen));
-  height = Scr->SizeFont.height + SIZE_VINDENT * 2;
+				      height = Scr->SizeFont.height + SIZE_VINDENT * 2;*/
   XGetGeometry(dpy, w, &JunkRoot, &origDragX, &origDragY,
 	       (unsigned int *)&DragWidth, (unsigned int *)&DragHeight,
 	       &JunkBW, &JunkDepth);
@@ -1953,18 +1823,14 @@
     int context;
     int pulldown;
 {
-    static Time last_time = 0;
     short Real_OpaqueMove;                  /* holder for F_OPAQUEMOVE */
     char tmp[200];
     char *ptr;
     char buff[MAX_FILE_SIZE];
     int count, fd;
-    Window rootw;
-    int origX, origY;
+/*    Window rootw;*/
     int do_next_action = TRUE;
-    int moving_icon = FALSE;
     Bool fromtitlebar = False;
-    extern int ConstrainedMoveTime;
     struct MenuItem *item;
 
     RootFunction = 0;
@@ -2049,6 +1915,7 @@
     case F_SCROLLUP:
     case F_SCROLLDOWN:
     case F_SCROLLBACK:
+	FocusOnRoot();
 	ScrollDesktop(func, action);
 	break;
 
@@ -2092,8 +1959,6 @@
 	    return TRUE;
 
 	if (Scr->VirtualDesktop) {
-	    int x, y;
-
 	    if (tmp_win->sticky) {
 		if (Scr->StickyAbove) {
 		    XReparentWindow(dpy, tmp_win->frame, Scr->VirtualDesktop,
@@ -2300,7 +2165,7 @@
 	    return TRUE;
 
 	PopDownMenu();
-	rootw = eventp->xbutton.root;
+/*	rootw = eventp->xbutton.root;*/
 	MoveFunction = func;
 	if (MoveFunction == F_OPAQUEMOVE) {
 	    Real_OpaqueMove = Scr->OpaqueMove;
@@ -2313,11 +2178,11 @@
 
 	if (context == C_ICON && tmp_win->icon.w)
 	{
-	    DragIcon(tmp_win, eventp, pulldown);
+	    DragIcon(tmp_win, (XButtonEvent *) eventp, pulldown);
 	}
 	else if (w != tmp_win->icon.w)
 	{
-	    DragFrame(tmp_win, eventp, pulldown);
+	    DragFrame(tmp_win, (XButtonEvent *) eventp, pulldown);
 	}
 #ifdef OLD_MOVE
 	if (DeferExecution(context, func, action, Scr->MoveCursor))
@@ -3149,7 +3014,7 @@
  ***********************************************************************
  */
 
-ReGrab()
+void ReGrab(void)
 {
     XGrabPointer(dpy, Scr->Root, True,
 	ButtonPressMask | ButtonReleaseMask,
@@ -3171,6 +3036,7 @@
  ***********************************************************************
  */
 
+Bool
 Deferrable(func)
 int func;
 {
@@ -3205,7 +3071,7 @@
     }
 }
 
-NeedToDefer(root)
+Bool NeedToDefer(root)
 MenuRoot *root;
 {
     MenuItem *mitem;
@@ -3321,7 +3187,7 @@
     Scr->FocusRoot = TRUE;
 }
 
-DeIconify(tmp_win)
+void DeIconify(tmp_win)
 TwmWindow *tmp_win;
 {
     TwmWindow *t;
@@ -3396,7 +3262,7 @@
 
 
 
-Iconify(tmp_win, def_x, def_y)
+void Iconify(tmp_win, def_x, def_y)
 TwmWindow *tmp_win;
 int def_x, def_y;
 {
@@ -3603,7 +3469,7 @@
 
 
 
-SetMapStateProp(tmp_win, state)
+void SetMapStateProp(tmp_win, state)
 TwmWindow *tmp_win;
 int state;
 {
@@ -3647,7 +3513,7 @@
 
 
 
-WarpToScreen (n, inc)
+void WarpToScreen (n, inc)
     int n, inc;
 {
     Window dumwin;
@@ -3691,7 +3557,7 @@
  * BumpWindowColormap - rotate our internal copy of WM_COLORMAP_WINDOWS
  */
 
-BumpWindowColormap (tmp, inc)
+void BumpWindowColormap (tmp, inc)
     TwmWindow *tmp;
     int inc;
 {
@@ -3704,9 +3570,9 @@
 	cwins = (ColormapWindow **) malloc(sizeof(ColormapWindow *)*
 					   tmp->cmaps.number_cwins);
 	if (cwins) {
-	    if (previously_installed =
-		/* SUPPRESS 560 */(Scr->cmapInfo.cmaps == &tmp->cmaps &&
-		tmp->cmaps.number_cwins)) {
+	    if ((previously_installed =
+		(Scr->cmapInfo.cmaps == &tmp->cmaps &&
+		 tmp->cmaps.number_cwins))) {
 		for (i = tmp->cmaps.number_cwins; i-- > 0; )
 		    tmp->cmaps.cwins[i]->colormap->state = 0;
 	    }
@@ -3737,7 +3603,7 @@
 
 
 
-HideIconManager ()
+void HideIconManager ()
 {
     SetMapStateProp (Scr->iconmgr.twm_win, WithdrawnState);
     UnmapFrame(Scr->iconmgr.twm_win);
@@ -3749,7 +3615,7 @@
 
 
 
-SetBorder (tmp, onoroff)
+void SetBorder (tmp, onoroff)
     TwmWindow *tmp;
     Bool onoroff;
 {
@@ -3768,7 +3634,7 @@
 
 
 
-DestroyMenu (menu)
+void DestroyMenu (menu)
     MenuRoot *menu;
 {
     MenuItem *item;
@@ -3890,14 +3756,14 @@
     XSendEvent (dpy, w, False, 0L, (XEvent *) &ev);
 }
 
-SendDeleteWindowMessage (tmp, timestamp)
+void SendDeleteWindowMessage (tmp, timestamp)
     TwmWindow *tmp;
     Time timestamp;
 {
     send_clientmessage (tmp->w, _XA_WM_DELETE_WINDOW, timestamp);
 }
 
-SendSaveYourselfMessage (tmp, timestamp)
+void SendSaveYourselfMessage (tmp, timestamp)
     TwmWindow *tmp;
     Time timestamp;
 {
@@ -3905,7 +3771,7 @@
 }
 
 
-SendTakeFocusMessage (tmp, timestamp)
+void SendTakeFocusMessage (tmp, timestamp)
     TwmWindow *tmp;
     Time timestamp;
 {