diff options
| author | arg@10ksloc.org <unknown> | 2006-08-02 10:43:21 +0200 |
|---|---|---|
| committer | arg@10ksloc.org <unknown> | 2006-08-02 10:43:21 +0200 |
| commit | 52021851d1fd78970dfe63380d51b87f57d1ee1b (patch) | |
| tree | d920e56d105de51643bc58eb98b1649cef23a0de | |
| parent | renamed WM_PROTOCOL_DELWIN into PROTODELWIN (diff) | |
| download | dwm-52021851d1fd78970dfe63380d51b87f57d1ee1b.tar.gz dwm-52021851d1fd78970dfe63380d51b87f57d1ee1b.zip | |
new resize stuff (using XConfigureWindow instead of XSendEvent)
Diffstat (limited to '')
| -rw-r--r-- | client.c | 30 | ||||
| -rw-r--r-- | event.c | 23 |
2 files changed, 21 insertions, 32 deletions
| @@ -271,7 +271,7 @@ resize(Client *c, Bool sizehints, Corner sticky) | |||
| 271 | { | 271 | { |
| 272 | int bottom = c->y + c->h; | 272 | int bottom = c->y + c->h; |
| 273 | int right = c->x + c->w; | 273 | int right = c->x + c->w; |
| 274 | XConfigureEvent e; | 274 | XWindowChanges wc; |
| 275 | 275 | ||
| 276 | if(sizehints) { | 276 | if(sizehints) { |
| 277 | if(c->incw) | 277 | if(c->incw) |
| @@ -287,30 +287,22 @@ resize(Client *c, Bool sizehints, Corner sticky) | |||
| 287 | if(c->maxh && c->h > c->maxh) | 287 | if(c->maxh && c->h > c->maxh) |
| 288 | c->h = c->maxh; | 288 | c->h = c->maxh; |
| 289 | } | 289 | } |
| 290 | if(c->x > sw) /* might happen on restart */ | ||
| 291 | c->x = sw - c->w; | ||
| 292 | if(c->y > sh) | ||
| 293 | c->y = sh - c->h; | ||
| 294 | if(sticky == TopRight || sticky == BotRight) | 290 | if(sticky == TopRight || sticky == BotRight) |
| 295 | c->x = right - c->w; | 291 | c->x = right - c->w; |
| 296 | if(sticky == BotLeft || sticky == BotRight) | 292 | if(sticky == BotLeft || sticky == BotRight) |
| 297 | c->y = bottom - c->h; | 293 | c->y = bottom - c->h; |
| 298 | 294 | ||
| 299 | resizetitle(c); | 295 | resizetitle(c); |
| 300 | XSetWindowBorderWidth(dpy, c->win, 1); | 296 | |
| 301 | XMoveResizeWindow(dpy, c->win, c->x, c->y, c->w, c->h); | 297 | if(c->tags[tsel]) |
| 302 | 298 | wc.x = c->x; | |
| 303 | e.type = ConfigureNotify; | 299 | else |
| 304 | e.event = c->win; | 300 | wc.x = c->x + 2 * sw; |
| 305 | e.window = c->win; | 301 | wc.y = c->y; |
| 306 | e.x = c->x; | 302 | wc.width = c->w; |
| 307 | e.y = c->y; | 303 | wc.height = c->h; |
| 308 | e.width = c->w; | 304 | wc.border_width = 1; |
| 309 | e.height = c->h; | 305 | XConfigureWindow(dpy, c->win, CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc); |
| 310 | e.border_width = c->border; | ||
| 311 | e.above = None; | ||
| 312 | e.override_redirect = False; | ||
| 313 | XSendEvent(dpy, c->win, False, StructureNotifyMask, (XEvent *)&e); | ||
| 314 | XSync(dpy, False); | 306 | XSync(dpy, False); |
| 315 | } | 307 | } |
| 316 | 308 | ||
| @@ -153,7 +153,6 @@ configurerequest(XEvent *e) | |||
| 153 | XConfigureRequestEvent *ev = &e->xconfigurerequest; | 153 | XConfigureRequestEvent *ev = &e->xconfigurerequest; |
| 154 | XWindowChanges wc; | 154 | XWindowChanges wc; |
| 155 | 155 | ||
| 156 | ev->value_mask &= ~CWSibling; | ||
| 157 | if((c = getclient(ev->window))) { | 156 | if((c = getclient(ev->window))) { |
| 158 | gravitate(c, True); | 157 | gravitate(c, True); |
| 159 | if(ev->value_mask & CWX) | 158 | if(ev->value_mask & CWX) |
| @@ -169,18 +168,16 @@ configurerequest(XEvent *e) | |||
| 169 | gravitate(c, False); | 168 | gravitate(c, False); |
| 170 | resize(c, True, TopLeft); | 169 | resize(c, True, TopLeft); |
| 171 | } | 170 | } |
| 172 | 171 | else { | |
| 173 | wc.x = ev->x; | 172 | wc.x = ev->x; |
| 174 | wc.y = ev->y; | 173 | wc.y = ev->y; |
| 175 | wc.width = ev->width; | 174 | wc.width = ev->width; |
| 176 | wc.height = ev->height; | 175 | wc.height = ev->height; |
| 177 | wc.border_width = 1; | 176 | wc.border_width = 1; |
| 178 | wc.sibling = None; | 177 | XConfigureWindow(dpy, ev->window, |
| 179 | wc.stack_mode = Above; | 178 | CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc); |
| 180 | ev->value_mask &= ~CWStackMode; | 179 | XSync(dpy, False); |
| 181 | ev->value_mask |= CWBorderWidth; | 180 | } |
| 182 | XConfigureWindow(dpy, ev->window, ev->value_mask, &wc); | ||
| 183 | XSync(dpy, False); | ||
| 184 | } | 181 | } |
| 185 | 182 | ||
| 186 | static void | 183 | static void |
