Use request::activate with raise=false instead

Ref: https://github.com/awesomeWM/awesome/pull/224#issuecomment-101790416
This commit is contained in:
Daniel Hahler 2015-05-13 22:11:07 +02:00
parent 6dc355cf71
commit ed09d8ed4f
8 changed files with 23 additions and 30 deletions

3
ewmh.c
View File

@ -430,7 +430,8 @@ ewmh_process_client_message(xcb_client_message_event_t *ev)
lua_State *L = globalconf_get_lua_State(); lua_State *L = globalconf_get_lua_State();
luaA_object_push(L, c); luaA_object_push(L, c);
lua_pushstring(L, "ewmh"); lua_pushstring(L, "ewmh");
luaA_object_emit_signal(L, -2, "request::activate", 1); lua_pushboolean(L, true);
luaA_object_emit_signal(L, -3, "request::activate", 2);
lua_pop(L, 1); lua_pop(L, 1);
} }
} }

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::focus", "autofocus.check_focus") c:emit_signal("request::activate", "autofocus.check_focus", false)
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::focus", "autofocus.check_focus_tag") c:emit_signal("request::activate", "autofocus.check_focus_tag", false)
end end
end end
end end

View File

@ -70,9 +70,7 @@ function client.jumpto(c, merge)
end end
end end
-- focus the client c:emit_signal("request::activate", "client.jumpto", true)
c:emit_signal("request::focus", "client.jumpto")
c:raise()
end end
--- Get the first client that got the urgent hint. --- Get the first client that got the urgent hint.
@ -214,7 +212,7 @@ function client.focus.history.previous()
end end
local c = client.focus.history.get(s, 1) local c = client.focus.history.get(s, 1)
if c then if c then
c:emit_signal("request::focus", "client.focus.history.previous") c:emit_signal("request::activate", "client.focus.history.previous", false)
end end
end end
@ -305,7 +303,7 @@ function client.focus.bydirection(dir, c)
-- If we found a client to focus, then do it. -- If we found a client to focus, then do it.
if target then if target then
cltbl[target]:emit_signal("request::focus", "client.focus.bydirection") cltbl[target]:emit_signal("request::activate", "client.focus.bydirection", false)
end end
end end
end end
@ -337,7 +335,7 @@ function client.focus.global_bydirection(dir, c)
local target = util.get_rectangle_in_direction(dir, geomtbl, capi.screen[scr].geometry) local target = util.get_rectangle_in_direction(dir, geomtbl, capi.screen[scr].geometry)
if target then if target then
cltbl[target]:emit_signal("request::focus", "client.focus.global_bydirection") cltbl[target]:emit_signal("request::activate", "client.focus.global_bydirection", false)
end end
end end
end end
@ -350,7 +348,7 @@ end
function client.focus.byidx(i, c) function client.focus.byidx(i, c)
local target = client.next(i, c) local target = client.next(i, c)
if target then if target then
target:emit_signal("request::focus", "client.focus.byidx") target:emit_signal("request::activate", "client.focus.byidx", false)
end end
end end
@ -405,7 +403,7 @@ function client.swap.global_bydirection(dir, c)
end end
screen.focus(sel.screen) screen.focus(sel.screen)
sel:emit_signal("request::focus", "client.swap.global_bydirection") sel:emit_signal("request::activate", "client.swap.global_bydirection", false)
end end
end end

View File

@ -156,21 +156,17 @@ end
--- Activate a window --- Activate a window
-- --
-- @client c A client to use -- @client c A client to use
function ewmh.activate(c) -- @tparam string context The context where this signal was used.
if awesome.startup or c:isvisible() then -- @tparam boolean raise Should the client be raised?
function ewmh.activate(c, context, raise)
client.focus = c client.focus = c
if raise then
if awesome.startup or c:isvisible() then
c:raise() c:raise()
else else
c.urgent = true c.urgent = true
end end
end end
--- Focus a window.
--
-- @client c The client.
-- @tparam string context The context where this signal was used.
function ewmh.focus(c, context)
client.focus = c
end end
--- Tag a window with its requested tag --- Tag a window with its requested tag
@ -193,7 +189,6 @@ function ewmh.urgent(c, urgent)
end end
client.connect_signal("request::activate", ewmh.activate) client.connect_signal("request::activate", ewmh.activate)
client.connect_signal("request::focus", ewmh.focus)
client.connect_signal("request::tag", ewmh.tag) client.connect_signal("request::tag", ewmh.tag)
client.connect_signal("request::urgent", ewmh.urgent) client.connect_signal("request::urgent", ewmh.urgent)
client.connect_signal("request::maximized_horizontal", maximized_horizontal) client.connect_signal("request::maximized_horizontal", maximized_horizontal)

View File

@ -179,7 +179,7 @@ local function arrange_on_tagged(c, tag)
if not capi.client.focus or not capi.client.focus:isvisible() then if not capi.client.focus or not capi.client.focus:isvisible() then
local c = client.focus.history.get(tag.screen, 0) local c = client.focus.history.get(tag.screen, 0)
if c then if c then
c:emit_signal("request::focus", "layout.arrange_on_tagged") c:emit_signal("request::activate", "layout.arrange_on_tagged", false)
end end
end end
end end

View File

@ -476,8 +476,7 @@ function menu.clients(args, item_args)
if not c:isvisible() then if not c:isvisible() then
tags.viewmore(c:tags(), c.screen) tags.viewmore(c:tags(), c.screen)
end end
c:emit_signal("request::focus", "menu.clients") c:emit_signal("request::activate", "menu.clients", true)
c:raise()
end, end,
c.icon } c.icon }
if item_args then if item_args then

View File

@ -217,7 +217,7 @@ function rules.execute(c, props, callbacks)
-- Do this at last so we do not erase things done by the focus -- Do this at last so we do not erase things done by the focus
-- signal. -- signal.
if props.focus and (type(props.focus) ~= "function" or props.focus(c)) then if props.focus and (type(props.focus) ~= "function" or props.focus(c)) then
c:emit_signal('request::activate',"rules") c:emit_signal('request::activate', "rules", false)
end end
end end

View File

@ -67,7 +67,7 @@ function screen.focus(_screen)
local c = client.focus.history.get(_screen, 0) local c = client.focus.history.get(_screen, 0)
if c then if c then
c:emit_signal("request::focus", "screen.focus") c:emit_signal("request::activate", "screen.focus", false)
end end
end end