diff options
author | Bert <ber.t@gmx.com> | 2011-02-06 17:40:48 +0100 |
---|---|---|
committer | Bert <ber.t@gmx.com> | 2011-02-06 17:40:48 +0100 |
commit | 603e664f7c9fc5cb228eef90fdaa501ac5dfa3bb (patch) | |
tree | b33881b443d0c96e75a2a93d26497dcc5571db27 /window.c | |
parent | cbf6aae721455a952ab0437bb62143ef8444cc93 (diff) |
Nicer fit window to image
Diffstat (limited to 'window.c')
-rw-r--r-- | window.c | 13 |
1 files changed, 6 insertions, 7 deletions
@@ -157,24 +157,23 @@ int win_configure(win_t *win, XConfigureEvent *c) { return changed; } -int win_resize(win_t *win, unsigned int w, unsigned int h) { +int win_moveresize(win_t *win, int x, int y, unsigned int w, unsigned int h) { if (!win) return 0; + x = MAX(0, x); + y = MAX(0, y); w = MIN(w, win->env.scrw - 2 * win->bw); h = MIN(h, win->env.scrh - 2 * win->bw); - if (win->w == w && win->h == h) + if (win->x == x && win->y == y && win->w == w && win->h == h) return 0; + win->x = x; + win->y = y; win->w = w; win->h = h; - if (win->x + w + 2 * win->bw > win->env.scrw) - win->x = win->env.scrw - w - 2 * win->bw; - if (win->y + h + 2 * win->bw > win->env.scrh) - win->y = win->env.scrh - h - 2 * win->bw; - if (options->fixed) win_set_sizehints(win); |