Prevent floating windows from appearing off screen or covering the bar.

This commit is contained in:
Kris Maglione 2006-06-30 20:16:49 -04:00
parent f22d6445dd
commit 207aac30fe
2 changed files with 22 additions and 7 deletions

View File

@ -516,6 +516,7 @@ resize_client(Client *c, XRectangle *r, Bool ignore_xcall)
{
Frame *f = c->sel;
Bool floating = f->area->floating;
unsigned int max_height;
BlitzAlign stickycorner = 0;
if(f->rect.x != r->x && f->rect.x + f->rect.width == r->x + r->width)
@ -532,13 +533,27 @@ resize_client(Client *c, XRectangle *r, Bool ignore_xcall)
if((f->area->mode != Colstack) || (f->area->sel == f))
match_sizehints(c, &c->sel->rect, floating, stickycorner);
max_height = screen->rect.height - height_of_bar();
if(!ignore_xcall) {
if(floating &&
(c->rect.width >= screen->rect.width) &&
(c->rect.height >= screen->rect.height))
{
f->rect.x = -def.border;
f->rect.y = -height_of_bar();
if(floating) {
if((c->rect.width == screen->rect.width) &&
(c->rect.height == screen->rect.height)) {
f->rect.x = -def.border;
f->rect.y = -height_of_bar();
}else{
if(f->rect.height > max_height)
f->rect.height = max_height;
if(f->rect.width > screen->rect.width)
f->rect.width = screen->rect.width;
if(f->rect.x + f->rect.width > screen->rect.width)
f->rect.x = screen->rect.width - f->rect.width;
if(f->rect.y + f->rect.height > max_height)
f->rect.y = max_height - f->rect.height;
if(f->rect.x < 0)
f->rect.x = 0;
if(f->rect.y < 0)
f->rect.y = 0;
}
}
if(f->area->view == screen->sel)
XMoveResizeWindow(blz.display, c->framewin, f->rect.x,

View File

@ -296,7 +296,7 @@ view_index(View *v) {
len = BUFFER_SIZE;
buf_i = 0;
for((a = v->area), (a_i = 0); a; (a=a->next), (a_i++)) {
for((a = v->area), (a_i = 0); a && len > 0; (a=a->next), (a_i++)) {
if(a->floating)
n = snprintf(&buffer[buf_i], len, "# ~ %d %d\n",
a->rect.width, a->rect.height);