Merge pull request #87 from blueyed/fix-client-visible-during-activate

awful.rules.execute: use delayed_call for emitting request::activate
This commit is contained in:
Daniel Hahler 2015-02-13 02:02:15 +01:00
commit c74b11fee8
4 changed files with 18 additions and 3 deletions

View File

@ -545,6 +545,10 @@ main(int argc, char **argv)
g_main_context_set_poll_func(g_main_context_default(), &a_glib_poll); g_main_context_set_poll_func(g_main_context_default(), &a_glib_poll);
gettimeofday(&last_wakeup, NULL); gettimeofday(&last_wakeup, NULL);
/* Do all deferred work now once outside of the loop to get awesome.startup
* right. */
awesome_refresh();
/* main event loop */ /* main event loop */
globalconf.loop = g_main_loop_new(NULL, FALSE); globalconf.loop = g_main_loop_new(NULL, FALSE);
g_main_loop_run(globalconf.loop); g_main_loop_run(globalconf.loop);

View File

@ -253,11 +253,16 @@ luaA_object_emit_signal(lua_State *L, int oud,
const char *name, int nargs) const char *name, int nargs)
{ {
int oud_abs = luaA_absindex(L, oud); int oud_abs = luaA_absindex(L, oud);
lua_object_t *obj = lua_touserdata(L, oud); lua_class_t *lua_class = luaA_class_get(L, oud);
lua_object_t *obj = luaA_toudata(L, oud, lua_class);
if(!obj) { if(!obj) {
warn("Trying to emit signal '%s' on non-object", name); warn("Trying to emit signal '%s' on non-object", name);
return; return;
} }
else if(lua_class->checker && !lua_class->checker(obj)) {
warn("Trying to emit signal '%s' on invalid object", name);
return;
}
signal_t *sigfound = signal_array_getbyid(&obj->signals, signal_t *sigfound = signal_array_getbyid(&obj->signals,
a_strhash((const unsigned char *) name)); a_strhash((const unsigned char *) name));
if(sigfound) if(sigfound)

View File

@ -12,6 +12,7 @@ local ipairs = ipairs
local pairs = pairs local pairs = pairs
local aclient = require("awful.client") local aclient = require("awful.client")
local atag = require("awful.tag") local atag = require("awful.tag")
local timer = require("gears.timer")
--- Apply rules to clients at startup. --- Apply rules to clients at startup.
-- awful.rules -- awful.rules
@ -234,8 +235,11 @@ 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
local cb = function(c)
c:emit_signal('request::activate', "rules") c:emit_signal('request::activate', "rules")
end end
timer.delayed_call(cb, c)
end
end end
client.connect_signal("manage", rules.apply) client.connect_signal("manage", rules.apply)

View File

@ -630,7 +630,9 @@ capi.client.connect_signal("manage", function(c)
c:connect_signal("property::screen", tag.withcurrent) c:connect_signal("property::screen", tag.withcurrent)
end) end)
capi.client.connect_signal("manage", tag.withcurrent) capi.client.connect_signal("manage", function(c)
timer.delayed_call(tag.withcurrent, c)
end)
capi.tag.connect_signal("request::select", tag.viewonly) capi.tag.connect_signal("request::select", tag.viewonly)
capi.tag.add_signal("property::hide") capi.tag.add_signal("property::hide")