diff options
| author | Anselm R. Garbe <arg@suckless.org> | 2007-01-14 22:27:29 +0100 |
|---|---|---|
| committer | Anselm R. Garbe <arg@suckless.org> | 2007-01-14 22:27:29 +0100 |
| commit | 6c5dc7017cff322b6402b3849c07529f5ab916fe (patch) | |
| tree | 61c780a0c3c53bae1ba2566ae7a70654478602ee /client.c | |
| parent | added missing space (diff) | |
| download | dwm-6c5dc7017cff322b6402b3849c07529f5ab916fe.tar.gz dwm-6c5dc7017cff322b6402b3849c07529f5ab916fe.zip | |
removed client title bar
Diffstat (limited to '')
| -rw-r--r-- | client.c | 50 |
1 files changed, 4 insertions, 46 deletions
| @@ -61,12 +61,6 @@ xerrordummy(Display *dsply, XErrorEvent *ee) { | |||
| 61 | /* extern functions */ | 61 | /* extern functions */ |
| 62 | 62 | ||
| 63 | void | 63 | void |
| 64 | ban(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 | |||
| 69 | void | ||
| 70 | configure(Client *c) { | 64 | configure(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 | ||
| 124 | Client * | ||
| 125 | getctitle(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 | |||
| 134 | void | 118 | void |
| 135 | killclient(Arg *arg) { | 119 | killclient(Arg *arg) { |
| 136 | if(!sel) | 120 | if(!sel) |
| @@ -145,17 +129,15 @@ void | |||
| 145 | manage(Window w, XWindowAttributes *wa) { | 129 | manage(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 | ||
| 245 | void | 217 | void |
| 246 | resizetitle(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 | |||
| 258 | void | ||
| 259 | updatesizehints(Client *c) { | 218 | updatesizehints(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); |
