summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnselm R. Garbe <arg@suckless.org>2007-01-14 22:27:29 +0100
committerAnselm R. Garbe <arg@suckless.org>2007-01-14 22:27:29 +0100
commit6c5dc7017cff322b6402b3849c07529f5ab916fe (patch)
tree61c780a0c3c53bae1ba2566ae7a70654478602ee
parentadded missing space (diff)
downloaddwm-6c5dc7017cff322b6402b3849c07529f5ab916fe.tar.gz
dwm-6c5dc7017cff322b6402b3849c07529f5ab916fe.zip
removed client title bar
Diffstat (limited to '')
-rw-r--r--client.c50
-rw-r--r--draw.c6
-rw-r--r--dwm.11
-rw-r--r--dwm.h5
-rw-r--r--event.c7
-rw-r--r--view.c14
6 files changed, 10 insertions, 73 deletions
diff --git a/client.c b/client.c
index 8110263..af13797 100644
--- a/client.c
+++ b/client.c
@@ -61,12 +61,6 @@ xerrordummy(Display *dsply, XErrorEvent *ee) {
61/* extern functions */ 61/* extern functions */
62 62
63void 63void
64ban(Client *c) {
65 XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y);
66 XMoveWindow(dpy, c->twin, c->tx + 2 * sw, c->ty);
67}
68
69void
70configure(Client *c) { 64configure(Client *c) {
71 XEvent synev; 65 XEvent synev;
72 66
@@ -121,16 +115,6 @@ getclient(Window w) {
121 return NULL; 115 return NULL;
122} 116}
123 117
124Client *
125getctitle(Window w) {
126 Client *c;
127
128 for(c = clients; c; c = c->next)
129 if(c->twin == w)
130 return c;
131 return NULL;
132}
133
134void 118void
135killclient(Arg *arg) { 119killclient(Arg *arg) {
136 if(!sel) 120 if(!sel)
@@ -145,17 +129,15 @@ void
145manage(Window w, XWindowAttributes *wa) { 129manage(Window w, XWindowAttributes *wa) {
146 Client *c; 130 Client *c;
147 Window trans; 131 Window trans;
148 XSetWindowAttributes twa;
149 132
150 c = emallocz(sizeof(Client)); 133 c = emallocz(sizeof(Client));
151 c->tags = emallocz(ntags * sizeof(Bool)); 134 c->tags = emallocz(ntags * sizeof(Bool));
152 c->win = w; 135 c->win = w;
153 c->border = 0; 136 c->border = 0;
154 c->x = c->tx = wa->x; 137 c->x = wa->x;
155 c->y = c->ty = wa->y; 138 c->y = wa->y;
156 c->w = c->tw = wa->width; 139 c->w = wa->width;
157 c->h = wa->height; 140 c->h = wa->height;
158 c->th = bh;
159 updatesizehints(c); 141 updatesizehints(c);
160 if(c->x + c->w + 2 * BORDERPX > sw) 142 if(c->x + c->w + 2 * BORDERPX > sw)
161 c->x = sw - c->w - 2 * BORDERPX; 143 c->x = sw - c->w - 2 * BORDERPX;
@@ -169,27 +151,18 @@ manage(Window w, XWindowAttributes *wa) {
169 XSelectInput(dpy, c->win, 151 XSelectInput(dpy, c->win,
170 StructureNotifyMask | PropertyChangeMask | EnterWindowMask); 152 StructureNotifyMask | PropertyChangeMask | EnterWindowMask);
171 XGetTransientForHint(dpy, c->win, &trans); 153 XGetTransientForHint(dpy, c->win, &trans);
172 twa.override_redirect = 1;
173 twa.background_pixmap = ParentRelative;
174 twa.event_mask = ExposureMask | EnterWindowMask;
175 c->twin = XCreateWindow(dpy, root, c->tx, c->ty, c->tw, c->th,
176 0, DefaultDepth(dpy, screen), CopyFromParent,
177 DefaultVisual(dpy, screen),
178 CWOverrideRedirect | CWBackPixmap | CWEventMask, &twa);
179 grabbuttons(c, False); 154 grabbuttons(c, False);
180 updatetitle(c); 155 updatetitle(c);
181 settags(c, getclient(trans)); 156 settags(c, getclient(trans));
182 if(!c->isfloat) 157 if(!c->isfloat)
183 c->isfloat = trans || c->isfixed; 158 c->isfloat = trans || c->isfixed;
184 resizetitle(c);
185 if(clients) 159 if(clients)
186 clients->prev = c; 160 clients->prev = c;
187 c->next = clients; 161 c->next = clients;
188 c->snext = stack; 162 c->snext = stack;
189 stack = clients = c; 163 stack = clients = c;
190 ban(c); 164 XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y);
191 XMapWindow(dpy, c->win); 165 XMapWindow(dpy, c->win);
192 XMapWindow(dpy, c->twin);
193 if(isvisible(c)) 166 if(isvisible(c))
194 focus(c); 167 focus(c);
195 arrange(); 168 arrange();
@@ -228,7 +201,6 @@ resize(Client *c, Bool sizehints, Corner sticky) {
228 c->x = sw - c->w; 201 c->x = sw - c->w;
229 if(c->y > sh) 202 if(c->y > sh)
230 c->y = sh - c->h; 203 c->y = sh - c->h;
231 resizetitle(c);
232 wc.x = c->x; 204 wc.x = c->x;
233 wc.y = c->y; 205 wc.y = c->y;
234 wc.width = c->w; 206 wc.width = c->w;
@@ -243,19 +215,6 @@ resize(Client *c, Bool sizehints, Corner sticky) {
243} 215}
244 216
245void 217void
246resizetitle(Client *c) {
247 c->tw = textw(c->name);
248 if(c->tw > c->w)
249 c->tw = c->w + 2 * BORDERPX;
250 c->tx = c->x + c->w - c->tw + 2 * BORDERPX;
251 c->ty = c->y;
252 if(isvisible(c))
253 XMoveResizeWindow(dpy, c->twin, c->tx, c->ty, c->tw, c->th);
254 else
255 XMoveResizeWindow(dpy, c->twin, c->tx + 2 * sw, c->ty, c->tw, c->th);
256}
257
258void
259updatesizehints(Client *c) { 218updatesizehints(Client *c) {
260 long msize; 219 long msize;
261 XSizeHints size; 220 XSizeHints size;
@@ -331,7 +290,6 @@ unmanage(Client *c) {
331 focus(nc); 290 focus(nc);
332 } 291 }
333 XUngrabButton(dpy, AnyButton, AnyModifier, c->win); 292 XUngrabButton(dpy, AnyButton, AnyModifier, c->win);
334 XDestroyWindow(dpy, c->twin);
335 free(c->tags); 293 free(c->tags);
336 free(c); 294 free(c);
337 XSync(dpy, False); 295 XSync(dpy, False);
diff --git a/draw.c b/draw.c
index ba99ee0..0ee362c 100644
--- a/draw.c
+++ b/draw.c
@@ -141,16 +141,10 @@ void
141drawclient(Client *c) { 141drawclient(Client *c) {
142 if(c == sel && issel) { 142 if(c == sel && issel) {
143 drawstatus(); 143 drawstatus();
144 XUnmapWindow(dpy, c->twin);
145 XSetWindowBorder(dpy, c->win, dc.sel[ColBG]); 144 XSetWindowBorder(dpy, c->win, dc.sel[ColBG]);
146 return; 145 return;
147 } 146 }
148 XSetWindowBorder(dpy, c->win, dc.norm[ColBG]); 147 XSetWindowBorder(dpy, c->win, dc.norm[ColBG]);
149 XMapWindow(dpy, c->twin);
150 dc.x = dc.y = 0;
151 dc.w = c->tw;
152 drawtext(c->name, dc.norm, False, False);
153 XCopyArea(dpy, dc.drawable, c->twin, dc.gc, 0, 0, c->tw, c->th, 0, 0);
154 XSync(dpy, False); 148 XSync(dpy, False);
155} 149}
156 150
diff --git a/dwm.1 b/dwm.1
index e7a5a44..5783e07 100644
--- a/dwm.1
+++ b/dwm.1
@@ -26,7 +26,6 @@ which are applied to one or more windows are indicated with an empty square in
26the top left corner. 26the top left corner.
27.P 27.P
28dwm draws a 1-pixel border around windows to indicate the focus state. 28dwm draws a 1-pixel border around windows to indicate the focus state.
29Unfocused windows contain a small bar in front of them displaying their title.
30.SH OPTIONS 29.SH OPTIONS
31.TP 30.TP
32.B \-v 31.B \-v
diff --git a/dwm.h b/dwm.h
index 6a26e07..0cdfad2 100644
--- a/dwm.h
+++ b/dwm.h
@@ -78,7 +78,6 @@ struct Client {
78 int proto; 78 int proto;
79 int x, y, w, h; 79 int x, y, w, h;
80 int rx, ry, rw, rh; /* revert geometry */ 80 int rx, ry, rw, rh; /* revert geometry */
81 int tx, ty, tw, th; /* title window geometry */
82 int basew, baseh, incw, inch, maxw, maxh, minw, minh; 81 int basew, baseh, incw, inch, maxw, maxh, minw, minh;
83 long flags; 82 long flags;
84 unsigned int border; 83 unsigned int border;
@@ -88,7 +87,6 @@ struct Client {
88 Client *prev; 87 Client *prev;
89 Client *snext; 88 Client *snext;
90 Window win; 89 Window win;
91 Window twin;
92}; 90};
93 91
94extern const char *tags[]; /* all tags */ 92extern const char *tags[]; /* all tags */
@@ -110,15 +108,12 @@ extern Display *dpy;
110extern Window root, barwin; 108extern Window root, barwin;
111 109
112/* client.c */ 110/* client.c */
113extern void ban(Client *c); /* ban c from screen */
114extern void configure(Client *c); /* send synthetic configure event */ 111extern void configure(Client *c); /* send synthetic configure event */
115extern void focus(Client *c); /* focus c, c may be NULL */ 112extern void focus(Client *c); /* focus c, c may be NULL */
116extern Client *getclient(Window w); /* return client of w */ 113extern Client *getclient(Window w); /* return client of w */
117extern Client *getctitle(Window w); /* return client of title window */
118extern void killclient(Arg *arg); /* kill c nicely */ 114extern void killclient(Arg *arg); /* kill c nicely */
119extern void manage(Window w, XWindowAttributes *wa); /* manage new client */ 115extern void manage(Window w, XWindowAttributes *wa); /* manage new client */
120extern void resize(Client *c, Bool sizehints, Corner sticky); /* resize c*/ 116extern void resize(Client *c, Bool sizehints, Corner sticky); /* resize c*/
121extern void resizetitle(Client *c); /* resizes c->twin correctly */
122extern void updatesizehints(Client *c); /* update the size hint variables of c */ 117extern void updatesizehints(Client *c); /* update the size hint variables of c */
123extern void updatetitle(Client *c); /* update the name of c */ 118extern void updatetitle(Client *c); /* update the name of c */
124extern void unmanage(Client *c); /* destroy c */ 119extern void unmanage(Client *c); /* destroy c */
diff --git a/event.c b/event.c
index 2deef14..a9d2fbb 100644
--- a/event.c
+++ b/event.c
@@ -196,7 +196,7 @@ configurerequest(XEvent *e) {
196 if(c->isfloat) { 196 if(c->isfloat) {
197 resize(c, False, TopLeft); 197 resize(c, False, TopLeft);
198 if(!isvisible(c)) 198 if(!isvisible(c))
199 ban(c); 199 XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y);
200 } 200 }
201 else 201 else
202 arrange(); 202 arrange();
@@ -230,7 +230,7 @@ enternotify(XEvent *e) {
230 230
231 if(ev->mode != NotifyNormal || ev->detail == NotifyInferior) 231 if(ev->mode != NotifyNormal || ev->detail == NotifyInferior)
232 return; 232 return;
233 if(((c = getclient(ev->window)) || (c = getctitle(ev->window))) && isvisible(c)) 233 if((c = getclient(ev->window)) && isvisible(c))
234 focus(c); 234 focus(c);
235 else if(ev->window == root) { 235 else if(ev->window == root) {
236 issel = True; 236 issel = True;
@@ -247,8 +247,6 @@ expose(XEvent *e) {
247 if(ev->count == 0) { 247 if(ev->count == 0) {
248 if(barwin == ev->window) 248 if(barwin == ev->window)
249 drawstatus(); 249 drawstatus();
250 else if((c = getctitle(ev->window)))
251 drawclient(c);
252 } 250 }
253} 251}
254 252
@@ -331,7 +329,6 @@ propertynotify(XEvent *e) {
331 } 329 }
332 if(ev->atom == XA_WM_NAME || ev->atom == netatom[NetWMName]) { 330 if(ev->atom == XA_WM_NAME || ev->atom == netatom[NetWMName]) {
333 updatetitle(c); 331 updatetitle(c);
334 resizetitle(c);
335 drawclient(c); 332 drawclient(c);
336 } 333 }
337 } 334 }
diff --git a/view.c b/view.c
index 4e2ffb3..b8dd79a 100644
--- a/view.c
+++ b/view.c
@@ -59,7 +59,7 @@ dofloat(void) {
59 resize(c, True, TopLeft); 59 resize(c, True, TopLeft);
60 } 60 }
61 else 61 else
62 ban(c); 62 XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y);
63 } 63 }
64 if(!sel || !isvisible(sel)) { 64 if(!sel || !isvisible(sel)) {
65 for(c = stack; c && !isvisible(c); c = c->snext); 65 for(c = stack; c && !isvisible(c); c = c->snext);
@@ -109,8 +109,7 @@ dotile(void) {
109 i++; 109 i++;
110 } 110 }
111 else 111 else
112 ban(c); 112 XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y);
113
114 if(!sel || !isvisible(sel)) { 113 if(!sel || !isvisible(sel)) {
115 for(c = stack; c && !isvisible(c); c = c->snext); 114 for(c = stack; c && !isvisible(c); c = c->snext);
116 focus(c); 115 focus(c);
@@ -191,19 +190,14 @@ restack(void) {
191 drawstatus(); 190 drawstatus();
192 return; 191 return;
193 } 192 }
194 if(sel->isfloat || arrange == dofloat) { 193 if(sel->isfloat || arrange == dofloat)
195 XRaiseWindow(dpy, sel->win); 194 XRaiseWindow(dpy, sel->win);
196 XRaiseWindow(dpy, sel->twin);
197 }
198 if(arrange != dofloat) { 195 if(arrange != dofloat) {
199 if(!sel->isfloat) { 196 if(!sel->isfloat)
200 XLowerWindow(dpy, sel->twin);
201 XLowerWindow(dpy, sel->win); 197 XLowerWindow(dpy, sel->win);
202 }
203 for(c = nexttiled(clients); c; c = nexttiled(c->next)) { 198 for(c = nexttiled(clients); c; c = nexttiled(c->next)) {
204 if(c == sel) 199 if(c == sel)
205 continue; 200 continue;
206 XLowerWindow(dpy, c->twin);
207 XLowerWindow(dpy, c->win); 201 XLowerWindow(dpy, c->win);
208 } 202 }
209 } 203 }