aboutsummaryrefslogtreecommitdiff
path: root/window.c
diff options
context:
space:
mode:
authorBert <ber.t@gmx.com>2011-02-06 17:40:48 +0100
committerBert <ber.t@gmx.com>2011-02-06 17:40:48 +0100
commit603e664f7c9fc5cb228eef90fdaa501ac5dfa3bb (patch)
treeb33881b443d0c96e75a2a93d26497dcc5571db27 /window.c
parentcbf6aae721455a952ab0437bb62143ef8444cc93 (diff)
Nicer fit window to image
Diffstat (limited to 'window.c')
-rw-r--r--window.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/window.c b/window.c
index 2c8ea68..23146cd 100644
--- a/window.c
+++ b/window.c
@@ -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);