Use `hints` table argument with `request::activate` signal
This commit is contained in:
parent
b7e2508144
commit
cb7f4b06eb
6
ewmh.c
6
ewmh.c
|
@ -430,7 +430,13 @@ 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");
|
||||||
|
|
||||||
|
/* Create table argument with raise=true. */
|
||||||
|
lua_newtable(L);
|
||||||
|
lua_pushstring(L, "raise");
|
||||||
lua_pushboolean(L, true);
|
lua_pushboolean(L, true);
|
||||||
|
lua_settable(L, -3);
|
||||||
|
|
||||||
luaA_object_emit_signal(L, -3, "request::activate", 2);
|
luaA_object_emit_signal(L, -3, "request::activate", 2);
|
||||||
lua_pop(L, 1);
|
lua_pop(L, 1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,8 @@ 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", false)
|
c:emit_signal("request::activate", "autofocus.check_focus",
|
||||||
|
{raise=false})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -45,7 +46,8 @@ 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", false)
|
c:emit_signal("request::activate", "autofocus.check_focus_tag",
|
||||||
|
{raise=false})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -70,7 +70,7 @@ function client.jumpto(c, merge)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
c:emit_signal("request::activate", "client.jumpto", true)
|
c:emit_signal("request::activate", "client.jumpto", {raise=true})
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Get the first client that got the urgent hint.
|
--- Get the first client that got the urgent hint.
|
||||||
|
@ -212,7 +212,8 @@ 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::activate", "client.focus.history.previous", false)
|
c:emit_signal("request::activate", "client.focus.history.previous",
|
||||||
|
{raise=false})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -303,7 +304,8 @@ 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::activate", "client.focus.bydirection", false)
|
cltbl[target]:emit_signal("request::activate",
|
||||||
|
"client.focus.bydirection", {raise=false})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -335,7 +337,9 @@ 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::activate", "client.focus.global_bydirection", false)
|
cltbl[target]:emit_signal("request::activate",
|
||||||
|
"client.focus.global_bydirection",
|
||||||
|
{raise=false})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -348,7 +352,8 @@ 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::activate", "client.focus.byidx", true)
|
target:emit_signal("request::activate", "client.focus.byidx",
|
||||||
|
{raise=true})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -403,7 +408,8 @@ function client.swap.global_bydirection(dir, c)
|
||||||
end
|
end
|
||||||
|
|
||||||
screen.focus(sel.screen)
|
screen.focus(sel.screen)
|
||||||
sel:emit_signal("request::activate", "client.swap.global_bydirection", false)
|
sel:emit_signal("request::activate", "client.swap.global_bydirection",
|
||||||
|
{raise=false})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -157,8 +157,9 @@ end
|
||||||
--
|
--
|
||||||
-- @client c A client to use
|
-- @client c A client to use
|
||||||
-- @tparam string context The context where this signal was used.
|
-- @tparam string context The context where this signal was used.
|
||||||
-- @tparam boolean raise Should the client be raised?
|
-- @tparam table hints A table with additional hints:
|
||||||
function ewmh.activate(c, context, raise)
|
-- @tparam boolean hints.raise should the client be raised? (default false)
|
||||||
|
function ewmh.activate(c, context, hints)
|
||||||
client.focus = c
|
client.focus = c
|
||||||
if raise then
|
if raise then
|
||||||
if awesome.startup or c:isvisible() then
|
if awesome.startup or c:isvisible() then
|
||||||
|
|
|
@ -179,7 +179,8 @@ 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::activate", "layout.arrange_on_tagged", false)
|
c:emit_signal("request::activate", "layout.arrange_on_tagged",
|
||||||
|
{raise=false})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -476,7 +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::activate", "menu.clients", true)
|
c:emit_signal("request::activate", "menu.clients", {raise=true})
|
||||||
end,
|
end,
|
||||||
c.icon }
|
c.icon }
|
||||||
if item_args then
|
if item_args then
|
||||||
|
|
|
@ -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", false)
|
c:emit_signal('request::activate', "rules", {raise=false})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -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::activate", "screen.focus", false)
|
c:emit_signal("request::activate", "screen.focus", {raise=false})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue