summaryrefslogtreecommitdiff
path: root/xmake/core/ui/program.lua
diff options
context:
space:
mode:
Diffstat (limited to 'xmake/core/ui/program.lua')
-rw-r--r--xmake/core/ui/program.lua15
1 files changed, 15 insertions, 0 deletions
diff --git a/xmake/core/ui/program.lua b/xmake/core/ui/program.lua
index e934e8e54..a79d2af51 100644
--- a/xmake/core/ui/program.lua
+++ b/xmake/core/ui/program.lua
@@ -150,6 +150,16 @@ function program:event_put(e)
table.insert(self._EVENT_QUEUE, e)
end
+-- send command
+function program:send(command, extra)
+ self:event_put(event.command {command, extra})
+end
+
+-- quit program
+function program:quit()
+ self:send("cm_quit")
+end
+
-- run program loop
function program:loop(argv)
@@ -173,6 +183,11 @@ function program:loop(argv)
self:event_on(event.idle())
end
+ -- quit?
+ if e and event.is_command(e, "cm_quit") then
+ break
+ end
+
-- draw views
self:draw()