screen: move the tagging on screen change to Lua

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2009-08-24 16:32:19 +02:00
parent 4d4bdb3100
commit e293a69982
4 changed files with 12 additions and 24 deletions

View File

@ -646,8 +646,7 @@ client_manage(xcb_window_t w, xcb_get_geometry_reply_t *wgeom, int phys_screen,
/* Then check clients hints */ /* Then check clients hints */
ewmh_client_check_hints(c); ewmh_client_check_hints(c);
/* move client to screen, but do not tag it */ screen_client_moveto(c, screen, true);
screen_client_moveto(c, screen, false, true);
/* Push client in stack */ /* Push client in stack */
client_raise(c); client_raise(c);
@ -875,7 +874,7 @@ client_resize(client_t *c, area_t geometry, bool hints)
client_restore_enterleave_events(); client_restore_enterleave_events();
screen_client_moveto(c, new_screen, true, false); screen_client_moveto(c, new_screen, false);
/* execute hook */ /* execute hook */
hook_property(c, "geometry"); hook_property(c, "geometry");
@ -1617,7 +1616,7 @@ luaA_client_set_screen(lua_State *L, client_t *c)
{ {
int screen = luaL_checknumber(L, -1) - 1; int screen = luaL_checknumber(L, -1) - 1;
luaA_checkscreen(screen); luaA_checkscreen(screen);
screen_client_moveto(c, &globalconf.screens.tab[screen], true, true); screen_client_moveto(c, &globalconf.screens.tab[screen], true);
} }
return 0; return 0;
} }

View File

@ -334,7 +334,10 @@ function attached_add_signal(screen, ...)
end end
-- Register standards signals -- Register standards signals
capi.client.add_signal("manage", withcurrent) capi.client.add_signal("manage", function(c)
withcurrent(c)
c:add_signal("property::screen", withcurrent)
end)
setmetatable(_M, { __call = function (_, ...) return new(...) end }) setmetatable(_M, { __call = function (_, ...) return new(...) end })

View File

@ -256,12 +256,11 @@ screen_virttophys(int screen)
/** Move a client to a virtual screen. /** Move a client to a virtual screen.
* \param c The client to move. * \param c The client to move.
* \param new_screen The destinatiuon screen. * \param new_screen The destinatiuon screen.
* \param dotag Set to true if we also change tags.
* \param doresize Set to true if we also move the client to the new x and * \param doresize Set to true if we also move the client to the new x and
* y of the new screen. * y of the new screen.
*/ */
void void
screen_client_moveto(client_t *c, screen_t *new_screen, bool dotag, bool doresize) 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;
@ -274,22 +273,9 @@ screen_client_moveto(client_t *c, screen_t *new_screen, bool dotag, bool doresiz
if(c->titlebar) if(c->titlebar)
c->titlebar->screen = new_screen; c->titlebar->screen = new_screen;
if(dotag) /* remove old tags */
{ foreach(old_tag, old_screen->tags)
/* remove old tags */ untag_client(c, *old_tag);
foreach(old_tag, old_screen->tags)
untag_client(c, *old_tag);
/* \todo move this to Lua */
if(!c->sticky)
/* add new tags */
foreach(new_tag, new_screen->tags)
if(tag_get_selected(*new_tag))
{
luaA_object_push(globalconf.L, *new_tag);
tag_client(c);
}
}
if(!doresize) if(!doresize)
{ {

View File

@ -58,7 +58,7 @@ screen_t *screen_getbycoord(screen_t *, int, int);
area_t screen_area_get(screen_t *, bool); area_t screen_area_get(screen_t *, bool);
area_t display_area_get(int); area_t display_area_get(int);
int screen_virttophys(int); int screen_virttophys(int);
void screen_client_moveto(client_t *, screen_t *, bool, bool); void screen_client_moveto(client_t *, screen_t *, bool);
int luaA_pushscreen(lua_State *, screen_t *); int luaA_pushscreen(lua_State *, screen_t *);
#endif #endif