From 6d25c8f74831937b8340b41d0d6bfe7ecc6dfc19 Mon Sep 17 00:00:00 2001 From: sabetts Date: Fri, 15 Dec 2000 09:52:38 +0000 Subject: (maximize): Adhere to the window's Size Hints --- src/actions.c | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/actions.c b/src/actions.c index b41aff3..c9e06a1 100644 --- a/src/actions.c +++ b/src/actions.c @@ -335,14 +335,34 @@ generate_prefix (void *data) void maximize (void *data) { + int maxx, maxy; rp_window *win = (rp_window *)data; if (!win) win = rp_current_window; if (!win) return; - XMoveResizeWindow (dpy, win->w, - PADDING_LEFT, - PADDING_TOP, - win->scr->root_attr.width - PADDING_LEFT - PADDING_RIGHT, - win->scr->root_attr.height - PADDING_TOP - PADDING_BOTTOM); + /* Honour the window's maximum size */ + if (win->hints->flags & PMaxSize) + { + maxx = win->hints->max_width; + maxy = win->hints->max_height; + } + else + { + maxx = win->scr->root_attr.width - PADDING_LEFT - PADDING_RIGHT; + maxy = win->scr->root_attr.height - PADDING_TOP - PADDING_BOTTOM; + } + + /* Make sure we maximize to the nearest Resize Increment specified + by the window */ + if (win->hints->flags & PResizeInc) + { + maxx -= maxx % win->hints->width_inc; + maxy -= maxy % win->hints->height_inc; + } + + PRINT_DEBUG ("maxsize: %d %d\n", maxx, maxy); + + XMoveResizeWindow (dpy, win->w, PADDING_LEFT, PADDING_TOP, maxx, maxy); + XSync (dpy, False); } -- cgit v1.2.3