Uli just made me aware of a little issue with the wtable patch: it
doesn't trigger if the layout function is set to nil (whatever reason
one might have to do that). He suggested simplyfying the
luaA_wtable_newindex function to refresh the wibox regardless of what
has changed. I attached an updated version of the wtable patch.

-- 
GCS/IT/M d- s+:- a--- C++ UL+++ US UB++ P+++ L+++ E--- W+ N+ o--
K- w--- O M-- V PS+ PE- Y+ PGP+++ t+ 5 X+ R tv+ b++ DI+++ D+++ G+
e- h! r y+

    Gregor Best
From 83ef016ed0ad90bd4c1062699fe3ce83dc3e060f Mon Sep 17 00:00:00 2001
From: Gregor Best <farha...@googlemail.com>
Date: Sun, 12 Jul 2009 17:24:14 +0200
Subject: [PATCH 02/10] wtable: update on change, regardless of what was changed

this simplifies the code a bit and allows us to react to changes on
wtable entries that are neither tables nor widgets (for example the
layout function)
---
 luaa.c |   15 ++-------------
 1 files changed, 2 insertions(+), 13 deletions(-)

diff --git a/luaa.c b/luaa.c
index 992c6ae..fabe8ba 100644
--- a/luaa.c
+++ b/luaa.c
@@ -379,32 +379,21 @@ luaA_wtable_index(lua_State *L)
 static int
 luaA_wtable_newindex(lua_State *L)
 {
-    bool invalid = false;
-
     /* push key on top */
     lua_pushvalue(L, 2);
     /* get current key value in content table */
     lua_rawget(L, lua_upvalueindex(1));
-    /* if value is a widget, notify change */
-    if(lua_istable(L, -1) || luaA_toudata(L, -1, "widget"))
-        invalid = true;
 
     lua_pop(L, 1); /* remove value */
 
-    /* if new value is a widget or a table */
+    /* if new value is a table, update the wibox widget table */
     if(lua_istable(L, 3))
-    {
         luaA_table2wtable(L);
-        invalid = true;
-    }
-    else if(!invalid && luaA_toudata(L, 3, "widget"))
-        invalid = true;
 
     /* upvalue 1 is content table */
     lua_rawset(L, lua_upvalueindex(1));
 
-    if(invalid)
-        luaA_wibox_invalidate_byitem(L, lua_topointer(L, 1));
+    luaA_wibox_invalidate_byitem(L, lua_topointer(L, 1));
 
     return 0;
 }
-- 
1.6.3.3

Attachment: pgpzcX1C05Zbm.pgp
Description: PGP signature

Reply via email to