Fil multiple minor issues related to fg and underlay colors
This commit is contained in:
parent
5d21035698
commit
2c9bd9107f
2
base.lua
2
base.lua
|
@ -34,7 +34,7 @@ local module = {
|
|||
URGENT = 2 , -- Need attention
|
||||
SELECTED = 3 , -- Single item selected [[FOCUS]]
|
||||
PRESSED = 4 , -- Mouse pressed
|
||||
HOVERED = 5 , -- Mouse hover
|
||||
HOVERED = -1 , -- Mouse hover
|
||||
CHANGED = 6 , -- The item changed, need attention
|
||||
USED = 7 , -- Common flag
|
||||
CHECKED = 8 , -- When checkbox isn't enough
|
||||
|
|
|
@ -25,7 +25,7 @@ local module = {
|
|||
DISABLED = 1 , -- Cannot be interacted with
|
||||
URGENT = 2 , -- Need attention
|
||||
SELECTED = 3 , -- Single item selected [[FOCUS]]
|
||||
HOVERED = 5 , -- Mouse hover
|
||||
HOVERED = -1 , -- Mouse hover
|
||||
PRESSED = 4 , -- Mouse pressed
|
||||
USED = 6 , -- Common flag
|
||||
CHECKED = 7 , -- When checkbox isn't enough
|
||||
|
|
|
@ -5,7 +5,8 @@ local cairo = require( "lgi" ).cairo
|
|||
local wibox = require( "wibox" )
|
||||
local checkbox = require( "radical.widgets.checkbox" )
|
||||
local fkey = require( "radical.widgets.fkey" )
|
||||
local underlay = require( "radical.widgets.underlay" )
|
||||
local underlay = require( "radical.widgets.underlay" )
|
||||
local theme = require( "radical.theme" )
|
||||
|
||||
local module = {}
|
||||
|
||||
|
@ -27,7 +28,10 @@ end
|
|||
-- Like an overlay, but under
|
||||
function module.paint_underlay(data,item,cr,width,height)
|
||||
cr:save()
|
||||
local udl = underlay.draw(item.underlay,{style=data.underlay_style,height=height})
|
||||
local state = item.state or {}
|
||||
local current_state = state._current_key or nil
|
||||
local state_name = theme.colors_by_id[current_state] or ""
|
||||
local udl = underlay.draw(item.underlay,{style=data.underlay_style,height=height,bg=data["underlay_bg_"..state_name]})
|
||||
cr:set_source_surface(udl,width-udl:get_width()-3)
|
||||
cr:paint_with_alpha(data.underlay_alpha)
|
||||
cr:restore()
|
||||
|
@ -86,7 +90,7 @@ end
|
|||
function module:setup_hover(item,data)
|
||||
item.set_hover = function(_,value)
|
||||
local item_style = item.item_style or data.item_style
|
||||
item.state[5] = value and true or nil
|
||||
item.state[-1] = value and true or nil
|
||||
item_style(item,{})
|
||||
end
|
||||
end
|
||||
|
|
|
@ -52,7 +52,7 @@ local function draw(item,args)
|
|||
item.widget:set_fg( item["fg_"..state_name])
|
||||
else
|
||||
item.widget:set_bg(args.color or nil)
|
||||
-- item.widget:set_fg(item["fg"])
|
||||
item.widget:set_fg(item["fg"])
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ local function draw(item,args)
|
|||
item.widget:set_fg( item["fg_"..state_name])
|
||||
else
|
||||
item.widget:set_bg(args.color or nil)
|
||||
-- item.widget:set_fg(item["fg_normal"] or data["fg_normal"])
|
||||
item.widget:set_fg(item["fg"])
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -71,7 +71,7 @@ local function draw(item,args)
|
|||
item.widget:set_fg(item["fg_"..state_name])
|
||||
else
|
||||
item.widget:set_bg(default[ih])
|
||||
-- item.widget:set_fg(item["fg_normal"])
|
||||
item.widget:set_fg(item["fg"])
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -20,9 +20,15 @@ local function change_data(tab, key,value)
|
|||
end
|
||||
end
|
||||
rawset(tab,"_current_key",win ~= math.huge and win or nil)
|
||||
if tab._item._internal.text_w and tab._item._internal.text_w.cache then
|
||||
tab._item._internal.text_w.cache = {}
|
||||
end
|
||||
tab._item:style()
|
||||
elseif value and (rawget(tab,"_current_key") or math.huge) > key then
|
||||
rawset(tab,"_current_key",key)
|
||||
if tab._item._internal.text_w and tab._item._internal.text_w.cache then
|
||||
tab._item._internal.text_w.cache = {}
|
||||
end
|
||||
tab._item:style()
|
||||
end
|
||||
tab._real_table[key] = value
|
||||
|
@ -43,6 +49,7 @@ function module.setup_colors(data,args)
|
|||
for k,v in pairs(theme_colors) do
|
||||
priv["fg_"..k] = args["fg_"..k] or beautiful["menu_fg_"..v.beautiful_name] or beautiful["fg_"..v.beautiful_name] or (v.fallback and beautiful.fg_normal)
|
||||
priv["bg_"..k] = args["bg_"..k] or beautiful["menu_bg_"..v.beautiful_name] or beautiful["bg_"..v.beautiful_name] or (v.fallback and beautiful.bg_normal)
|
||||
priv["underlay_bg_"..k] = args["underlay_bg_"..k] or beautiful["menu_underlay_bg_"..v.beautiful_name] or beautiful["underlay_bg_"..v.beautiful_name]
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -54,14 +61,14 @@ function module.setup_item_colors(data,item,args)
|
|||
priv["fg_"..k] = args["fg_"..k]
|
||||
else
|
||||
rawset(item,"get_fg_"..k,function()
|
||||
return data["fg_"..k]
|
||||
return priv["fg_"..k] or data["fg_"..k]
|
||||
end)
|
||||
end
|
||||
if args["bg_"..k] then
|
||||
priv["bg_"..k] = args["bg_"..k]
|
||||
else
|
||||
rawset(item,"get_bg_"..k, function()
|
||||
return data["bg_"..k]
|
||||
return priv["bg_"..k] or data["bg_"..k]
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -64,6 +64,7 @@ function module.draw(text,args)
|
|||
desc:set_family("Verdana")
|
||||
desc:set_weight(pango.Weight.BOLD)
|
||||
desc:set_size((height-padding*2) * pango.SCALE)
|
||||
-- desc:set_variant(pango.Variant.SMALL_CAPS)
|
||||
pango_l[height]:set_font_description(desc)
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue