diff options
author | Matthias Richter <vrld@vrld.org> | 2013-02-06 13:28:23 +0100 |
---|---|---|
committer | Matthias Richter <vrld@vrld.org> | 2013-02-06 13:28:23 +0100 |
commit | 2c24ba3ca076ad4a5ef08f746c2b2b5886251972 (patch) | |
tree | 8873835dcd230260fa39b2acf32140380a278d91 | |
parent | 7f0689d012c62cd4068cabe1ec3f0e0920901b03 (diff) | |
download | Quickie-2c24ba3ca076ad4a5ef08f746c2b2b5886251972.tar.gz Quickie-2c24ba3ca076ad4a5ef08f746c2b2b5886251972.tar.bz2 Quickie-2c24ba3ca076ad4a5ef08f746c2b2b5886251972.tar.xz Quickie-2c24ba3ca076ad4a5ef08f746c2b2b5886251972.zip |
Input-widget only fires event when activated
-rw-r--r-- | input.lua | 6 |
1 files changed, 1 insertions, 5 deletions
@@ -42,18 +42,15 @@ return function(w) keyboard.makeCyclable(id) if mouse.isActive(id) then keyboard.setFocus(id) end - local changed = false if not keyboard.hasFocus(id) then --[[nothing]] -- editing elseif keyboard.key == 'backspace' then w.info.text = w.info.text:sub(1,w.info.cursor-1) .. w.info.text:sub(w.info.cursor+1) w.info.cursor = math.max(0, w.info.cursor-1) - changed = true elseif keyboard.key == 'delete' then w.info.text = w.info.text:sub(1,w.info.cursor) .. w.info.text:sub(w.info.cursor+2) w.info.cursor = math.min(w.info.text:len(), w.info.cursor) - changed = true -- movement elseif keyboard.key == 'left' then w.info.cursor = math.max(0, w.info.cursor-1) @@ -72,11 +69,10 @@ return function(w) local right = w.info.text:sub(w.info.cursor+1) w.info.text = table.concat{left, string.char(keyboard.code), right} w.info.cursor = w.info.cursor + 1 - changed = true end core.registerDraw(id, w.draw or core.style.Input, w.info.text, w.info.cursor, pos[1],pos[2], size[1],size[2]) - return changed + return mouse.releasedOn(id) or (keyboard.key == 'return' and keyboard.hasFocus(id)) end |