From d5e365804ca7823799fbfc85691d12d39e52cd70 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Tue, 21 Jul 2015 15:31:18 +0200 Subject: [PATCH] screen_client_moveto: only emit property::screen if it changed While debugging #331, I have noticed that the call to `client_resize` might have changed the screen (and emitted the signal) already, via a call to `screen_client_moveto` with `doresize=False`. Closes https://github.com/awesomeWM/awesome/pull/332. --- objects/screen.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/objects/screen.c b/objects/screen.c index 718772fc..32cdbaa6 100644 --- a/objects/screen.c +++ b/objects/screen.c @@ -445,14 +445,18 @@ screen_client_moveto(client_t *c, screen_t *new_screen, bool doresize) /* move / resize the client */ client_resize(c, new_geometry, false); - /* emit signal */ - luaA_object_push(L, c); - 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); + /* Emit signal, but only in case the call to client_resize had not changed + * it already. */ + if(old_screen != c->screen) + { + luaA_object_push(L, c); + 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);