Merge pull request #810 from Elv13/del_gears_screen

gears.screen: Merge into awful.screen
This commit is contained in:
Emmanuel Lepage Vallée 2016-04-06 23:44:44 -04:00
commit 6e8337e26a
5 changed files with 29 additions and 11 deletions

View file

@ -91,7 +91,7 @@ end
-- {{{ Wallpaper
if beautiful.wallpaper then
gears.screen.connect_for_each_screen(function(s)
awful.screen.connect_for_each_screen(function(s)
gears.wallpaper.maximized(beautiful.wallpaper, s, true)
end)
end
@ -100,7 +100,7 @@ end
-- {{{ Tags
-- Define a tag table which hold all screen tags.
tags = {}
gears.screen.connect_for_each_screen(function(s)
awful.screen.connect_for_each_screen(function(s)
-- Each screen has its own tag table.
tags[s] = awful.tag({ 1, 2, 3, 4, 5, 6, 7, 8, 9 }, s, awful.layout.layouts[1])
end)
@ -175,7 +175,7 @@ mytasklist.buttons = awful.util.table.join(
awful.client.focus.byidx(-1)
end))
gears.screen.connect_for_each_screen(function(s)
awful.screen.connect_for_each_screen(function(s)
-- Create a promptbox for each screen
mypromptbox[s] = awful.widget.prompt()
-- Create an imagebox widget which will contains an icon indicating which layout we're using.

View file

@ -242,6 +242,22 @@ function screen.get_bounding_geometry(s, args)
return geo
end
--- Call a function for each existing and created-in-the-future screen.
-- @tparam function func The function to call.
-- @tparam screen func.screen The screen
function screen.connect_for_each_screen(func)
for s in capi.screen do
func(s)
end
capi.screen.connect_signal("added", func)
end
--- Undo the effect of connect_for_each_screen.
-- @tparam function func The function that should no longer be called.
function screen.disconnect_for_each_screen(func)
capi.screen.disconnect_signal("added", func)
end
capi.screen.add_signal("padding")
-- Extend the luaobject

View file

@ -5,23 +5,23 @@
-- @classmod gears.screen
---------------------------------------------------------------------------
local screen = screen
local ascreen = require("awful.screen")
local util = require("awful.util")
local module = {}
--- Call a function for each existing and created-in-the-future screen.
-- @tparam function func The function to call.
function module.connect_for_each_screen(func)
for s in screen do
func(s)
end
screen.connect_signal("added", func)
util.deprecate("Use awful.screen.connect_for_each_screen")
ascreen.connect_for_each_screen(func)
end
--- Undo the effect of connect_for_each_screen.
-- @tparam function func The function that should no longer be called.
function module.disconnect_for_each_screen(func)
screen.disconnect_signal("added", func)
util.deprecate("Use awful.screen.disconnect_for_each_screen")
ascreen.disconnect_for_each_screen(func)
end
return module

View file

@ -14,7 +14,9 @@ local wallpaper = { mt = {} }
-- The size of the root window
local root_geom = { x = 0, y = 0, width = 0, height = 0 }
require("gears.screen").connect_for_each_screen(function(s)
-- Gears should not depend on awful or C-API, this should be fixed eventually
require("awful.screen").connect_for_each_screen(function(s)
local g = s.geometry
root_geom.width = math.max(root_geom.width, g.x + g.width)
root_geom.height = math.max(root_geom.height, g.y + g.height)

View file

@ -143,7 +143,7 @@ local suspended = false
-- @field id Unique notification id based on a counter
-- @table notifications
naughty.notifications = { suspended = { } }
require("gears.screen").connect_for_each_screen(function(s)
screen.connect_for_each_screen(function(s)
naughty.notifications[s] = {
top_left = {},
top_middle = {},