fix switch visual

This commit is contained in:
Xinhao Yuan 2019-08-23 23:00:15 -04:00
parent 315f8a7676
commit bec644e887
1 changed files with 61 additions and 55 deletions

View File

@ -92,8 +92,8 @@ function module.start(c)
for _, tc in ipairs(screen.tiled_clients) do
if not (tc.floating or tc.maximized or tc.maximized_horizontal or tc.maximized_vertical)
then
if tc.x <= traverse_x and traverse_x < tc.x + tc.width and
tc.y <= traverse_y and traverse_y < tc.y + tc.height
if tc.x <= traverse_x and traverse_x < tc.x + tc.width + tc.border_width * 2 and
tc.y <= traverse_y and traverse_y < tc.y + tc.height + tc.border_width * 2
then
tablist[#tablist + 1] = tc
end
@ -111,11 +111,29 @@ function module.start(c)
cr:rectangle(0, 0, width, height)
cr:fill()
local msg, ext
local msg, ext, active_region
for i, a in ipairs(regions) do
if a.x <= traverse_x and traverse_x < a.x + a.width and
a.y <= traverse_y and traverse_y < a.y + a.height then
cr:rectangle(a.x - start_x, a.y - start_y, a.width, a.height)
cr:clip()
cr:set_source(fill_color)
cr:rectangle(a.x, a.y, a.width, a.height)
cr:fill()
cr:set_source(border_color)
cr:rectangle(a.x - start_x, a.y - start_y, a.width, a.height)
cr:set_line_width(10.0)
cr:stroke()
cr:reset_clip()
if a.x <= traverse_x and traverse_x < a.x + a.width and
a.y <= traverse_y and traverse_y < a.y + a.height
then
active_region = i
end
end
do
local a = regions[active_region]
local pl = api.lgi.Pango.Layout.create(cr)
pl:set_font_description(tablist_font_desc)
@ -166,18 +184,6 @@ function module.start(c)
end
end
cr:rectangle(a.x - start_x, a.y - start_y, a.width, a.height)
cr:clip()
cr:set_source(fill_color)
cr:rectangle(a.x, a.y, a.width, a.height)
cr:fill()
cr:set_source(border_color)
cr:rectangle(a.x - start_x, a.y - start_y, a.width, a.height)
cr:set_line_width(10.0)
cr:stroke()
cr:reset_clip()
end
-- show the traverse point
cr:rectangle(traverse_x - start_x - traverse_radius, traverse_y - start_y - traverse_radius, traverse_radius * 2, traverse_radius * 2)
cr:set_source_rgba(1, 1, 1, 1)