awful.widget: fix widget<->tag association

Signed-off-by: Gregor Best <farhaven@googlemail.com>
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Gregor Best 2009-01-27 19:28:51 +01:00 committed by Julien Danjou
parent 798943af31
commit 8766ffcbd7
2 changed files with 12 additions and 3 deletions

View File

@ -176,7 +176,7 @@ client.dragtotag = { }
--- Move a client to a tag by drag'n'dropping it over a taglist widget --- Move a client to a tag by drag'n'dropping it over a taglist widget
-- @param c The client to move -- @param c The client to move
function client.dragtotag.widget(c, side) function client.dragtotag.widget(c)
capi.mousegrabber.run(function (mouse) capi.mousegrabber.run(function (mouse)
local button_down = false local button_down = false
for _, v in ipairs(mouse.buttons) do for _, v in ipairs(mouse.buttons) do

View File

@ -10,6 +10,7 @@ local pairs = pairs
local table = table local table = table
local otable = otable local otable = otable
local type = type local type = type
local math = math
local capi = local capi =
{ {
screen = screen, screen = screen,
@ -46,11 +47,19 @@ local function list_update(w, buttons, label, data, widgets, objects)
-- Add more widgets -- Add more widgets
if len < #objects then if len < #objects then
for i = len * 2 + 1, #objects * 2, 2 do for i = len * 2 + 1, #objects * 2, 2 do
w[i] = capi.widget({ type = "imagebox", align = widgets.imagebox.align }) local ib = capi.widget({ type = "imagebox", align = widgets.imagebox.align })
w[i + 1] = capi.widget({ type = "textbox", align = widgets.textbox.align }) local tb = capi.widget({ type = "textbox", align = widgets.textbox.align })
w[i] = ib
w[i + 1] = tb
w[i + 1]:margin({ left = widgets.textbox.margin.left, right = widgets.textbox.margin.right }) w[i + 1]:margin({ left = widgets.textbox.margin.left, right = widgets.textbox.margin.right })
w[i + 1].bg_resize = widgets.textbox.bg_resize or false w[i + 1].bg_resize = widgets.textbox.bg_resize or false
w[i + 1].bg_align = widgets.textbox.bg_align or "" w[i + 1].bg_align = widgets.textbox.bg_align or ""
if type(objects[math.floor(i / 2) + 1]) == "tag" then
tagwidgets[ib] = objects[math.floor(i / 2) + 1]
tagwidgets[tb] = objects[math.floor(i / 2) + 1]
end
end end
-- Remove widgets -- Remove widgets
elseif len > #objects then elseif len > #objects then