From e293a6998284802c121bbea22704b09800b21bb8 Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Mon, 24 Aug 2009 16:32:19 +0200 Subject: [PATCH] screen: move the tagging on screen change to Lua Signed-off-by: Julien Danjou --- client.c | 7 +++---- lib/awful/tag.lua.in | 5 ++++- screen.c | 22 ++++------------------ screen.h | 2 +- 4 files changed, 12 insertions(+), 24 deletions(-) diff --git a/client.c b/client.c index ceddf83f5..5b43bca4a 100644 --- a/client.c +++ b/client.c @@ -646,8 +646,7 @@ client_manage(xcb_window_t w, xcb_get_geometry_reply_t *wgeom, int phys_screen, /* Then check clients hints */ ewmh_client_check_hints(c); - /* move client to screen, but do not tag it */ - screen_client_moveto(c, screen, false, true); + screen_client_moveto(c, screen, true); /* Push client in stack */ client_raise(c); @@ -875,7 +874,7 @@ client_resize(client_t *c, area_t geometry, bool hints) client_restore_enterleave_events(); - screen_client_moveto(c, new_screen, true, false); + screen_client_moveto(c, new_screen, false); /* execute hook */ 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; luaA_checkscreen(screen); - screen_client_moveto(c, &globalconf.screens.tab[screen], true, true); + screen_client_moveto(c, &globalconf.screens.tab[screen], true); } return 0; } diff --git a/lib/awful/tag.lua.in b/lib/awful/tag.lua.in index 86cb47c6a..3c9b8e1e1 100644 --- a/lib/awful/tag.lua.in +++ b/lib/awful/tag.lua.in @@ -334,7 +334,10 @@ function attached_add_signal(screen, ...) end -- 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 }) diff --git a/screen.c b/screen.c index 5edf6cc8b..5a2c8e532 100644 --- a/screen.c +++ b/screen.c @@ -256,12 +256,11 @@ screen_virttophys(int screen) /** Move a client to a virtual screen. * \param c The client to move. * \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 * y of the new screen. */ 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; 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) c->titlebar->screen = new_screen; - if(dotag) - { - /* remove old tags */ - 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); - } - } + /* remove old tags */ + foreach(old_tag, old_screen->tags) + untag_client(c, *old_tag); if(!doresize) { diff --git a/screen.h b/screen.h index b66c8e875..2172ac756 100644 --- a/screen.h +++ b/screen.h @@ -58,7 +58,7 @@ screen_t *screen_getbycoord(screen_t *, int, int); area_t screen_area_get(screen_t *, bool); area_t display_area_get(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 *); #endif