mirror of https://github.com/0intro/wmii
Prevent floating windows from appearing off screen or covering the bar.
This commit is contained in:
parent
f22d6445dd
commit
207aac30fe
|
@ -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,
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue