File: CLOSE_PATCH.txt

package info (click to toggle)
lwm 1.01-3
  • links: PTS
  • area: main
  • in suites: woody
  • size: 228 kB
  • ctags: 592
  • sloc: ansic: 1,884; makefile: 495; sh: 6; tcl: 6
file content (179 lines) | stat: -rw-r--r-- 4,894 bytes parent folder | download | duplicates (2)
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
Subject: patch for close box
From: "AMidthune"<amidthune@wnjrhs.org>
To: <elliot.hughes@genedata.com>

--simple boundary
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit

     Here's a patch that fulfills one of the lines in your TODO file. It 
     fixes the close box so it only works when you click AND release in the 
     box... it's a bit of a kluge but it works with all the tests I've 
     given it.
        I'm sure there's a more elegant way to do it, but I couldn't think 
     of anything else ;-)
        As for the other line in TODO, I'm against it since the frame takes 
     different actions depending on the mouse button you use (except in the 
     box... maybe the pirate bitmap there?)
     
     Cheers,
                Andy
     
     P.S. "mv close_pa.dif lwm/; cd lwm; patch -Np1 < close_pa.dif"



--simple boundary
Content-Type: text/plain; charset=US-ASCII; name="close_pa.dif"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="close_pa.dif"

diff -Naur lwm/CHANGES lwm.new/CHANGES
--- lwm/CHANGES	Mon Jul 19 11:16:09 1999
+++ lwm.new/CHANGES	Thu Jul  8 10:47:22 1999
@@ -1,10 +1,5 @@
 Change Log for "lwm"
 
-1999-07-19	enh	Basel
-
-	Added a handler for circulation events so that other programs
-	can offer "Alt-Tab" functionality.
-
 1999-07-08	enh	Basel
 
 	Fixed the cosmetic problem with titlebars of dialogue boxes. If
diff -Naur lwm/client.c lwm.new/client.c
--- lwm/client.c	Thu Jun 17 07:03:16 1999
+++ lwm.new/client.c	Sun Jul 25 23:05:12 1999
@@ -115,6 +115,7 @@
 	c->wmcmaps = 0;
 	c->accepts_focus = 1;
 	c->next = clients;
+        c->close_pending = False;
 
 	/* Add to head of list of clients. */
 	return (clients = c);
@@ -385,6 +386,13 @@
 	}
 }
 
+void
+Client_Close_Pend(Client *c) {
+        if (c == 0)
+                return;
+        c->close_pending = True;
+}
+       
 void
 Client_SetState(Client *c, int state) {
 	long	data[2];
diff -Naur lwm/disp.c lwm.new/disp.c
--- lwm/disp.c	Mon Jul 19 11:09:12 1999
+++ lwm.new/disp.c	Sun Jul 25 23:14:18 1999
@@ -31,7 +31,6 @@
 static void property(XEvent *);
 static void reparent(XEvent *);
 static void enter(XEvent *);
-static void circulaterequest(XEvent *);
 static void motionnotify(XEvent *);
 
 void reshaping_motionnotify(XEvent *);
@@ -51,7 +50,7 @@
 	{PropertyNotify, property},
 	{ReparentNotify, reparent},
 	{EnterNotify, enter},
-	{CirculateRequest, circulaterequest},
+	{CirculateRequest, 0},
 	{ConfigureNotify, 0},
 	{CreateNotify, 0},
 	{GravityNotify, 0},
@@ -126,7 +125,7 @@
 		/* The ``box''. */
 		quarter = (border + titleHeight()) / 4;
 		if (e->x > (quarter + 2) && e->x < (3 + 3*quarter) && e->y > quarter && e->y <= 3*quarter) {
-			Client_Close(c);
+			Client_Close_Pend(c);
 			return;
 		}
 
@@ -192,24 +191,26 @@
 
 static void
 buttonrelease(XEvent *ev) {
-	if (mode == wm_menu_up)
+        int quarter;
+	XButtonEvent *e = &ev->xbutton;
+	Client * c;
+	
+        c = Client_Get(e->window);
+        
+        if (mode == wm_menu_up)
 		menu_buttonrelease(ev);
 	else if (mode == wm_reshaping)
 		XUnmapWindow(dpy, current_screen->popup);
-	
+        else if ((e->window == c->parent) && c->close_pending) {
+		/* The ``box''. */
+		quarter = (border + titleHeight()) / 4;
+		if (e->x > (quarter + 2) && e->x < (3 + 3*quarter) && e->y > quarter && e->y <= 3*quarter) {
+			Client_Close(c);
+		}
+        }
 	mode = wm_idle;
 }
 
-static void circulaterequest(XEvent *ev) {
-	XCirculateRequestEvent * e = &ev->xcirculaterequest;
-	
-	if (e->place == PlaceOnTop) {
-		XRaiseWindow(e->display, e->window);
-	} else {
-		XLowerWindow(e->display, e->window);
-	}
-}
-
 static void
 maprequest(XEvent *ev) {
 	Client * c;
@@ -448,8 +449,10 @@
 
 	if (c != current && !c->hidden) {
 		/* Take focus away from current holder. */
-		if (current)
+		if (current) {
+                        current->close_pending = False;
 			setactive(current, 0, 0L);
+                }
 
 		/* Give focus to new holder. */
 		current = c;
diff -Naur lwm/lwm.h lwm.new/lwm.h
--- lwm/lwm.h	Tue Jun 22 04:15:08 1999
+++ lwm.new/lwm.h	Sun Jul 25 23:04:08 1999
@@ -88,6 +88,7 @@
 	int state;				/* Window state. See ICCCM and <X11/Xutil.h> */
 
 	Bool hidden;			/* True if this client is hidden. */
+        Bool close_pending;
 	IState internal_state;
 	int proto;
 
@@ -150,6 +151,7 @@
 
 /*	client.c */
 extern Edge interacting_edge;
+extern Bool close_pending;
 extern Client *Client_Get(Window);
 extern Client *Client_Add(Window, Window);
 extern void Client_MakeSane(Client *, Edge, int *, int *, int *, int *);
@@ -162,6 +164,7 @@
 extern void Client_SetState(Client *, int);
 extern void Client_Back(Client *);
 extern void Client_Close(Client *);
+extern void Client_Close_Pend(Client *);
 extern void Client_Remove(Client *);
 extern void Client_FreeAll(void);
 extern void Client_ColourMap(XEvent*);


--simple boundary--