Conversation
laelnasan
commented
Oct 5, 2020
- Before adding new features and new modules, please go to issues to submit the relevant feature description first.
- Write good commit messages and use the same coding conventions as the rest of the project.
- Please commit code to dev branch and we will merge into master branch in feature
- Ensure your edited codes with four spaces instead of TAB.
- 增加新特性和新模块之前,请先到issues提交相关特性说明,经过讨论评估确认后,再进行相应的代码提交,避免做无用工作。
- 编写友好可读的提交信息,并使用与工程代码相同的代码规范,代码请用4个空格字符代替tab缩进。
- 请提交代码到dev分支,如果通过,我们会在特定时间合并到master分支上。
- 为了规范化提交日志的格式,commit消息,不要用中文,请用英文描述。
If there is a curses library with support to mouse the `curses.KEY_MOUSE` constant will be defined with other constants and functions.
tests/getch_test.lua
Outdated
| -- Copyright (C) 2015-2020, TBOOX Open Source Group. | ||
| -- | ||
| -- @author ruki | ||
| -- @file window.lua |
There was a problem hiding this comment.
Please modify file name and author.
There was a problem hiding this comment.
And rename getch_test.lua to event.lua, all scripts in the tests directory are test cases, no need to add _test
tests/getch_test.lua
Outdated
| function demo:on_event(e) | ||
| if e.type < event.ev_max then | ||
| self:teste():text_set('tp: ' .. | ||
| tostring(e.type) .. |
There was a problem hiding this comment.
Please use 4 whilte spaces instead of all tab characters.
src/ltui/program.lua
Outdated
| local name | ||
| for n, v in pairs(curses) do | ||
| if v == s and n:match('BUTTON') then | ||
| name = n or name |
| -- | ||
| event.keyboard = object {_init = { "key_code", "key_name", "key_meta" }, type = event.ev_keyboard} | ||
|
|
||
| event.mouse = object {_init = { "btn_code", "x", "y", "btn_name" }, type = event.ev_mouse} |
src/core/lcurses/lcurses.c
Outdated
| e.y = luaL_checkint(L, 3); | ||
| e.z = luaL_checkint(L, 4); | ||
| e.id = luaL_checkint(L, 5); | ||
|
|
There was a problem hiding this comment.
Please use 4 whilte spaces instead of all tab characters.
src/core/lcurses/lcurses.c
Outdated
| lc_getmouse(lua_State *L) | ||
| { | ||
| MEVENT e; | ||
| if(getmouse(&e) == OK) |
src/ltui/program.lua
Outdated
| if curses.KEY_MOUSE and key_code == curses.KEY_MOUSE then | ||
| local s, x, y = curses.getmouse() | ||
| local name | ||
| for n, v in pairs(curses) do |
There was a problem hiding this comment.
I think that you should use map to avoid for-loop. like program:_key_map()
we can add program:_mouse_map() and get name from this map.
There was a problem hiding this comment.
Thanks for your comments. Will do ASAP
src/core/lcurses/lcurses.c
Outdated
| MEVENT e; | ||
| e.bstate = luaL_checklong(L, 1); | ||
| e.x = luaL_checkint(L, 2); | ||
| e.y = luaL_checkint(L, 3); |
src/core/lcurses/lcurses.c
Outdated
| return 5; | ||
| } | ||
| MEVENT e; | ||
| if (getmouse(&e) == OK) |
src/ltui/program.lua
Outdated
| -- on curses implementation | ||
| self._MOUSEMAP = {} | ||
| for n, v in pairs(curses) do | ||
| if n:match('MOUSE') and n ~= 'KEY_MOUSE' or n:match('BUTTON') then |
There was a problem hiding this comment.
if (a and b) or c then
if (n:match('MOUSE') and n ~= 'KEY_MOUSE') or n:match('BUTTON') then
|
I have merged it. Thanks! |
|
Thanks! And sorry for the trouble I may have caused. Really happy for being able to contribute, though. |