Retain focus on clients moved across screens (fs#620)

Signed-off-by: Perry Hargrave <resixian@gmail.com>
Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Perry Hargrave 2011-07-07 09:49:58 -07:00 committed by Uli Schlachter
parent a23817718e
commit d8883f89fc
1 changed files with 8 additions and 0 deletions

View File

@ -264,10 +264,14 @@ screen_client_moveto(client_t *c, screen_t *new_screen, bool doresize)
{ {
screen_t *old_screen = c->screen; screen_t *old_screen = c->screen;
area_t from, to; area_t from, to;
bool had_focus = false;
if(new_screen == c->screen) if(new_screen == c->screen)
return; return;
if (globalconf.screens.tab[c->phys_screen].client_focus == c)
had_focus = true;
c->screen = new_screen; c->screen = new_screen;
if(c->titlebar) 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_push(globalconf.L, c);
luaA_object_emit_signal(globalconf.L, -1, "property::screen", 0); luaA_object_emit_signal(globalconf.L, -1, "property::screen", 0);
lua_pop(globalconf.L, 1); lua_pop(globalconf.L, 1);
if(had_focus)
client_focus(c);
return; 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_push(globalconf.L, c);
luaA_object_emit_signal(globalconf.L, -1, "property::screen", 0); luaA_object_emit_signal(globalconf.L, -1, "property::screen", 0);
lua_pop(globalconf.L, 1); lua_pop(globalconf.L, 1);
if(had_focus)
client_focus(c);
} }
/** Push a screen onto the stack. /** Push a screen onto the stack.