awful.tooltip: Inline place() into set_geometry()
Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
parent
f9d15691b8
commit
1578957355
|
@ -58,13 +58,6 @@ local ipairs = ipairs
|
||||||
-- @tfield boolean visible True if tooltip is visible.
|
-- @tfield boolean visible True if tooltip is visible.
|
||||||
local tooltip = { mt = {} }
|
local tooltip = { mt = {} }
|
||||||
|
|
||||||
-- Place the tooltip on the screen.
|
|
||||||
-- @tparam tooltip self A tooltip object.
|
|
||||||
local function place(self)
|
|
||||||
a_placement.next_to_mouse(self.wibox)
|
|
||||||
a_placement.no_offscreen(self.wibox, mouse.screen)
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Place the tooltip under the mouse.
|
-- Place the tooltip under the mouse.
|
||||||
--
|
--
|
||||||
-- @tparam tooltip self A tooltip object.
|
-- @tparam tooltip self A tooltip object.
|
||||||
|
@ -77,6 +70,8 @@ local function set_geometry(self)
|
||||||
if my_geo.width ~= n_w or my_geo.height ~= n_h then
|
if my_geo.width ~= n_w or my_geo.height ~= n_h then
|
||||||
self.wibox:geometry({ width = n_w, height = n_h })
|
self.wibox:geometry({ width = n_w, height = n_h })
|
||||||
end
|
end
|
||||||
|
a_placement.next_to_mouse(self.wibox)
|
||||||
|
a_placement.no_offscreen(self.wibox, mouse.screen)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Show a tooltip.
|
-- Show a tooltip.
|
||||||
|
@ -92,7 +87,6 @@ local function show(self)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
set_geometry(self)
|
set_geometry(self)
|
||||||
place(self)
|
|
||||||
self.wibox.visible = true
|
self.wibox.visible = true
|
||||||
self.visible = true
|
self.visible = true
|
||||||
end
|
end
|
||||||
|
@ -263,10 +257,6 @@ tooltip.new = function(args)
|
||||||
-- emit the release event on an underlying object, e.g. the titlebar icon.
|
-- emit the release event on an underlying object, e.g. the titlebar icon.
|
||||||
self.wibox:buttons(abutton({}, 1, nil, function() self.hide() end))
|
self.wibox:buttons(abutton({}, 1, nil, function() self.hide() end))
|
||||||
|
|
||||||
-- Re-place when the geometry of the wibox changes.
|
|
||||||
self.wibox:connect_signal("property::width", function() place(self) end)
|
|
||||||
self.wibox:connect_signal("property::height", function() place(self) end)
|
|
||||||
|
|
||||||
-- Add tooltip to objects
|
-- Add tooltip to objects
|
||||||
if args.objects then
|
if args.objects then
|
||||||
for _, object in ipairs(args.objects) do
|
for _, object in ipairs(args.objects) do
|
||||||
|
|
Loading…
Reference in New Issue