aboutsummaryrefslogtreecommitdiff
path: root/src/syslua/lx/gui.lua
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2017-05-04 16:27:27 +0200
committerAlex Auvolat <alex@adnab.me>2017-05-04 16:27:27 +0200
commitc7486a2113171d4d3fe7891ddf898f9f00865cc9 (patch)
tree8f6e6a8b96118d022d7685eddb58de1aeefdef99 /src/syslua/lx/gui.lua
parent7a3ab21a27c34033fbe478d68957be8e31f983a2 (diff)
downloadkogata-c7486a2113171d4d3fe7891ddf898f9f00865cc9.tar.gz
kogata-c7486a2113171d4d3fe7891ddf898f9f00865cc9.zip
Window moving :)
Diffstat (limited to 'src/syslua/lx/gui.lua')
-rw-r--r--src/syslua/lx/gui.lua16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/syslua/lx/gui.lua b/src/syslua/lx/gui.lua
index 35e73b8..6cfb545 100644
--- a/src/syslua/lx/gui.lua
+++ b/src/syslua/lx/gui.lua
@@ -60,6 +60,22 @@ function gui.open_io()
gui.pcmouse_mainloop_fd = mainloop.add_fd(gui.pcmouse_fd, function() error("pcmouse fd error") end)
local function pcmouse_handler(ev)
local dx, dy, dw, lb, rb, mb = string.unpack("hhbBBB", ev)
+ local change_but = false
+
+ while not change_but do
+ local bytes, n = sys.read(gui.pcmouse_fd, 1, 8)
+ if n == 8 then
+ local dx2, dy2, dw2, lb2, rb2, mb2 = string.unpack("hhbBBB", ev)
+ change_but = change_but or (lb2 ~= lb) or (rb2 ~= rb) or (mb2 ~= mb)
+ dx = dx + dx2
+ dy = dy + dy2
+ lb = lb2
+ rb = rb2
+ mb = mb2
+ else
+ break
+ end
+ end
gui.on_mouse(dx, dy, dw, lb, rb, mb)
gui.pcmouse_mainloop_fd:expect(8, pcmouse_handler)