Avoid cyclic dependency between awful and menubar (#1433)
This commit is contained in:
parent
519b65ee14
commit
f9975f763c
|
@ -15,7 +15,6 @@ local awful = require("awful")
|
||||||
local wibox = require("wibox")
|
local wibox = require("wibox")
|
||||||
local beautiful = require("beautiful")
|
local beautiful = require("beautiful")
|
||||||
local dpi = beautiful.xresources.apply_dpi
|
local dpi = beautiful.xresources.apply_dpi
|
||||||
local compute_textbox_width = require("menubar").utils.compute_textbox_width
|
|
||||||
|
|
||||||
|
|
||||||
-- Stripped copy of this module https://github.com/copycat-killer/lain/blob/master/util/markup.lua:
|
-- Stripped copy of this module https://github.com/copycat-killer/lain/blob/master/util/markup.lua:
|
||||||
|
@ -290,8 +289,8 @@ function widget.new()
|
||||||
joined_labels = joined_labels .. rendered_hotkey .. (i~=#_keys and "\n" or "")
|
joined_labels = joined_labels .. rendered_hotkey .. (i~=#_keys and "\n" or "")
|
||||||
end
|
end
|
||||||
current_column.layout:add(wibox.widget.textbox(joined_labels))
|
current_column.layout:add(wibox.widget.textbox(joined_labels))
|
||||||
local max_width = compute_textbox_width(wibox.widget.textbox(max_label_content), s) +
|
local max_width, _ = wibox.widget.textbox(max_label_content):get_preferred_size(s)
|
||||||
widget_instance.group_margin
|
max_width = max_width + widget_instance.group_margin
|
||||||
if not current_column.max_width or max_width > current_column.max_width then
|
if not current_column.max_width or max_width > current_column.max_width then
|
||||||
current_column.max_width = max_width
|
current_column.max_width = max_width
|
||||||
end
|
end
|
||||||
|
|
|
@ -293,11 +293,8 @@ function utils.parse_dir(dir_path, callback)
|
||||||
end)()
|
end)()
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Compute textbox width.
|
|
||||||
-- @tparam wibox.widget.textbox textbox Textbox instance.
|
|
||||||
-- @tparam number|screen s Screen
|
|
||||||
-- @treturn int Text width.
|
|
||||||
function utils.compute_textbox_width(textbox, s)
|
function utils.compute_textbox_width(textbox, s)
|
||||||
|
awful_util.deprecate("Use 'width, _ = textbox:get_preferred_size(s)' directly.")
|
||||||
s = screen[s or mouse.screen]
|
s = screen[s or mouse.screen]
|
||||||
local w, _ = textbox:get_preferred_size(s)
|
local w, _ = textbox:get_preferred_size(s)
|
||||||
return w
|
return w
|
||||||
|
|
Loading…
Reference in New Issue