begin static cairo rendering with panel

This commit is contained in:
petrucci4prez 2018-08-05 04:05:38 -04:00
parent c6b68e7edc
commit e8784b46ed
1 changed files with 54 additions and 37 deletions

View File

@ -154,12 +154,26 @@ end
-- will be useful -- will be useful
local current_interface = 0 local current_interface = 0
local cs_p
local uninit = 1
conky_startup = function()
cs_p = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, 1920, 1080)
local cr = __cairo_create(cs_p)
Panel(cr)
uninit = nil
end
function conky_main() function conky_main()
if uninit then return end
local _cw = conky_window local _cw = conky_window
if not _cw then return end if not _cw then return end
local cs = __cairo_xlib_surface_create(_cw.display, _cw.drawable, _cw.visual, 1920, 1080) local cs = __cairo_xlib_surface_create(_cw.display, _cw.drawable, _cw.visual, 1920, 1080)
local cr = __cairo_create(cs) local cr = __cairo_create(cs)
cairo_set_source_surface(cr, cs_p, 0, 0)
cairo_paint(cr)
updates = updates + 1 updates = updates + 1
local t1 = updates % (UPDATE_FREQUENCY * 10) local t1 = updates % (UPDATE_FREQUENCY * 10)
@ -175,7 +189,7 @@ function conky_main()
local log_is_changed = false local log_is_changed = false
if t2 == 0 then log_is_changed = check_if_log_changed() end if t2 == 0 then log_is_changed = check_if_log_changed() end
Panel(cr) -- local pt1 = os.clock()
System(cr, current_interface, log_is_changed) System(cr, current_interface, log_is_changed)
Graphics(cr, current_interface) Graphics(cr, current_interface)
@ -189,6 +203,9 @@ function conky_main()
Power(cr, current_interface, UPDATE_FREQUENCY, is_using_ac) Power(cr, current_interface, UPDATE_FREQUENCY, is_using_ac)
Memory(cr, current_interface) Memory(cr, current_interface)
-- local pt2 = os.clock() - pt1
-- print(pt2)
__cairo_surface_destroy(cs) __cairo_surface_destroy(cs)
__cairo_destroy(cr) __cairo_destroy(cr)
__collectgarbage() __collectgarbage()