From d8883f89fcc372588c843903f1cfbf93623e0dd8 Mon Sep 17 00:00:00 2001 From: Perry Hargrave Date: Thu, 7 Jul 2011 09:49:58 -0700 Subject: [PATCH] Retain focus on clients moved across screens (fs#620) Signed-off-by: Perry Hargrave Signed-off-by: Uli Schlachter --- screen.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/screen.c b/screen.c index 865ef397d..94be2a23a 100644 --- a/screen.c +++ b/screen.c @@ -264,10 +264,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.screens.tab[c->phys_screen].client_focus == c) + had_focus = true; + c->screen = new_screen; if(c->titlebar) @@ -284,6 +288,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; } @@ -337,6 +343,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.