titlebar: set above client edge border

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2008-06-18 17:05:10 +02:00
parent c7fc344cd3
commit 694f97e4d7
5 changed files with 29 additions and 27 deletions

View File

@ -477,7 +477,7 @@ client_resize(client_t *c, area_t geometry, bool hints)
uint32_t values[5];
if(c->titlebar && !c->ismoving && !c->isfloating && layout != layout_floating)
geometry = titlebar_geometry_remove(c->titlebar, geometry);
geometry = titlebar_geometry_remove(c->titlebar, c->border, geometry);
if(hints)
geometry = client_geometry_hints(c, geometry);

View File

@ -134,7 +134,7 @@ mouse_snapclient(client_t *c, area_t geometry, int snap)
globalconf.screens[c->screen].statusbar,
&globalconf.screens[c->screen].padding);
geometry = titlebar_geometry_add(c->titlebar, geometry);
geometry = titlebar_geometry_add(c->titlebar, c->border, geometry);
geometry.width += 2 * c->border;
geometry.height += 2 * c->border;
@ -147,7 +147,7 @@ mouse_snapclient(client_t *c, area_t geometry, int snap)
snapper_geometry = snapper->geometry;
snapper_geometry.width += 2 * c->border;
snapper_geometry.height += 2 * c->border;
snapper_geometry = titlebar_geometry_add(c->titlebar, snapper_geometry);
snapper_geometry = titlebar_geometry_add(c->titlebar, c->border, snapper_geometry);
geometry =
mouse_snapclienttogeometry_outside(geometry,
snapper_geometry,
@ -156,7 +156,7 @@ mouse_snapclient(client_t *c, area_t geometry, int snap)
geometry.width -= 2 * c->border;
geometry.height -= 2 * c->border;
return titlebar_geometry_remove(c->titlebar, geometry);
return titlebar_geometry_remove(c->titlebar, c->border, geometry);
}
/** Set coordinates to a corner of an area.

View File

@ -90,7 +90,7 @@ placement_smart(client_t *c)
newgeometry = client->f_geometry;
newgeometry.width += 2 * client->border;
newgeometry.height += 2 * client->border;
newgeometry = titlebar_geometry_add(c->titlebar, newgeometry);
newgeometry = titlebar_geometry_add(c->titlebar, c->border, newgeometry);
area_list_remove(&arealist, &newgeometry);
}
@ -118,9 +118,9 @@ placement_smart(client_t *c)
newgeometry.width = c->f_geometry.width;
newgeometry.height = c->f_geometry.height;
newgeometry = titlebar_geometry_add(c->titlebar, newgeometry);
newgeometry = titlebar_geometry_add(c->titlebar, c->border, newgeometry);
newgeometry = placement_fix_offscreen(newgeometry, c->screen, c->border);
newgeometry = titlebar_geometry_remove(c->titlebar, newgeometry);
newgeometry = titlebar_geometry_remove(c->titlebar, c->border, newgeometry);
area_list_wipe(&arealist);
@ -144,9 +144,9 @@ placement_under_mouse(client_t *c)
p_delete(&qp_r);
}
finalgeometry = titlebar_geometry_add(c->titlebar, finalgeometry);
finalgeometry = titlebar_geometry_add(c->titlebar, c->border, finalgeometry);
finalgeometry = placement_fix_offscreen(finalgeometry, c->screen, c->border);
finalgeometry = titlebar_geometry_remove(c->titlebar, finalgeometry);
finalgeometry = titlebar_geometry_remove(c->titlebar, c->border, finalgeometry);
return finalgeometry;
}

View File

@ -163,7 +163,7 @@ titlebar_geometry_compute(client_t *c, area_t geometry, area_t *res)
break;
}
res->x = geometry.x + x_offset;
res->y = geometry.y - c->titlebar->height - 2 * c->titlebar->border.width;
res->y = geometry.y - c->titlebar->height - 2 * c->titlebar->border.width + c->border;
res->width = width;
res->height = c->titlebar->height;
break;
@ -184,7 +184,7 @@ titlebar_geometry_compute(client_t *c, area_t geometry, area_t *res)
break;
}
res->x = geometry.x + x_offset;
res->y = geometry.y + geometry.height + 2 * c->border;
res->y = geometry.y + geometry.height + c->border;
res->width = width;
res->height = c->titlebar->height;
break;
@ -204,7 +204,7 @@ titlebar_geometry_compute(client_t *c, area_t geometry, area_t *res)
y_offset = (geometry.height - width) / 2;
break;
}
res->x = geometry.x - c->titlebar->height;
res->x = geometry.x - c->titlebar->height + c->border;
res->y = geometry.y + y_offset;
res->width = c->titlebar->height;
res->height = width;
@ -225,7 +225,7 @@ titlebar_geometry_compute(client_t *c, area_t geometry, area_t *res)
y_offset = (geometry.height - width) / 2;
break;
}
res->x = geometry.x + geometry.width + 2 * c->border;
res->x = geometry.x + geometry.width + c->border;
res->y = geometry.y + y_offset;
res->width = c->titlebar->height;
res->height = width;

View File

@ -34,28 +34,29 @@ int luaA_titlebar_userdata_new(titlebar_t *);
/** Add the titlebar geometry to a geometry.
* \param t The titlebar
* \param border The client border size.
* \param geometry The geometry
* \return A new geometry bigger if the titlebar is visible.
*/
static inline area_t
titlebar_geometry_add(titlebar_t *t, area_t geometry)
titlebar_geometry_add(titlebar_t *t, int border, area_t geometry)
{
if(t && t->sw)
switch(t->position)
{
case Top:
geometry.y -= t->sw->geometry.height + 2 * t->border.width;
geometry.height += t->sw->geometry.height + 2 * t->border.width;
geometry.y -= t->sw->geometry.height + 2 * t->border.width - border;
geometry.height += t->sw->geometry.height + 2 * t->border.width - border;
break;
case Bottom:
geometry.height += t->sw->geometry.height + 2 * t->border.width;
geometry.height += t->sw->geometry.height + 2 * t->border.width - border;
break;
case Left:
geometry.x -= t->sw->geometry.width + 2 * t->border.width;
geometry.width += t->sw->geometry.width + 2 * t->border.width;
geometry.x -= t->sw->geometry.width + 2 * t->border.width - border;
geometry.width += t->sw->geometry.width + 2 * t->border.width - border;
break;
case Right:
geometry.width += t->sw->geometry.width + 2 * t->border.width;
geometry.width += t->sw->geometry.width + 2 * t->border.width - border;
break;
default:
break;
@ -66,28 +67,29 @@ titlebar_geometry_add(titlebar_t *t, area_t geometry)
/** Remove the titlebar geometry to a geometry.
* \param t The titlebar.
* \param border The client border size.
* \param geometry The geometry.
* \return A new geometry smaller if the titlebar is visible.
*/
static inline area_t
titlebar_geometry_remove(titlebar_t *t, area_t geometry)
titlebar_geometry_remove(titlebar_t *t, int border, area_t geometry)
{
if(t && t->sw)
switch(t->position)
{
case Top:
geometry.y += t->sw->geometry.height + 2 * t->border.width;
geometry.height -= t->sw->geometry.height + 2 * t->border.width;
geometry.y += t->sw->geometry.height + 2 * t->border.width - border;
geometry.height -= t->sw->geometry.height + 2 * t->border.width - border;
break;
case Bottom:
geometry.height -= t->sw->geometry.height + 2 * t->border.width;
geometry.height -= t->sw->geometry.height + 2 * t->border.width - border;
break;
case Left:
geometry.x += t->sw->geometry.width + 2 * t->border.width;
geometry.width -= t->sw->geometry.width + 2 * t->border.width;
geometry.x += t->sw->geometry.width + 2 * t->border.width - border;
geometry.width -= t->sw->geometry.width + 2 * t->border.width - border;
break;
case Right:
geometry.width -= t->sw->geometry.width + 2 * t->border.width;
geometry.width -= t->sw->geometry.width + 2 * t->border.width - border;
break;
default:
break;