is_visible check for screen

This commit is contained in:
Julien Danjou 2007-09-16 12:57:33 +02:00
parent 6ad0a0ba66
commit 0539eaa4b0
6 changed files with 20 additions and 19 deletions

View File

@ -251,6 +251,7 @@ detach(Client * c)
/** Give focus to client, or to first client if c is NULL /** Give focus to client, or to first client if c is NULL
* \param disp Display ref * \param disp Display ref
* \param screen Screen number
* \param drawcontext drawcontext ref * \param drawcontext drawcontext ref
* \param c client * \param c client
* \param selscreen True if current screen is selected * \param selscreen True if current screen is selected
@ -260,8 +261,8 @@ void
focus(Display *disp, int screen, DC *drawcontext, Client * c, Bool selscreen, awesome_config *awesomeconf) focus(Display *disp, int screen, DC *drawcontext, Client * c, Bool selscreen, awesome_config *awesomeconf)
{ {
/* if c is NULL or invisible, take next client in the stack */ /* if c is NULL or invisible, take next client in the stack */
if((!c && selscreen) || (c && !isvisible(c, awesomeconf->selected_tags, awesomeconf->ntags))) if((!c && selscreen) || (c && !isvisible(c, screen, awesomeconf->selected_tags, awesomeconf->ntags)))
for(c = stack; c && !isvisible(c, awesomeconf->selected_tags, awesomeconf->ntags); c = c->snext); for(c = stack; c && !isvisible(c, screen, awesomeconf->selected_tags, awesomeconf->ntags); c = c->snext);
/* if a client was selected but it's not the current client, unfocus it */ /* if a client was selected but it's not the current client, unfocus it */
if(sel && sel != c) if(sel && sel != c)

View File

@ -238,7 +238,7 @@ handle_event_configurerequest(XEvent * e, awesome_config *awesomeconf __attribut
c->y = DisplayHeight(c->display, c->screen) / 2 - c->h / 2; /* center in y direction */ c->y = DisplayHeight(c->display, c->screen) / 2 - c->h / 2; /* center in y direction */
if((ev->value_mask & (CWX | CWY)) && !(ev->value_mask & (CWWidth | CWHeight))) if((ev->value_mask & (CWX | CWY)) && !(ev->value_mask & (CWWidth | CWHeight)))
configure(c); configure(c);
if(isvisible(c, awesomeconf[c->screen].selected_tags, awesomeconf[c->screen].ntags)) if(isvisible(c, c->screen, awesomeconf[c->screen].selected_tags, awesomeconf[c->screen].ntags))
XMoveResizeWindow(e->xany.display, c->win, c->x, c->y, c->w, c->h); XMoveResizeWindow(e->xany.display, c->win, c->x, c->y, c->w, c->h);
} }
else else

View File

@ -41,7 +41,7 @@ arrange(Display * disp, int screen, DC *drawcontext, awesome_config *awesomeconf
{ {
if(c->screen != screen) if(c->screen != screen)
continue; continue;
if(isvisible(c, awesomeconf->selected_tags, awesomeconf->ntags)) if(isvisible(c, screen, awesomeconf->selected_tags, awesomeconf->ntags))
unban(c); unban(c);
else else
ban(c); ban(c);
@ -53,7 +53,7 @@ arrange(Display * disp, int screen, DC *drawcontext, awesome_config *awesomeconf
void void
uicb_focusnext(Display *disp __attribute__ ((unused)), uicb_focusnext(Display *disp __attribute__ ((unused)),
int screen __attribute__ ((unused)), int screen,
DC *drawcontext, DC *drawcontext,
awesome_config * awesomeconf, awesome_config * awesomeconf,
const char *arg __attribute__ ((unused))) const char *arg __attribute__ ((unused)))
@ -62,19 +62,19 @@ uicb_focusnext(Display *disp __attribute__ ((unused)),
if(!sel) if(!sel)
return; return;
for(c = sel->next; c && !isvisible(c, awesomeconf->selected_tags, awesomeconf->ntags); c = c->next); for(c = sel->next; c && !isvisible(c, screen, awesomeconf->selected_tags, awesomeconf->ntags); c = c->next);
if(!c) if(!c)
for(c = clients; c && !isvisible(c, awesomeconf->selected_tags, awesomeconf->ntags); c = c->next); for(c = clients; c && !isvisible(c, screen, awesomeconf->selected_tags, awesomeconf->ntags); c = c->next);
if(c) if(c)
{ {
focus(c->display, c->screen, drawcontext, c, True, awesomeconf); focus(c->display, screen, drawcontext, c, True, awesomeconf);
restack(c->display, c->screen, drawcontext, awesomeconf); restack(c->display, screen, drawcontext, awesomeconf);
} }
} }
void void
uicb_focusprev(Display *disp __attribute__ ((unused)), uicb_focusprev(Display *disp __attribute__ ((unused)),
int screen __attribute__ ((unused)), int screen,
DC *drawcontext, DC *drawcontext,
awesome_config *awesomeconf, awesome_config *awesomeconf,
const char *arg __attribute__ ((unused))) const char *arg __attribute__ ((unused)))
@ -83,16 +83,16 @@ uicb_focusprev(Display *disp __attribute__ ((unused)),
if(!sel) if(!sel)
return; return;
for(c = sel->prev; c && !isvisible(c, awesomeconf->selected_tags, awesomeconf->ntags); c = c->prev); for(c = sel->prev; c && !isvisible(c, screen, awesomeconf->selected_tags, awesomeconf->ntags); c = c->prev);
if(!c) if(!c)
{ {
for(c = clients; c && c->next; c = c->next); for(c = clients; c && c->next; c = c->next);
for(; c && !isvisible(c, awesomeconf->selected_tags, awesomeconf->ntags); c = c->prev); for(; c && !isvisible(c, screen, awesomeconf->selected_tags, awesomeconf->ntags); c = c->prev);
} }
if(c) if(c)
{ {
focus(c->display, c->screen, drawcontext, c, True, awesomeconf); focus(c->display, screen, drawcontext, c, True, awesomeconf);
restack(c->display, c->screen, drawcontext, awesomeconf); restack(c->display, screen, drawcontext, awesomeconf);
} }
} }

View File

@ -32,7 +32,7 @@ floating(Display *disp __attribute__ ((unused)), int screen, awesome_config *awe
Client *c; Client *c;
for(c = clients; c; c = c->next) for(c = clients; c; c = c->next)
if(isvisible(c, awesomeconf->selected_tags, awesomeconf->ntags) && c->screen == screen) if(isvisible(c, screen, awesomeconf->selected_tags, awesomeconf->ntags))
{ {
if(c->ftview) if(c->ftview)
{ {

4
tag.c
View File

@ -127,12 +127,12 @@ compileregs(Rule * rules, int nrules)
* \return True or False * \return True or False
*/ */
Bool Bool
isvisible(Client * c, Bool * tags, int ntags) isvisible(Client * c, int screen, Bool * tags, int ntags)
{ {
int i; int i;
for(i = 0; i < ntags; i++) for(i = 0; i < ntags; i++)
if(c->tags[i] && tags[i]) if(c->tags[i] && tags[i] && c->screen == screen)
return True; return True;
return False; return False;
} }

4
tag.h
View File

@ -26,10 +26,10 @@
#include "client.h" #include "client.h"
/** Check if a client is tiled */ /** Check if a client is tiled */
#define IS_TILED(client, screen, tags, ntags) (client && !client->isfloating && isvisible(client, tags, ntags) && client->screen == screen) #define IS_TILED(client, screen, tags, ntags) (client && !client->isfloating && isvisible(client, screen, tags, ntags))
void compileregs(Rule *, int); /* initialize regexps of rules defined in config.h */ void compileregs(Rule *, int); /* initialize regexps of rules defined in config.h */
Bool isvisible(Client *, Bool *, int); Bool isvisible(Client *, int, Bool *, int);
void applyrules(Client * c, awesome_config *); /* applies rules to c */ void applyrules(Client * c, awesome_config *); /* applies rules to c */
void uicb_tag(Display *, int, DC *, awesome_config *, const char *); /* tags sel with arg's index */ void uicb_tag(Display *, int, DC *, awesome_config *, const char *); /* tags sel with arg's index */
void uicb_togglefloating(Display *, int, DC *, awesome_config *, const char *); /* toggles sel between floating/tiled state */ void uicb_togglefloating(Display *, int, DC *, awesome_config *, const char *); /* toggles sel between floating/tiled state */