4 function show_message(m)
5 local width = string.len(m) + 6;
6 local win = curses.newwin(5, width, (lines - 5) / 2, (cols - width) / 2);
8 win:attron(curses.COLOR_PAIR(curses.COLOR_RED));
9 win:box('|', '-', '+');
10 win:mvaddstr(2, 3, m);
18 curses.init_pair(curses.COLOR_BLUE, curses.COLOR_BLUE, curses.COLOR_WHITE);
19 curses.init_pair(curses.COLOR_RED, curses.COLOR_RED, curses.COLOR_WHITE);
22 curses.keypad(curses.stdscr(), true);
24 lines = curses.LINES();
29 curses.BUTTON1_CLICKED,
30 curses.BUTTON2_CLICKED,
31 curses.BUTTON3_CLICKED,
32 curses.BUTTON4_CLICKED
35 table.foreachi(mmasks, function(_i, _m) curses.addmousemask(_m) end);
36 curses.attron(curses.COLOR_PAIR(curses.COLOR_BLUE));
37 curses.attron(curses.A_BOLD);
38 curses.mvaddstr((lines - 5) / 2, (cols - 10) / 2, "click");
42 local c = curses.getch();
43 if (c == curses.KEY_MOUSE) then
44 local r, id, x, y, z, bstate = curses.getmouse();
46 show_message("id = " .. id .. ", x = " .. x .. ", y = " .. y .. ", z = " .. z .. ", bstate = " ..
47 string.format("0x%x", bstate));