[*] General code improvement.

* Rework navigation allowing direct management and triggering for grabkeyboard widgets.
* Navigation code now behaves better with deeply nested layouts.
* Allow widget hierarchies deeper than 2 (__call() is implemented for every Widget metatable).
* Make BASE locals more secure (match '<filename>$' in regexp)
This commit is contained in:
2022-08-24 11:18:48 +02:00
parent 3b2b460012
commit 1d42498ee7
13 changed files with 283 additions and 187 deletions

View File

@ -1,4 +1,4 @@
local BASE = (...):gsub('label', '')
local BASE = (...):gsub('label$', '')
local Widget = require(BASE..'widget')
local core = require(BASE..'core')
@ -7,7 +7,10 @@ local shadowtext = require 'lib.gear.shadowtext'
local T = require('lib.moonspeak').translate
-- Labels don't accept focus
local Label = setmetatable({ nofocus = true }, Widget)
local Label = setmetatable({
nofocus = true,
__call = function(cls, args) return cls.new(args) end
}, Widget)
Label.__index = Label