mirror of
https://github.com/awesomeWM/awesome
synced 2024-11-17 07:47:41 +01:00
widget: Move 'visible' into _private
This commit is contained in:
parent
afa17fd8f9
commit
c0eabf9d8f
5 changed files with 18 additions and 11 deletions
|
@ -249,7 +249,7 @@ function menu:exec(num, opts)
|
|||
self.active_child:hide()
|
||||
end
|
||||
self.active_child = self.child[num]
|
||||
if not self.active_child.visible then
|
||||
if not self.active_child:get_visible() then
|
||||
self.active_child:show()
|
||||
end
|
||||
elseif type(cmd) == "string" then
|
||||
|
@ -431,7 +431,7 @@ function menu:delete(num)
|
|||
local item = self.items[num]
|
||||
if not item then return end
|
||||
item.widget:disconnect_signal("mouse::enter", item._mouse)
|
||||
item.widget.visible = false
|
||||
item.widget:set_visible(false)
|
||||
table.remove(self.items, num)
|
||||
if self.sel == num then
|
||||
self:item_leave(self.sel)
|
||||
|
|
|
@ -22,7 +22,7 @@ local background = { mt = {} }
|
|||
|
||||
-- Draw this widget
|
||||
function background:draw(context, cr, width, height)
|
||||
if not self._private.widget or not self._private.widget.visible then
|
||||
if not self._private.widget or not self._private.widget:get_visible() then
|
||||
return
|
||||
end
|
||||
|
||||
|
@ -167,7 +167,7 @@ function background:get_fg()
|
|||
return self._private.foreground
|
||||
end
|
||||
|
||||
--- The background shape.
|
||||
--- The background shap e.
|
||||
--
|
||||
-- Use `set_shape` to set additional shape paramaters.
|
||||
--
|
||||
|
|
|
@ -29,7 +29,7 @@ end
|
|||
|
||||
-- Layout this layout
|
||||
function rotate:layout(_, width, height)
|
||||
if not self.widget or not self.widget.visible then
|
||||
if not self.widget or not self.widget._private.visible then
|
||||
return
|
||||
end
|
||||
|
||||
|
|
|
@ -259,7 +259,7 @@ end
|
|||
-- @param cr The cairo context that is used for drawing.
|
||||
function hierarchy:draw(context, cr)
|
||||
local widget = self:get_widget()
|
||||
if not widget.visible then
|
||||
if not widget._private.visible then
|
||||
return
|
||||
end
|
||||
|
||||
|
|
|
@ -37,14 +37,21 @@ end
|
|||
-- @tparam boolean b Wether the widget is visible at all
|
||||
-- @function set_visible
|
||||
function base.widget:set_visible(b)
|
||||
if b ~= self.visible then
|
||||
self.visible = b
|
||||
if b ~= self._private.visible then
|
||||
self._private.visible = b
|
||||
self:emit_signal("widget::layout_changed")
|
||||
-- In case something ignored fit and drew the widget anyway
|
||||
self:emit_signal("widget::redraw_needed")
|
||||
end
|
||||
end
|
||||
|
||||
--- Get if the widget is visible.
|
||||
-- @treturn boolean If the widget is visible
|
||||
-- @function get_visible
|
||||
function base.widget:get_visible()
|
||||
return self._private.visible or false
|
||||
end
|
||||
|
||||
--- Set a widget's opacity
|
||||
-- @tparam number o The opacity to use (a number from 0 to 1). 0 is fully
|
||||
-- transparent while 1 is fully opaque.
|
||||
|
@ -221,7 +228,7 @@ end
|
|||
function base.fit_widget(parent, context, widget, width, height)
|
||||
record_dependency(parent, widget)
|
||||
|
||||
if not widget.visible then
|
||||
if not widget._private.visible then
|
||||
return 0, 0
|
||||
end
|
||||
|
||||
|
@ -266,7 +273,7 @@ end
|
|||
function base.layout_widget(parent, context, widget, width, height)
|
||||
record_dependency(parent, widget)
|
||||
|
||||
if not widget.visible then
|
||||
if not widget._private.visible then
|
||||
return
|
||||
end
|
||||
|
||||
|
@ -539,7 +546,7 @@ function base.make_widget(proxy, widget_name, args)
|
|||
ret._private.widget_buttons = {}
|
||||
|
||||
-- Widget is visible
|
||||
ret.visible = true
|
||||
ret._private.visible = true
|
||||
|
||||
-- Widget is fully opaque
|
||||
ret._private.opacity = 1
|
||||
|
|
Loading…
Reference in a new issue