wibox: Add an input_passthrough property.

Allows, for example, to have semi translucent wibars on top of
the fullscreens clients without having issues with inputs.
This commit is contained in:
Emmanuel Lepage Vallee 2017-11-23 22:54:13 -05:00
parent 1326ec20fd
commit 4e54aea6a9
2 changed files with 41 additions and 6 deletions

View File

@ -180,6 +180,22 @@
-- @property shape
-- @tparam gears.shape shape
--- Forward the inputs to the client below the wibox.
--
-- This replace the `shape_input` mask with an empty area. All mouse and
-- keyboard events are sent to the object (such as a client) positioned below
-- this wibox. When used alongside compositing, it allows, for example, to have
-- a subtle transparent wibox on top a fullscreen client to display important
-- data such as a low battery warning.
--
-- **Signal:**
--
-- * *property::input_passthrough*
--
-- @property input_passthrough
-- @param[opt=false] boolean
-- @see shape_input
--- Get or set mouse buttons bindings to a wibox.
--
-- @param buttons_table A table of buttons objects, or nothing.

View File

@ -137,11 +137,6 @@ function wibox:_apply_shape()
img:finish()
end
--- Set the wibox shape.
-- @property shape
-- @tparam gears.shape A gears.shape compatible function.
-- @see gears.shape
function wibox:set_shape(shape)
self._shape = shape
self:_apply_shape()
@ -151,6 +146,24 @@ function wibox:get_shape()
return self._shape
end
function wibox:set_input_passthrough(value)
rawset(self, "_input_passthrough", value)
if not value then
self.shape_input = nil
else
local img = cairo.ImageSurface(cairo.Format.A1, 0, 0)
self.shape_input = img._native
img:finish()
end
self:emit_signal("property::input_passthrough", value)
end
function wibox:get_input_passthrough()
return self._input_passthrough
end
function wibox:get_screen()
if self.screen_assigned and self.screen_assigned.valid then
return self.screen_assigned
@ -324,7 +337,13 @@ local function new(args)
ret:set_screen ( args.screen )
end
ret.shape = args.shape
if args.shape then
ret.shape = args.shape
end
if args.screen then
ret.input_passthrough = args.input_passthrough
end
return ret
end