From 093eac3eb2fc3ff05467684655b22472839c8058 Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Fri, 6 Jan 2023 18:58:08 -0800 Subject: [PATCH] use a black background for non-top ZScreen titles --- library/lua/gui.lua | 6 ++++-- library/lua/gui/widgets.lua | 5 ++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/library/lua/gui.lua b/library/lua/gui.lua index 426458159..661351d31 100644 --- a/library/lua/gui.lua +++ b/library/lua/gui.lua @@ -785,12 +785,13 @@ GREY_LINE_FRAME = { rt_frame_pen = to_pen{ tile=903, ch=187, fg=COLOR_GREY, bg=COLOR_BLACK }, rb_frame_pen = to_pen{ tile=917, ch=188, fg=COLOR_GREY, bg=COLOR_BLACK }, title_pen = to_pen{ fg=COLOR_BLACK, bg=COLOR_GREY }, + inactive_title_pen = to_pen{ fg=COLOR_GREY, bg=COLOR_BLACK }, signature_pen = to_pen{ fg=COLOR_GREY, bg=COLOR_BLACK }, locked_pen = to_pen{tile=779, ch=216, fg=COLOR_GREY, bg=COLOR_GREEN}, unlocked_pen = to_pen{tile=782, ch=216, fg=COLOR_GREY, bg=COLOR_BLACK}, } -function paint_frame(dc,rect,style,title,show_lock,locked) +function paint_frame(dc,rect,style,title,show_lock,locked,inactive) local pen = style.frame_pen local x1,y1,x2,y2 = dc.x1+rect.x1, dc.y1+rect.y1, dc.x1+rect.x2, dc.y1+rect.y2 dscreen.paintTile(style.lt_frame_pen or pen, x1, y1) @@ -811,7 +812,8 @@ function paint_frame(dc,rect,style,title,show_lock,locked) if #tstr > x2-x1-1 then tstr = string.sub(tstr,1,x2-x1-1) end - dscreen.paintString(style.title_pen or pen, x, y1, tstr) + dscreen.paintString(inactive and style.inactive_title_pen or style.title_pen or pen, + x, y1, tstr) end if show_lock then diff --git a/library/lua/gui/widgets.lua b/library/lua/gui/widgets.lua index 4df6d07ff..9d8e30d18 100644 --- a/library/lua/gui/widgets.lua +++ b/library/lua/gui/widgets.lua @@ -469,7 +469,10 @@ function Panel:onRenderFrame(dc, rect) if self.lockable then locked = self.parent_view and self.parent_view.locked end - gui.paint_frame(dc, rect, self.frame_style, self.frame_title, self.lockable, locked) + local inactive = self.parent_view and self.parent_view.isOnTop + and not self.parent_view:isOnTop() + gui.paint_frame(dc, rect, self.frame_style, self.frame_title, + self.lockable, locked, inactive) if self.kbd_get_pos then local pos = self.kbd_get_pos() local pen = to_pen{fg=COLOR_GREEN, bg=COLOR_BLACK}