mouseable views - correction 2
This commit is contained in:
@@ -65,6 +65,7 @@ Notes:
|
|||||||
|
|
||||||
#ifndef LUAJIT
|
#ifndef LUAJIT
|
||||||
# define LUA_COMPAT_5_1
|
# define LUA_COMPAT_5_1
|
||||||
|
# define LUA_COMPAT_5_3
|
||||||
# define LUA_COMPAT_ALL
|
# define LUA_COMPAT_ALL
|
||||||
#endif
|
#endif
|
||||||
#include "luaconf.h"
|
#include "luaconf.h"
|
||||||
|
@@ -28,6 +28,7 @@ local program = require("ltui/program")
|
|||||||
local desktop = require("ltui/desktop")
|
local desktop = require("ltui/desktop")
|
||||||
local menubar = require("ltui/menubar")
|
local menubar = require("ltui/menubar")
|
||||||
local statusbar = require("ltui/statusbar")
|
local statusbar = require("ltui/statusbar")
|
||||||
|
local action = require("ltui/action")
|
||||||
|
|
||||||
-- define module
|
-- define module
|
||||||
local application = application or program()
|
local application = application or program()
|
||||||
@@ -88,10 +89,10 @@ function application:on_event(e)
|
|||||||
if (not program.on_event(self, e)) and curses.KEY_MOUSE then
|
if (not program.on_event(self, e)) and curses.KEY_MOUSE then
|
||||||
|
|
||||||
-- mouse events
|
-- mouse events
|
||||||
if e.type == ltui.event.ev_mouse and (
|
if e.type == event.ev_mouse and (
|
||||||
e.btn_name == "BUTTON1_CLICKED" or
|
e.btn_name == "BUTTON1_CLICKED" or
|
||||||
e.btn_name == "BUTTON1_DOUBLE_CLICKED") then
|
e.btn_name == "BUTTON1_DOUBLE_CLICKED") then
|
||||||
self:action_on(ltui.action.ac_on_clicked, e.x, e.y)
|
self:action_on(action.ac_on_clicked, e.x, e.y)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@@ -82,16 +82,13 @@ function boxdialog:init(name, bounds, title)
|
|||||||
local px, py = x - panel:bounds().sx, y - panel:bounds().sy
|
local px, py = x - panel:bounds().sx, y - panel:bounds().sy
|
||||||
|
|
||||||
-- if coordinates don't match any view try box
|
-- if coordinates don't match any view try box
|
||||||
if panel:action_on(ltui.action.ac_on_clicked, x, y) and
|
if panel:action_on(action.ac_on_clicked, x, y) and
|
||||||
(not box:option("selectable")) and
|
(not box:option("selectable")) and
|
||||||
box:bounds():contains(px, py) then
|
box:bounds():contains(px, py) then
|
||||||
|
|
||||||
-- bypass panel
|
-- bypass panel
|
||||||
return box:action_on(action.ac_on_clicked, px, py)
|
return box:action_on(action.ac_on_clicked, px, py)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- return true if it doesn't match any selectable view
|
|
||||||
return true
|
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Reference in New Issue
Block a user