From a567917cc514d3c5bd5b2598e9cf7282949aa731 Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Thu, 14 Aug 2008 18:24:31 +0200 Subject: [PATCH] screen: reset statusbar and windows properly on padding changes Signed-off-by: Julien Danjou --- screen.c | 15 +++++++++++++-- statusbar.c | 2 +- statusbar.h | 1 + 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/screen.c b/screen.c index dfa3bf0a6..65f4da780 100644 --- a/screen.c +++ b/screen.c @@ -28,6 +28,7 @@ #include "ewmh.h" #include "tag.h" #include "client.h" +#include "statusbar.h" #include "layouts/tile.h" extern awesome_t globalconf; @@ -360,18 +361,28 @@ luaA_screen_index(lua_State *L) static int 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) { + statusbar_t *sb; + luaA_checktable(L, 2); + s->padding.right = luaA_getopt_number(L, 2, "right", 0); s->padding.left = luaA_getopt_number(L, 2, "left", 0); s->padding.top = luaA_getopt_number(L, 2, "top", 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)); } else diff --git a/statusbar.c b/statusbar.c index 92b6b1fac..aeadfeee9 100644 --- a/statusbar.c +++ b/statusbar.c @@ -206,7 +206,7 @@ statusbar_refresh(void) * create them back. * \param statusbar The statusbar. */ -static void +void statusbar_position_update(statusbar_t *statusbar) { statusbar_t *sb; diff --git a/statusbar.h b/statusbar.h index b199ed3cb..a8e3223b2 100644 --- a/statusbar.h +++ b/statusbar.h @@ -36,6 +36,7 @@ statusbar_delete(statusbar_t **statusbar) } void statusbar_refresh(void); +void statusbar_position_update(statusbar_t *); int luaA_statusbar_userdata_new(lua_State *, statusbar_t *);