Fix various placement issue with titlebar
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
850145f994
commit
a42d43a853
21
client.c
21
client.c
|
@ -422,8 +422,23 @@ client_manage(Window w, XWindowAttributes *wa, int screen)
|
||||||
client_setfloating(c, rettrans || c->isfixed);
|
client_setfloating(c, rettrans || c->isfixed);
|
||||||
|
|
||||||
if(!(flags & (USPosition | PPosition)))
|
if(!(flags & (USPosition | PPosition)))
|
||||||
c->f_geometry =
|
{
|
||||||
globalconf.screens[c->screen].floating_placement(c->f_geometry, c->border, c->screen);
|
c->f_geometry = globalconf.screens[c->screen].floating_placement(c->f_geometry,
|
||||||
|
c->border,
|
||||||
|
c->screen);
|
||||||
|
/* remove effects of the titlebar */
|
||||||
|
switch(c->titlebar.position)
|
||||||
|
{
|
||||||
|
case Top:
|
||||||
|
c->f_geometry.y += c->titlebar.sw->geometry.height;
|
||||||
|
break;
|
||||||
|
case Left:
|
||||||
|
c->f_geometry.x += c->titlebar.sw->geometry.width;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
XSelectInput(globalconf.display, w, StructureNotifyMask | PropertyChangeMask | EnterWindowMask);
|
XSelectInput(globalconf.display, w, StructureNotifyMask | PropertyChangeMask | EnterWindowMask);
|
||||||
|
|
||||||
|
@ -567,7 +582,7 @@ client_resize(Client *c, area_t geometry, Bool hints)
|
||||||
{
|
{
|
||||||
if(!c->ismax)
|
if(!c->ismax)
|
||||||
c->f_geometry = geometry;
|
c->f_geometry = geometry;
|
||||||
titlebar_update_geometry_floating(c);
|
titlebar_update_geometry_floating(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
XConfigureWindow(globalconf.display, c->win,
|
XConfigureWindow(globalconf.display, c->win,
|
||||||
|
|
30
placement.c
30
placement.c
|
@ -55,6 +55,35 @@ placement_fix_offscreen(area_t geometry, int screen, int border)
|
||||||
return newgeometry;
|
return newgeometry;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static area_t
|
||||||
|
placement_geometry_add_titlebar(Titlebar *t, area_t geometry)
|
||||||
|
{
|
||||||
|
if(!t->sw)
|
||||||
|
return geometry;
|
||||||
|
|
||||||
|
switch(t->position)
|
||||||
|
{
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
case Top:
|
||||||
|
geometry.y -= t->sw->geometry.height;
|
||||||
|
geometry.height += t->sw->geometry.height;
|
||||||
|
break;
|
||||||
|
case Bottom:
|
||||||
|
geometry.y += t->sw->geometry.height;
|
||||||
|
break;
|
||||||
|
case Left:
|
||||||
|
geometry.x -= t->sw->geometry.width;
|
||||||
|
geometry.width += t->sw->geometry.width;
|
||||||
|
break;
|
||||||
|
case Right:
|
||||||
|
geometry.width += t->sw->geometry.width;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return geometry;
|
||||||
|
}
|
||||||
|
|
||||||
/** Compute smart coordinates for a client window
|
/** Compute smart coordinates for a client window
|
||||||
* \param geometry current/requested client geometry
|
* \param geometry current/requested client geometry
|
||||||
* \param screen screen used
|
* \param screen screen used
|
||||||
|
@ -82,6 +111,7 @@ placement_smart(area_t geometry, int border, int screen)
|
||||||
newgeometry = c->f_geometry;
|
newgeometry = c->f_geometry;
|
||||||
newgeometry.width += 2 * c->border;
|
newgeometry.width += 2 * c->border;
|
||||||
newgeometry.height += 2 * c->border;
|
newgeometry.height += 2 * c->border;
|
||||||
|
newgeometry = placement_geometry_add_titlebar(&c->titlebar, newgeometry);
|
||||||
area_list_remove(&arealist, &newgeometry);
|
area_list_remove(&arealist, &newgeometry);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue