Fix #4: keyboard.disableFocus() not working.
Used undefined variable NO_WIDGET to clear keyboard focus. Same error was made in mouse.lua.
This commit is contained in:
parent
fd8664c80a
commit
d3b1a1c00d
3 changed files with 3 additions and 1 deletions
2
core.lua
2
core.lua
|
@ -24,7 +24,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
THE SOFTWARE.
|
THE SOFTWARE.
|
||||||
]]--
|
]]--
|
||||||
|
|
||||||
local NO_WIDGET = function()end
|
|
||||||
local BASE = (...):match("(.-)[^%.]+$")
|
local BASE = (...):match("(.-)[^%.]+$")
|
||||||
local group = require(BASE .. 'group')
|
local group = require(BASE .. 'group')
|
||||||
local mouse = require(BASE .. 'mouse')
|
local mouse = require(BASE .. 'mouse')
|
||||||
|
@ -83,6 +82,7 @@ local function registerDraw(id, f, ...)
|
||||||
if mouse.isHot(id) or keyboard.hasFocus(id) then
|
if mouse.isHot(id) or keyboard.hasFocus(id) then
|
||||||
state = mouse.isActive(id) and 'active' or 'hot'
|
state = mouse.isActive(id) and 'active' or 'hot'
|
||||||
end
|
end
|
||||||
|
print(id, keyboard.hasFocus(id))
|
||||||
local rest = save_pack(...)
|
local rest = save_pack(...)
|
||||||
draw_items.n = draw_items.n + 1
|
draw_items.n = draw_items.n + 1
|
||||||
draw_items[draw_items.n] = function()
|
draw_items[draw_items.n] = function()
|
||||||
|
|
|
@ -26,6 +26,7 @@ THE SOFTWARE.
|
||||||
|
|
||||||
local key,code = nil, -1
|
local key,code = nil, -1
|
||||||
local focus, lastwidget
|
local focus, lastwidget
|
||||||
|
local NO_WIDGET = {}
|
||||||
|
|
||||||
local cycle = {
|
local cycle = {
|
||||||
-- binding = {key = key, modifier1, modifier2, ...} XXX: modifiers are OR-ed!
|
-- binding = {key = key, modifier1, modifier2, ...} XXX: modifiers are OR-ed!
|
||||||
|
|
|
@ -29,6 +29,7 @@ local _M -- holds the module. needed to make widgetHit overridable
|
||||||
local x,y = 0,0
|
local x,y = 0,0
|
||||||
local down = false
|
local down = false
|
||||||
local hot, active = nil, nil
|
local hot, active = nil, nil
|
||||||
|
local NO_WIDGET = {}
|
||||||
|
|
||||||
local function widgetHit(mouse, pos, size)
|
local function widgetHit(mouse, pos, size)
|
||||||
return mouse[1] >= pos[1] and mouse[1] <= pos[1] + size[1] and
|
return mouse[1] >= pos[1] and mouse[1] <= pos[1] + size[1] and
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue