summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsabetts <sabetts>2001-03-14 07:35:14 +0000
committersabetts <sabetts>2001-03-14 07:35:14 +0000
commit34ff44c63314fd19785a63c2cdea37c577875d2a (patch)
tree7eac0ec3a21be25e964c11f01397cbbc877469d2 /src
parent63e226ae9eec6ca3cdaa5bfdc530d51121594a93 (diff)
downloadratpoison-34ff44c63314fd19785a63c2cdea37c577875d2a.zip
* 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
Diffstat (limited to 'src')
-rw-r--r--src/conf.h5
-rw-r--r--src/manage.c25
2 files changed, 21 insertions, 9 deletions
diff --git a/src/conf.h b/src/conf.h
index 068c394..e87d1cb 100644
--- a/src/conf.h
+++ b/src/conf.h
@@ -34,9 +34,12 @@
/* The minimum size of the input window */
#define INPUT_WINDOW_SIZE 200
+/* The border width ratpoison configures all windows with */
+#define WINDOW_BORDER_WIDTH 0
+
/* Pressing a key sends the mouse to the bottom right corner. This
doesn't work very well yet. */
-//#define HIDE_MOUSE
+/* #define HIDE_MOUSE */
#define FOREGROUND "black"
#define BACKGROUND "white"
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);
}