Merge pull request #95 from blueyed/signal-client-property-screen-old

Send old_screen with "property::screen" client signal
This commit is contained in:
Daniel Hahler 2015-02-20 23:25:38 +01:00
commit d1984a7a1f
2 changed files with 17 additions and 6 deletions

View File

@ -152,10 +152,12 @@ capi.client.connect_signal("property::border_width", arrange_prop)
capi.client.connect_signal("property::hidden", arrange_prop)
capi.client.connect_signal("property::floating", arrange_prop)
capi.client.connect_signal("property::geometry", arrange_prop)
-- If prop is screen, we do not know what was the previous screen, so
-- let's arrange all screens :-(
capi.client.connect_signal("property::screen", function(c)
for screen = 1, capi.screen.count() do layout.arrange(screen) end end)
capi.client.connect_signal("property::screen", function(c, old_screen)
if old_screen then
layout.arrange(old_screen)
end
layout.arrange(c.screen)
end)
local function arrange_on_tagged(c, tag)
if not tag.screen then return end

View File

@ -373,6 +373,7 @@ screen_client_moveto(client_t *c, screen_t *new_screen, bool doresize)
{
lua_State *L = globalconf_get_lua_State();
screen_t *old_screen = c->screen;
int old_screen_idx = screen_get_index(old_screen);
area_t from, to;
bool had_focus = false;
@ -387,7 +388,11 @@ screen_client_moveto(client_t *c, screen_t *new_screen, bool doresize)
if(!doresize)
{
luaA_object_push(L, c);
luaA_object_emit_signal(L, -1, "property::screen", 0);
if(old_screen_idx != 0)
lua_pushinteger(L, old_screen_idx);
else
lua_pushnil(L);
luaA_object_emit_signal(L, -2, "property::screen", 1);
lua_pop(L, 1);
if(had_focus)
client_focus(c);
@ -417,7 +422,11 @@ screen_client_moveto(client_t *c, screen_t *new_screen, bool doresize)
/* move / resize the client */
client_resize(c, new_geometry, false);
luaA_object_push(L, c);
luaA_object_emit_signal(L, -1, "property::screen", 0);
if(old_screen_idx != 0)
lua_pushinteger(L, old_screen_idx);
else
lua_pushnil(L);
luaA_object_emit_signal(L, -2, "property::screen", 1);
lua_pop(L, 1);
if(had_focus)
client_focus(c);