summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsabetts <sabetts>2000-12-15 09:52:38 +0000
committersabetts <sabetts>2000-12-15 09:52:38 +0000
commit6d25c8f74831937b8340b41d0d6bfe7ecc6dfc19 (patch)
tree1a191fe6d5f78e758421a76ccb9247904e471dff
parentc814e891b0e52cd588d2644374d72895ffb2d46b (diff)
downloadratpoison-6d25c8f74831937b8340b41d0d6bfe7ecc6dfc19.zip
(maximize): Adhere to the window's Size Hints
-rw-r--r--src/actions.c30
1 files changed, 25 insertions, 5 deletions
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);
}