[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RP] Centering non maximized windows
From: |
Ryan Yeske |
Subject: |
[RP] Centering non maximized windows |
Date: |
04 Feb 2001 18:16:36 -0800 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.0.97 |
I made a simple modification to actions.c to centre windows that send
a max size hint that results in them not being maximized. Looks a
little cleaner to me for things like ssh-askpass and other "pop-ups"
come up in the center of the screen rather than in the upper left.
Do you all think this is a good idea? Can you see if this change will
break things? Just wanted to get some feedback on it before I commit.
Ryan
--
Are we THERE yet? My MIND is a SUBMARINE!!
Index: src/actions.c
===================================================================
RCS file: /cvsroot/ratpoison/ratpoison/src/actions.c,v
retrieving revision 1.14
diff -c -r1.14 actions.c
*** src/actions.c 2001/02/04 23:51:42 1.14
--- src/actions.c 2001/02/05 02:11:27
***************
*** 382,387 ****
--- 382,391 ----
maximize (void *data)
{
int maxx, maxy;
+
+ int off_x = 0;
+ int off_y = 0;
+
rp_window *win = (rp_window *)data;
if (!win) win = rp_current_window;
***************
*** 392,397 ****
--- 396,405 ----
{
maxx = win->hints->max_width;
maxy = win->hints->max_height;
+
+ /* centre the non-maximized window */
+ off_x = ((win->scr->root_attr.width - PADDING_LEFT - PADDING_RIGHT) -
win->hints->max_width) / 2;
+ off_y = ((win->scr->root_attr.height - PADDING_TOP - PADDING_BOTTOM) -
win->hints->max_height) / 2;
}
else
{
***************
*** 418,423 ****
PRINT_DEBUG ("maxsize: %d %d\n", maxx, maxy);
! XMoveResizeWindow (dpy, win->w, PADDING_LEFT, PADDING_TOP, maxx, maxy);
XSync (dpy, False);
}
--- 426,431 ----
PRINT_DEBUG ("maxsize: %d %d\n", maxx, maxy);
! XMoveResizeWindow (dpy, win->w, PADDING_LEFT + off_x, PADDING_TOP + off_y,
maxx, maxy);
XSync (dpy, False);
}
- [RP] Centering non maximized windows,
Ryan Yeske <=