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 45576b6c6f
commit 4be3ae0120
1 changed files with 8 additions and 0 deletions

View File

@ -342,10 +342,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.focus.client == c)
had_focus = true;
c->screen = new_screen; c->screen = new_screen;
/* If client was on a screen, remove old tags */ /* 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_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;
} }
@ -386,6 +392,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.