From 34ff44c63314fd19785a63c2cdea37c577875d2a Mon Sep 17 00:00:00 2001 From: sabetts Date: Wed, 14 Mar 2001 07:35:14 +0000 Subject: * src/conf.h: replaced the silly c++ style comment around HIDE_MOUSE with a REAL comment. * src/manage.c (update_window_information): updates the window's border width. * src/conf.h (WINDOW_BORDER_WIDTH): new constant * src/manage.c (maximize_normal): Set the border width to WINDOW_BORDER_WIDTH. takes the border width into account when calculating the position, width, and height. (maximize_transient): likewise (maximize): calls XSetWindowBorderWidth to set the window's border width. (force_maximize): likewise --- src/manage.c | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) (limited to 'src/manage.c') diff --git a/src/manage.c b/src/manage.c index 07569d8..9980f93 100644 --- a/src/manage.c +++ b/src/manage.c @@ -175,8 +175,6 @@ update_window_information (rp_window *win) { XWindowAttributes attr; - PRINT_DEBUG ("managing new window\n"); - update_window_name (win); /* Get the WM Hints */ @@ -189,6 +187,7 @@ update_window_information (rp_window *win) win->y = attr.y; win->width = attr.width; win->height = attr.height; + win->border = attr.border_width; } void @@ -294,6 +293,9 @@ maximize_transient (rp_window *win) { int maxx, maxy; + /* Set the window's border */ + win->border = WINDOW_BORDER_WIDTH; + /* Honour the window's maximum size */ if (win->hints->flags & PMaxSize) { @@ -327,8 +329,10 @@ maximize_transient (rp_window *win) PRINT_DEBUG ("maxsize: %d %d\n", maxx, maxy); - win->x = PADDING_LEFT - win->width / 2 + (win->scr->root_attr.width - PADDING_LEFT - PADDING_RIGHT) / 2;; - win->y = PADDING_TOP - win->height / 2 + (win->scr->root_attr.height - PADDING_TOP - PADDING_BOTTOM) / 2;; + win->x = PADDING_LEFT - win->width / 2 + + (win->scr->root_attr.width - PADDING_LEFT - PADDING_RIGHT - win->border * 2) / 2; + win->y = PADDING_TOP - win->height / 2 + + (win->scr->root_attr.height - PADDING_TOP - PADDING_BOTTOM - win->border * 2) / 2; win->width = maxx; win->height = maxy; } @@ -343,6 +347,9 @@ maximize_normal (rp_window *win) int off_x = 0; int off_y = 0; + /* Set the window's border */ + win->border = WINDOW_BORDER_WIDTH; + /* Honour the window's maximum size */ if (win->hints->flags & PMaxSize) { @@ -355,8 +362,10 @@ maximize_normal (rp_window *win) } else { - maxx = win->scr->root_attr.width - PADDING_LEFT - PADDING_RIGHT; - maxy = win->scr->root_attr.height - PADDING_TOP - PADDING_BOTTOM; + maxx = win->scr->root_attr.width + - PADDING_LEFT - PADDING_RIGHT - win->border * 2; + maxy = win->scr->root_attr.height + - PADDING_TOP - PADDING_BOTTOM - win->border * 2; /* Make sure we maximize to the nearest Resize Increment specified by the window */ @@ -406,7 +415,7 @@ maximize (rp_window *win) /* Actually do the maximizing */ XMoveResizeWindow (dpy, win->w, win->x, win->y, win->width, win->height); - + XSetWindowBorderWidth (dpy, win->w, win->border); XSync (dpy, False); } @@ -423,7 +432,7 @@ force_maximize (rp_window *win) /* Actually do the maximizing */ XMoveResizeWindow (dpy, win->w, win->x, win->y, win->width+1, win->height+1); XMoveResizeWindow (dpy, win->w, win->x, win->y, win->width, win->height); - + XSetWindowBorderWidth (dpy, win->w, win->border); XSync (dpy, False); } -- cgit v1.2.3