client: stop default tagging of sticky windows

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2008-09-05 02:05:30 +02:00
parent 126e2dc0ec
commit bf451445c3
4 changed files with 39 additions and 15 deletions

View File

@ -388,7 +388,6 @@ client_manage(xcb_window_t w, xcb_get_geometry_reply_t *wgeom, int phys_screen,
{ {
xcb_get_property_cookie_t ewmh_icon_cookie; xcb_get_property_cookie_t ewmh_icon_cookie;
client_t *c; client_t *c;
bool retloadprops;
const uint32_t select_input_val[] = const uint32_t select_input_val[] =
{ {
XCB_EVENT_MASK_STRUCTURE_NOTIFY XCB_EVENT_MASK_STRUCTURE_NOTIFY
@ -429,12 +428,33 @@ client_manage(xcb_window_t w, xcb_get_geometry_reply_t *wgeom, int phys_screen,
client_updatewmhints(c); client_updatewmhints(c);
/* Try to load props if any */ /* Try to load props if any */
if(!(retloadprops = client_loadprops(c, &globalconf.screens[screen]))) client_loadprops(c, &globalconf.screens[screen]);
screen_client_moveto(c, screen, true);
/* move client to screen, but do not tag it for now */
screen_client_moveto(c, screen, false, true);
/* Then check clients hints */ /* Then check clients hints */
ewmh_check_client_hints(c); ewmh_check_client_hints(c);
/* Check if client has been tagged by loading props, or maybe with its
* hints.
* If not, we tag it with current selected ones.
* This could be done on Lua side, but it's a sane behaviour. */
if(!c->issticky)
{
int i;
tag_array_t *tags = &globalconf.screens[screen].tags;
for(i = 0; i < tags->len; i++)
if(is_client_tagged(c, tags->tab[i]))
break;
/* if no tag, set current selected */
if(i == tags->len)
for(i = 0; i < tags->len; i++)
if(tags->tab[i]->selected)
tag_client(c, tags->tab[i]);
}
/* Push client in client list */ /* Push client in client list */
client_list_push(&globalconf.clients, c); client_list_push(&globalconf.clients, c);
client_ref(&c); client_ref(&c);
@ -581,7 +601,7 @@ client_resize(client_t *c, area_t geometry, bool hints)
window_configure(c->win, geometry, c->border); window_configure(c->win, geometry, c->border);
if(c->screen != new_screen) if(c->screen != new_screen)
screen_client_moveto(c, new_screen, false); screen_client_moveto(c, new_screen, true, false);
resized = true; resized = true;
} }
@ -1270,7 +1290,7 @@ luaA_client_newindex(lua_State *L)
i = luaL_checknumber(L, 3) - 1; i = luaL_checknumber(L, 3) - 1;
luaA_checkscreen(i); luaA_checkscreen(i);
if(i != (*c)->screen) if(i != (*c)->screen)
screen_client_moveto(*c, i, true); screen_client_moveto(*c, i, true, true);
} }
break; break;
case A_TK_HIDE: case A_TK_HIDE:

View File

@ -543,7 +543,7 @@ mouse_client_move(client_t *c, int snap, bool infobox)
newscreen = screen_getbycoord(c->screen, mouse_x, mouse_y); newscreen = screen_getbycoord(c->screen, mouse_x, mouse_y);
if(newscreen != c->screen) if(newscreen != c->screen)
{ {
screen_client_moveto(c, newscreen, true); screen_client_moveto(c, newscreen, true, true);
globalconf.screens[c->screen].need_arrange = true; globalconf.screens[c->screen].need_arrange = true;
globalconf.screens[newscreen].need_arrange = true; globalconf.screens[newscreen].need_arrange = true;
layout_refresh(); layout_refresh();

View File

@ -194,11 +194,12 @@ 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 number. * \param new_screen The destinatiuon screen number.
* \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, int new_screen, bool doresize) screen_client_moveto(client_t *c, int new_screen, bool dotag, bool doresize)
{ {
int i, old_screen = c->screen; int i, old_screen = c->screen;
tag_array_t *old_tags = &globalconf.screens[old_screen].tags, tag_array_t *old_tags = &globalconf.screens[old_screen].tags,
@ -208,14 +209,17 @@ screen_client_moveto(client_t *c, int new_screen, bool doresize)
c->screen = new_screen; c->screen = new_screen;
/* remove old tags */ if(dotag && !c->issticky)
for(i = 0; i < old_tags->len; i++) {
untag_client(c, old_tags->tab[i]); /* remove old tags */
for(i = 0; i < old_tags->len; i++)
untag_client(c, old_tags->tab[i]);
/* add new tags */ /* add new tags */
for(i = 0; i < new_tags->len; i++) for(i = 0; i < new_tags->len; i++)
if(new_tags->tab[i]->selected) if(new_tags->tab[i]->selected)
tag_client(c, new_tags->tab[i]); tag_client(c, new_tags->tab[i]);
}
/* resize the windows if it's floating */ /* resize the windows if it's floating */
if(doresize && old_screen != c->screen) if(doresize && old_screen != c->screen)

View File

@ -30,7 +30,7 @@ int screen_getbycoord(int, int, int);
area_t screen_area_get(int, statusbar_t *, padding_t *, bool); area_t screen_area_get(int, statusbar_t *, padding_t *, bool);
area_t display_area_get(int, statusbar_t *, padding_t *); area_t display_area_get(int, statusbar_t *, padding_t *);
int screen_virttophys(int); int screen_virttophys(int);
void screen_client_moveto(client_t *, int, bool); void screen_client_moveto(client_t *, int, bool, bool);
#endif #endif
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80 // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80