aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Richter <vrld@vrld.org>2013-02-06 13:28:23 +0100
committerMatthias Richter <vrld@vrld.org>2013-02-06 13:28:23 +0100
commit2c24ba3ca076ad4a5ef08f746c2b2b5886251972 (patch)
tree8873835dcd230260fa39b2acf32140380a278d91
parent7f0689d012c62cd4068cabe1ec3f0e0920901b03 (diff)
downloadQuickie-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.lua6
1 files changed, 1 insertions, 5 deletions
diff --git a/input.lua b/input.lua
index ccace0d..17c372f 100644
--- a/input.lua
+++ b/input.lua
@@ -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