autofocus: use request::focus instead of request::activate

In #152 I've changed the autofocus handler to emit the request::activate
signal, instead of setting client.focus only.

This is wrong IMHO, and can be annoying:

If you have two floating clients above a tiled / maximized one, and
close one of the floating ones, with the tiled one being the one
selected by autofocus, it will be raised above the other floating
client.

This is changed now to use the new `request::focus` signal instead.

This basically reverts 20cdb5d (#152), but allows for customizing this
behavior, by overriding the default `request::focus` handler
(`ewmh.focus`).

It would be nice if there was a helper to check if a window's content
isn't visible at all (i.e. covered by other windows), and that could be
used then by the (new) default handler for request::focus - raising the
client only, if it's completely covered by another window.

Fixes https://github.com/awesomeWM/awesome/issues/217
This commit is contained in:
Daniel Hahler 2015-05-13 13:06:53 +02:00
parent 401f21f8e2
commit 6dc355cf71
1 changed files with 2 additions and 2 deletions

View File

@ -24,7 +24,7 @@ local function check_focus(obj)
if not client.focus or not client.focus:isvisible() then if not client.focus or not client.focus:isvisible() then
local c = aclient.focus.history.get(obj.screen, 0, aclient.focus.filter) local c = aclient.focus.history.get(obj.screen, 0, aclient.focus.filter)
if c then if c then
c:emit_signal('request::activate', "autofocus.check_focus") c:emit_signal("request::focus", "autofocus.check_focus")
end end
end end
end end
@ -45,7 +45,7 @@ local function check_focus_tag(t)
if client.focus and client.focus.screen ~= s then if client.focus and client.focus.screen ~= s then
local c = aclient.focus.history.get(s, 0, aclient.focus.filter) local c = aclient.focus.history.get(s, 0, aclient.focus.filter)
if c then if c then
c:emit_signal('request::activate', "autofocus.check_focus_tag") c:emit_signal("request::focus", "autofocus.check_focus_tag")
end end
end end
end end