From afb59667c0e7c60640357b470fba1190df30e2f0 Mon Sep 17 00:00:00 2001 From: Hans-Werner Hilse Date: Sun, 30 Nov 2014 18:07:35 +0000 Subject: [PATCH] allow for more control on refreshes when show()ing widgets for now, we have show() automatically call setDirty() for the new widget, as before. However, now show() takes two arguments for refresh configuration that will get passed on to setDirty(). For compatibility, the default is here in show() to do a partial refresh. So if you want no refresh triggered (via this show() call), add a function that doesn't return anything. --- frontend/ui/uimanager.lua | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/frontend/ui/uimanager.lua b/frontend/ui/uimanager.lua index b327fc7e9..185395343 100644 --- a/frontend/ui/uimanager.lua +++ b/frontend/ui/uimanager.lua @@ -83,7 +83,8 @@ end -- register & show a widget -- modal widget should be always on the top -function UIManager:show(widget, x, y) +-- for refreshtype & refresharea see description of setDirty() +function UIManager:show(widget, x, y, refreshtype, refresharea) DEBUG("show widget", widget.id) self._running = true local window = {x = x or 0, y = y or 0, widget = widget} @@ -97,7 +98,7 @@ function UIManager:show(widget, x, y) end end -- and schedule it to be painted - self:setDirty(widget, "partial") + self:setDirty(widget, refreshtype or "partial", refresharea) -- tell the widget that it is shown now widget:handleEvent(Event:new("Show")) -- check if this widget disables double tap gesture @@ -204,7 +205,7 @@ function UIManager:setDirty(widget, refreshtype, refreshregion) end end -- handle refresh information - if not refreshtype then return end + if not refreshtype or refreshtype == "none" then return end if type(refreshtype) == "function" then -- callback, will be issued after painting table.insert(self._refresh_func_stack, refreshtype)