deprected nexttiled, add IS_TILED macro to check if a client is tiled to current tags

This commit is contained in:
Julien Danjou 2007-09-06 20:02:30 +02:00
parent 4fc212ed40
commit 9f9757e1b4
6 changed files with 37 additions and 19 deletions

View File

@ -138,13 +138,14 @@ restack(Display * disp, jdwm_config *jdwmconf)
XConfigureWindow(disp, sel->win, CWSibling | CWStackMode, &wc); XConfigureWindow(disp, sel->win, CWSibling | CWStackMode, &wc);
wc.sibling = sel->win; wc.sibling = sel->win;
} }
for(c = nexttiled(clients, jdwmconf->selected_tags, jdwmconf->ntags); c; c = nexttiled(c->next, jdwmconf->selected_tags, jdwmconf->ntags)) for(c = clients; c; c = c->next)
{ if(IS_TILED(c, jdwmconf->selected_tags, jdwmconf->ntags))
if(c == sel) {
continue; if(c == sel)
XConfigureWindow(disp, c->win, CWSibling | CWStackMode, &wc); continue;
wc.sibling = c->win; XConfigureWindow(disp, c->win, CWSibling | CWStackMode, &wc);
} wc.sibling = c->win;
}
} }
XSync(disp, False); XSync(disp, False);
while(XCheckMaskEvent(disp, EnterWindowMask, &ev)); while(XCheckMaskEvent(disp, EnterWindowMask, &ev));

View File

@ -5,11 +5,12 @@
#include "client.h" #include "client.h"
/** Check if current layout is arranged with a layout */
#define IS_ARRANGE(layout) (layout == jdwmconf->current_layout->arrange) #define IS_ARRANGE(layout) (layout == jdwmconf->current_layout->arrange)
void arrange(Display *, jdwm_config *); /* arranges all windows depending on the layout in use */ void arrange(Display *, jdwm_config *); /* arranges all windows depending on the layout in use */
void initlayouts(jdwm_config *); /* initialize layout array */ void initlayouts(jdwm_config *); /* initialize layout array */
Client *nexttiled(Client *, Bool *, int); /* returns tiled successor of c */ Client *nexttiled(Client *, Bool *, int) __attribute__ ((deprecated));
void restack(Display *, jdwm_config *); /* restores z layers of all clients */ void restack(Display *, jdwm_config *); /* restores z layers of all clients */
void uicb_focusnext(Display *, jdwm_config *, const char *); /* focuses next visible client */ void uicb_focusnext(Display *, jdwm_config *, const char *); /* focuses next visible client */
void uicb_focusprev(Display *, jdwm_config *, const char *); /* focuses prev visible client */ void uicb_focusprev(Display *, jdwm_config *, const char *); /* focuses prev visible client */

View File

@ -15,8 +15,9 @@ grid(Display *disp, jdwm_config *jdwmconf)
unsigned int i, n, cx, cy, cw, ch, aw, ah, cols, rows; unsigned int i, n, cx, cy, cw, ch, aw, ah, cols, rows;
Client *c; Client *c;
for(n = 0, c = nexttiled(clients, jdwmconf->selected_tags, jdwmconf->ntags); c; c = nexttiled(c->next, jdwmconf->selected_tags, jdwmconf->ntags)) for(n = 0, c = clients; c; c = c->next)
n++; if(IS_TILED(c, jdwmconf->selected_tags, jdwmconf->ntags))
n++;
/* grid dimensions */ /* grid dimensions */
for(rows = 0; rows <= n / 2; rows++) for(rows = 0; rows <= n / 2; rows++)

View File

@ -18,8 +18,9 @@ fibonacci(Display *disp, jdwm_config *jdwmconf, int shape)
ny = 0; ny = 0;
nw = waw; nw = waw;
nh = wah; nh = wah;
for(n = 0, c = nexttiled(clients, jdwmconf->selected_tags, jdwmconf->ntags); c; c = nexttiled(c->next, jdwmconf->selected_tags, jdwmconf->ntags)) for(n = 0, c = clients; c; c = c->next)
n++; if(IS_TILED(c, jdwmconf->selected_tags, jdwmconf->ntags))
n++;
for(i = 0, c = clients; c; c = c->next) for(i = 0, c = clients; c; c = c->next)
{ {
c->ismax = False; c->ismax = False;

View File

@ -3,8 +3,9 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include "layout.h"
#include "layouts/tile.h" #include "layouts/tile.h"
#include "layout.h"
#include "tag.h"
/* extern */ /* extern */
extern int wax, way, wah, waw; /* windowarea geometry */ extern int wax, way, wah, waw; /* windowarea geometry */
@ -76,8 +77,9 @@ _tile(jdwm_config *jdwmconf, const Bool right)
int n, th, i, mh; int n, th, i, mh;
Client *c; Client *c;
for(n = 0, c = nexttiled(clients, jdwmconf->selected_tags, jdwmconf->ntags); c; c = nexttiled(c->next, jdwmconf->selected_tags, jdwmconf->ntags)) for(n = 0, c = clients; c; c = c->next)
n++; if(IS_TILED(c, jdwmconf->selected_tags, jdwmconf->ntags))
n++;
/* window geoms */ /* window geoms */
mh = (n <= nmaster) ? wah / (n > 0 ? n : 1) : wah / nmaster; mh = (n <= nmaster) ? wah / (n > 0 ? n : 1) : wah / nmaster;
@ -88,8 +90,11 @@ _tile(jdwm_config *jdwmconf, const Bool right)
nx = wax; nx = wax;
ny = way; ny = way;
for(i = 0, c = nexttiled(clients, jdwmconf->selected_tags, jdwmconf->ntags); c; c = nexttiled(c->next, jdwmconf->selected_tags, jdwmconf->ntags), i++) for(i = 0, c = clients; c; c = c->next)
{ {
if(!IS_TILED(c, jdwmconf->selected_tags, jdwmconf->ntags))
continue;
c->ismax = False; c->ismax = False;
if(i < nmaster) if(i < nmaster)
{ /* master */ { /* master */
@ -121,6 +126,7 @@ _tile(jdwm_config *jdwmconf, const Bool right)
resize(c, nx, ny, nw, nh, False); resize(c, nx, ny, nw, nh, False);
if(n > nmaster && th != wah) if(n > nmaster && th != wah)
ny += nh + 2 * c->border; ny += nh + 2 * c->border;
i++;
} }
} }
@ -143,8 +149,9 @@ _bstack(jdwm_config *jdwmconf, Bool portrait)
int i, n, nx, ny, nw, nh, mw, mh, tw, th; int i, n, nx, ny, nw, nh, mw, mh, tw, th;
Client *c; Client *c;
for(n = 0, c = nexttiled(clients, jdwmconf->selected_tags, jdwmconf->ntags); c; c = nexttiled(c->next, jdwmconf->selected_tags, jdwmconf->ntags)) for(n = 0, c = clients; c; c = c->next)
n++; if(IS_TILED(c, jdwmconf->selected_tags, jdwmconf->ntags))
n++;
/* window geoms */ /* window geoms */
mh = (n > nmaster) ? (wah * mwfact) / nmaster : wah / (n > 0 ? n : 1); mh = (n > nmaster) ? (wah * mwfact) / nmaster : wah / (n > 0 ? n : 1);
@ -152,8 +159,11 @@ _bstack(jdwm_config *jdwmconf, Bool portrait)
th = (n > nmaster) ? (wah * (1 - mwfact)) / (portrait ? 1 : n - nmaster) : 0; th = (n > nmaster) ? (wah * (1 - mwfact)) / (portrait ? 1 : n - nmaster) : 0;
tw = (n > nmaster) ? waw / (portrait ? n - nmaster : 1) : 0; tw = (n > nmaster) ? waw / (portrait ? n - nmaster : 1) : 0;
for(i = 0, c = nexttiled(clients, jdwmconf->selected_tags, jdwmconf->ntags); c; c = nexttiled(c->next, jdwmconf->selected_tags, jdwmconf->ntags), i++) for(i = 0, c = clients; c; c = c->next)
{ {
if(!IS_TILED(c, jdwmconf->selected_tags, jdwmconf->ntags))
continue;
c->ismax = False; c->ismax = False;
nx = wax; nx = wax;
ny = way; ny = way;
@ -185,6 +195,7 @@ _bstack(jdwm_config *jdwmconf, Bool portrait)
nh = wah - 2 * c->border; nh = wah - 2 * c->border;
} }
resize(c, nx, ny, nw, nh, False); resize(c, nx, ny, nw, nh, False);
i++;
} }
} }

3
tag.h
View File

@ -6,6 +6,9 @@
#include <regex.h> #include <regex.h>
#include "client.h" #include "client.h"
/** Check if a client is tiled */
#define IS_TILED(client, tags, ntags) (client && !client->isfloating && isvisible(client, tags, ntags))
void compileregs(jdwm_config *); /* initialize regexps of rules defined in config.h */ void compileregs(jdwm_config *); /* initialize regexps of rules defined in config.h */
Bool isvisible(Client *, Bool *, int); Bool isvisible(Client *, Bool *, int);
void applyrules(Client * c, jdwm_config *); /* applies rules to c */ void applyrules(Client * c, jdwm_config *); /* applies rules to c */