From f47ca7cda706eb1cbf17f0d1eb1ced8b1a0e9155 Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Tue, 25 Mar 2008 14:45:13 +0100 Subject: [PATCH] Export titlebar_geometry_add() outside of placement to titlebar Signed-off-by: Julien Danjou --- placement.c | 36 ++++-------------------------------- titlebar.c | 29 +++++++++++++++++++++++++++++ titlebar.h | 1 + 3 files changed, 34 insertions(+), 32 deletions(-) diff --git a/placement.c b/placement.c index dba2cb53..eada5e0f 100644 --- a/placement.c +++ b/placement.c @@ -22,6 +22,7 @@ #include "placement.h" #include "screen.h" #include "client.h" +#include "titlebar.h" extern AwesomeConf globalconf; @@ -55,35 +56,6 @@ placement_fix_offscreen(area_t geometry, int screen, int border) return geometry; } -static area_t -placement_geometry_add_titlebar(Titlebar *t, area_t geometry) -{ - if(!t->sw) - return geometry; - - switch(t->position) - { - case Top: - geometry.y -= t->sw->geometry.height; - geometry.height += t->sw->geometry.height; - break; - case Bottom: - geometry.height += 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; - default: - break; - } - - return geometry; -} - /** Compute smart coordinates for a client window * \param geometry current/requested client geometry * \param screen screen used @@ -111,7 +83,7 @@ placement_smart(Client *c) newgeometry = client->f_geometry; newgeometry.width += 2 * client->border; newgeometry.height += 2 * client->border; - newgeometry = placement_geometry_add_titlebar(&client->titlebar, newgeometry); + newgeometry = titlebar_geometry_add(&client->titlebar, newgeometry); area_list_remove(&arealist, &newgeometry); } @@ -139,7 +111,7 @@ placement_smart(Client *c) newgeometry.width = c->f_geometry.width; newgeometry.height = c->f_geometry.height; - newgeometry = placement_geometry_add_titlebar(&c->titlebar, newgeometry); + newgeometry = titlebar_geometry_add(&c->titlebar, newgeometry); newgeometry = placement_fix_offscreen(newgeometry, c->screen, c->border); /* restore height and width again */ @@ -166,7 +138,7 @@ placement_under_mouse(Client *c) finalgeometry.y = y - c->f_geometry.height / 2; } - finalgeometry = placement_geometry_add_titlebar(&c->titlebar, finalgeometry); + finalgeometry = titlebar_geometry_add(&c->titlebar, finalgeometry); finalgeometry = placement_fix_offscreen(finalgeometry, c->screen, c->border); /* restore height and width */ diff --git a/titlebar.c b/titlebar.c index 09029874..5f8d39ad 100644 --- a/titlebar.c +++ b/titlebar.c @@ -102,6 +102,35 @@ titlebar_init(Client *c) } } +area_t +titlebar_geometry_add(Titlebar *t, area_t geometry) +{ + if(!t->sw) + return geometry; + + switch(t->position) + { + case Top: + geometry.y -= t->sw->geometry.height; + geometry.height += t->sw->geometry.height; + break; + case Bottom: + geometry.height += 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; + default: + break; + } + + return geometry; +} + void titlebar_update(Client *c) { diff --git a/titlebar.h b/titlebar.h index 5697e0ae..23eac88c 100644 --- a/titlebar.h +++ b/titlebar.h @@ -28,6 +28,7 @@ void titlebar_init(Client *); void titlebar_update(Client *); void titlebar_update_geometry_floating(Client *); area_t titlebar_update_geometry(Client *, area_t); +area_t titlebar_geometry_add(Titlebar *, area_t); Uicb uicb_client_toggletitlebar;