diff options
| author | ruki <[email protected]> | 2018-01-10 00:46:38 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2018-01-09 22:39:52 +0800 |
| commit | 273ea08ed48c9c4a7d5355256a45285188297d82 (patch) | |
| tree | b01a43a43590027d40212088819b1b420316cd8d | |
| parent | 2fc03e778ad00bef537b5adb6cd40b70a64a2a96 (diff) | |
fix border color and height
| -rwxr-xr-x | core/src/pdcurses/pdcurses/instr.c | 2 | ||||
| -rw-r--r-- | tests/ui/desktop.lua | 4 | ||||
| -rw-r--r-- | xmake/core/ui/program.lua | 11 | ||||
| -rw-r--r-- | xmake/core/ui/window.lua | 14 |
4 files changed, 20 insertions, 11 deletions
diff --git a/core/src/pdcurses/pdcurses/instr.c b/core/src/pdcurses/pdcurses/instr.c index 1f053a0fd..4c874ef6f 100755 --- a/core/src/pdcurses/pdcurses/instr.c +++ b/core/src/pdcurses/pdcurses/instr.c @@ -90,7 +90,7 @@ int winnstr(WINDOW *win, char *str, int n) src = win->_y[win->_cury] + win->_curx; for (i = 0; i < n; i++) - str[i] = src[i] & A_CHARTEXT; + str[i] = (char)(src[i] & A_CHARTEXT); str[i] = '\0'; diff --git a/tests/ui/desktop.lua b/tests/ui/desktop.lua index 48539a14f..004cee53f 100644 --- a/tests/ui/desktop.lua +++ b/tests/ui/desktop.lua @@ -60,7 +60,7 @@ end -- on event function demo:event_on(e) - if view.event_on(self, e) then + if application.event_on(self, e) then return true end if e.type == event.ev_keyboard then @@ -71,8 +71,6 @@ function demo:event_on(e) self:menubar():show(not self:menubar():state("visible")) elseif e.key_name == "d" then self:desktop():show(not self:desktop():state("visible")) - elseif e.key_name == "q" then - self:quit() end end end diff --git a/xmake/core/ui/program.lua b/xmake/core/ui/program.lua index 765d95732..2075a466d 100644 --- a/xmake/core/ui/program.lua +++ b/xmake/core/ui/program.lua @@ -141,6 +141,17 @@ function program:event() end end +-- on event +function program:event_on(e) + if panel.event_on(self, e) then + return true + end + if e.type == event.ev_keyboard and (e.key_name == "Esc" or e.key_name == "CtrlC") then + self:quit() + return true + end +end + -- put an event to view function program:event_put(e) diff --git a/xmake/core/ui/window.lua b/xmake/core/ui/window.lua index fae557747..821bf565d 100644 --- a/xmake/core/ui/window.lua +++ b/xmake/core/ui/window.lua @@ -86,18 +86,18 @@ function window:draw() local fbounds = self:frame():bounds() -- draw left and top border - self:canvas():attr(curses.color_pair(border[1], self:frame():background())) + self:canvas():attr({curses.color_pair(border[1], self:frame():background()), "standout"}) self:canvas():move(0, 0):putchar("hline", fbounds.ex) - self:canvas():move(0, 0):putchar('ulcorner') - self:canvas():move(0, 1):putchar('vline', fbounds.ey, true) - self:canvas():move(0, fbounds.ey):putchar('llcorner') + self:canvas():move(0, 0):putchar("ulcorner") + self:canvas():move(0, 1):putchar("vline", fbounds.ey - 1, true) + self:canvas():move(0, fbounds.ey):putchar("llcorner") -- draw bottom and right border self:canvas():attr(curses.color_pair(border[2], self:frame():background())) self:canvas():move(1, fbounds.ey):putchar("hline", fbounds.ex) - self:canvas():move(fbounds.ex, 0):putchar('urcorner') - self:canvas():move(fbounds.ex, 1):putchar('vline', fbounds.ey, true) - self:canvas():move(fbounds.ex, fbounds.ey):putchar('lrcorner') + self:canvas():move(fbounds.ex, 0):putchar("urcorner") + self:canvas():move(fbounds.ex, 1):putchar("vline", fbounds.ey - 1, true) + self:canvas():move(fbounds.ex, fbounds.ey):putchar("lrcorner") end -- draw title |
