Fixes module namespace issues in screen.lua and client.lua
The wrong module names were introduced in commits:0e2960ebf3
andd799ac76aa
. Once fixed, client.lua and screen.lua mutually require each other, so we must use a trick, and load the modules inside the functions that need them. Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
parent
34c1c7d416
commit
ed9f218669
|
@ -20,10 +20,14 @@ local capi =
|
|||
screen = screen,
|
||||
}
|
||||
|
||||
-- we use require("awful.screen") inside functions to prevent circular dependencies.
|
||||
local screen
|
||||
|
||||
--- Useful client manipulation functions.
|
||||
-- awful.client
|
||||
local client = {}
|
||||
|
||||
|
||||
-- Private data
|
||||
client.data = {}
|
||||
client.data.focus = {}
|
||||
|
@ -277,6 +281,7 @@ end
|
|||
-- @param dir The direction, can be either "up", "down", "left" or "right".
|
||||
-- @param c Optional client.
|
||||
function client.focus.global_bydirection(dir, c)
|
||||
screen = screen or require("awful.screen")
|
||||
local sel = c or capi.client.focus
|
||||
local scr = capi.mouse.screen
|
||||
if sel then
|
||||
|
@ -288,7 +293,7 @@ function client.focus.global_bydirection(dir, c)
|
|||
|
||||
-- if focus not changed, we must change screen
|
||||
if sel == capi.client.focus then
|
||||
awful.screen.focus_bydirection(dir, scr)
|
||||
screen.focus_bydirection(dir, scr)
|
||||
if scr ~= capi.mouse.screen then
|
||||
local cltbl = client.visible(capi.mouse.screen)
|
||||
local geomtbl = {}
|
||||
|
@ -338,10 +343,11 @@ end
|
|||
-- @param dir The direction, can be either "up", "down", "left" or "right".
|
||||
-- @param c Optional client.
|
||||
function client.swap.global_bydirection(dir, c)
|
||||
screen = screen or require("awful.screen")
|
||||
local sel = c or capi.client.focus
|
||||
local screen = capi.mouse.screen
|
||||
local scr = capi.mouse.screen
|
||||
if sel then
|
||||
screen = sel.screen
|
||||
scr = sel.screen
|
||||
end
|
||||
|
||||
if sel then
|
||||
|
@ -355,15 +361,15 @@ function client.swap.global_bydirection(dir, c)
|
|||
|
||||
-- swapping to an empty screen
|
||||
elseif sel.screen ~= c.screen and sel == c then
|
||||
awful.client.movetoscreen(sel, capi.mouse.screen)
|
||||
client.movetoscreen(sel, capi.mouse.screen)
|
||||
|
||||
--swapping to a nonempty screen
|
||||
elseif sel.screen ~= c.screen and sel ~= c then
|
||||
awful.client.movetoscreen(sel, c.screen)
|
||||
awful.client.movetoscreen(c, screen)
|
||||
client.movetoscreen(sel, c.screen)
|
||||
client.movetoscreen(c, scr)
|
||||
end
|
||||
|
||||
awful.screen.focus(sel.screen)
|
||||
screen.focus(sel.screen)
|
||||
capi.client.focus = sel
|
||||
end
|
||||
end
|
||||
|
@ -484,6 +490,7 @@ end
|
|||
-- @param c The client to move.
|
||||
-- @param s The screen number, default to current + 1.
|
||||
function client.movetoscreen(c, s)
|
||||
screen = screen or require("awful.screen")
|
||||
local sel = c or capi.client.focus
|
||||
if sel then
|
||||
local sc = capi.screen.count()
|
||||
|
@ -492,7 +499,7 @@ function client.movetoscreen(c, s)
|
|||
end
|
||||
if s > sc then s = 1 elseif s < 1 then s = sc end
|
||||
sel.screen = s
|
||||
awful.screen.focus(s)
|
||||
screen.focus(s)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -577,11 +584,11 @@ function client.floating.set(c, s)
|
|||
local c = c or capi.client.focus
|
||||
if c and client.property.get(c, "floating") ~= s then
|
||||
client.property.set(c, "floating", s)
|
||||
local screen = c.screen
|
||||
local scr = c.screen
|
||||
if s == true then
|
||||
c:geometry(client.property.get(c, "floating_geometry"))
|
||||
end
|
||||
c.screen = screen
|
||||
c.screen = scr
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -12,7 +12,9 @@ local capi =
|
|||
client = client
|
||||
}
|
||||
local util = require("awful.util")
|
||||
local client = require("awful.client")
|
||||
|
||||
-- we use require("awful.client") inside functions to prevent circular dependencies.
|
||||
local client
|
||||
|
||||
--- Screen module for awful
|
||||
-- awful.screen
|
||||
|
@ -40,6 +42,7 @@ end
|
|||
--- Give the focus to a screen, and move pointer. Keeps relative position of the pointer on the screen.
|
||||
-- @param screen Screen number.
|
||||
function screen.focus(_screen)
|
||||
client = client or require("awful.client")
|
||||
if _screen > capi.screen.count() then _screen = capi.mouse.screen end
|
||||
|
||||
-- screen and pos for current screen
|
||||
|
|
Loading…
Reference in New Issue