diff --git a/screen.c b/screen.c index e0cbae7a..3dec0129 100644 --- a/screen.c +++ b/screen.c @@ -342,10 +342,14 @@ screen_client_moveto(client_t *c, screen_t *new_screen, bool doresize) { screen_t *old_screen = c->screen; area_t from, to; + bool had_focus = false; if(new_screen == c->screen) return; + if (globalconf.focus.client == c) + had_focus = true; + c->screen = new_screen; /* If client was on a screen, remove old tags */ @@ -358,6 +362,8 @@ screen_client_moveto(client_t *c, screen_t *new_screen, bool doresize) luaA_object_push(globalconf.L, c); luaA_object_emit_signal(globalconf.L, -1, "property::screen", 0); lua_pop(globalconf.L, 1); + if(had_focus) + client_focus(c); return; } @@ -386,6 +392,8 @@ screen_client_moveto(client_t *c, screen_t *new_screen, bool doresize) luaA_object_push(globalconf.L, c); luaA_object_emit_signal(globalconf.L, -1, "property::screen", 0); lua_pop(globalconf.L, 1); + if(had_focus) + client_focus(c); } /** Push a screen onto the stack.