screen: reset statusbar and windows properly on padding changes

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2008-08-14 18:24:31 +02:00
parent f17b172f57
commit a567917cc5
3 changed files with 15 additions and 3 deletions

View File

@ -28,6 +28,7 @@
#include "ewmh.h" #include "ewmh.h"
#include "tag.h" #include "tag.h"
#include "client.h" #include "client.h"
#include "statusbar.h"
#include "layouts/tile.h" #include "layouts/tile.h"
extern awesome_t globalconf; extern awesome_t globalconf;
@ -360,18 +361,28 @@ luaA_screen_index(lua_State *L)
static int static int
luaA_screen_padding(lua_State *L) luaA_screen_padding(lua_State *L)
{ {
screen_t *s; screen_t *s = lua_touserdata(L, 1);
s = lua_touserdata(L, 1); if(!s)
luaL_typerror(L, 1, "screen");
if(lua_gettop(L) == 2) if(lua_gettop(L) == 2)
{ {
statusbar_t *sb;
luaA_checktable(L, 2); luaA_checktable(L, 2);
s->padding.right = luaA_getopt_number(L, 2, "right", 0); s->padding.right = luaA_getopt_number(L, 2, "right", 0);
s->padding.left = luaA_getopt_number(L, 2, "left", 0); s->padding.left = luaA_getopt_number(L, 2, "left", 0);
s->padding.top = luaA_getopt_number(L, 2, "top", 0); s->padding.top = luaA_getopt_number(L, 2, "top", 0);
s->padding.bottom = luaA_getopt_number(L, 2, "bottom", 0); s->padding.bottom = luaA_getopt_number(L, 2, "bottom", 0);
s->need_arrange = true;
/* All the statusbar repositioned */
for(sb = s->statusbar; sb; sb = sb->next)
statusbar_position_update(sb);
ewmh_update_workarea(screen_virttophys(s->index)); ewmh_update_workarea(screen_virttophys(s->index));
} }
else else

View File

@ -206,7 +206,7 @@ statusbar_refresh(void)
* create them back. * create them back.
* \param statusbar The statusbar. * \param statusbar The statusbar.
*/ */
static void void
statusbar_position_update(statusbar_t *statusbar) statusbar_position_update(statusbar_t *statusbar)
{ {
statusbar_t *sb; statusbar_t *sb;

View File

@ -36,6 +36,7 @@ statusbar_delete(statusbar_t **statusbar)
} }
void statusbar_refresh(void); void statusbar_refresh(void);
void statusbar_position_update(statusbar_t *);
int luaA_statusbar_userdata_new(lua_State *, statusbar_t *); int luaA_statusbar_userdata_new(lua_State *, statusbar_t *);