openbsd-ports/x11/awesome/patches/patch-lib_awful_autofocus_lua_in
dcoppa 4a237d064c From upstream git:
- Various bugfixes to Lua code.
- Fix a bug causing building with cmake 2.8.4 to fail (remove double
  slashes from icon path names).
2011-03-13 18:07:23 +00:00

37 lines
1.5 KiB
Plaintext

$OpenBSD: patch-lib_awful_autofocus_lua_in,v 1.1 2011/03/13 18:07:23 dcoppa Exp $
--- lib/awful/autofocus.lua.in.orig Thu Mar 10 17:01:25 2011
+++ lib/awful/autofocus.lua.in Thu Mar 10 17:08:21 2011
@@ -13,19 +13,28 @@ local atag = require("awful.tag")
-- on event such as tag switching, client unmanaging, etc.
module("awful.autofocus")
--- Give focus on tag selection change.
+-- Give focus when clients appear/disappear.
-- @param obj An object that should have a .screen property.
local function check_focus(obj)
+ -- When no visible client has the focus...
if not client.focus or not client.focus:isvisible() then
local c = aclient.focus.history.get(obj.screen, 0)
if c then client.focus = c end
- elseif client.focus and client.focus.screen ~= obj.screen then
- local c = aclient.focus.history.get(obj.screen, 0)
+ end
+end
+
+-- Give focus on tag selection change.
+-- @param obj An object that should have a .screen property.
+local function check_focus_screen(obj)
+ check_focus(obj)
+ if client.focus and client.focus.screen ~= obj.screen then
+ local c = nil
+ c = aclient.focus.history.get(obj.screen, 0)
if c then client.focus = c end
end
end
-atag.attached_add_signal(nil, "property::selected", check_focus)
+atag.attached_add_signal(nil, "property::selected", check_focus_screen)
client.add_signal("unmanage", check_focus)
client.add_signal("new", function(c)
c:add_signal("untagged", check_focus)