deprected nexttiled, add IS_TILED macro to check if a client is tiled to current tags
This commit is contained in:
parent
4fc212ed40
commit
9f9757e1b4
15
layout.c
15
layout.c
|
@ -138,13 +138,14 @@ restack(Display * disp, jdwm_config *jdwmconf)
|
|||
XConfigureWindow(disp, sel->win, CWSibling | CWStackMode, &wc);
|
||||
wc.sibling = sel->win;
|
||||
}
|
||||
for(c = nexttiled(clients, jdwmconf->selected_tags, jdwmconf->ntags); c; c = nexttiled(c->next, jdwmconf->selected_tags, jdwmconf->ntags))
|
||||
{
|
||||
if(c == sel)
|
||||
continue;
|
||||
XConfigureWindow(disp, c->win, CWSibling | CWStackMode, &wc);
|
||||
wc.sibling = c->win;
|
||||
}
|
||||
for(c = clients; c; c = c->next)
|
||||
if(IS_TILED(c, jdwmconf->selected_tags, jdwmconf->ntags))
|
||||
{
|
||||
if(c == sel)
|
||||
continue;
|
||||
XConfigureWindow(disp, c->win, CWSibling | CWStackMode, &wc);
|
||||
wc.sibling = c->win;
|
||||
}
|
||||
}
|
||||
XSync(disp, False);
|
||||
while(XCheckMaskEvent(disp, EnterWindowMask, &ev));
|
||||
|
|
3
layout.h
3
layout.h
|
@ -5,11 +5,12 @@
|
|||
|
||||
#include "client.h"
|
||||
|
||||
/** Check if current layout is arranged with a layout */
|
||||
#define IS_ARRANGE(layout) (layout == jdwmconf->current_layout->arrange)
|
||||
|
||||
void arrange(Display *, jdwm_config *); /* arranges all windows depending on the layout in use */
|
||||
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 uicb_focusnext(Display *, jdwm_config *, const char *); /* focuses next visible client */
|
||||
void uicb_focusprev(Display *, jdwm_config *, const char *); /* focuses prev visible client */
|
||||
|
|
|
@ -15,8 +15,9 @@ grid(Display *disp, jdwm_config *jdwmconf)
|
|||
unsigned int i, n, cx, cy, cw, ch, aw, ah, cols, rows;
|
||||
Client *c;
|
||||
|
||||
for(n = 0, c = nexttiled(clients, jdwmconf->selected_tags, jdwmconf->ntags); c; c = nexttiled(c->next, jdwmconf->selected_tags, jdwmconf->ntags))
|
||||
n++;
|
||||
for(n = 0, c = clients; c; c = c->next)
|
||||
if(IS_TILED(c, jdwmconf->selected_tags, jdwmconf->ntags))
|
||||
n++;
|
||||
|
||||
/* grid dimensions */
|
||||
for(rows = 0; rows <= n / 2; rows++)
|
||||
|
|
|
@ -18,8 +18,9 @@ fibonacci(Display *disp, jdwm_config *jdwmconf, int shape)
|
|||
ny = 0;
|
||||
nw = waw;
|
||||
nh = wah;
|
||||
for(n = 0, c = nexttiled(clients, jdwmconf->selected_tags, jdwmconf->ntags); c; c = nexttiled(c->next, jdwmconf->selected_tags, jdwmconf->ntags))
|
||||
n++;
|
||||
for(n = 0, c = clients; c; c = c->next)
|
||||
if(IS_TILED(c, jdwmconf->selected_tags, jdwmconf->ntags))
|
||||
n++;
|
||||
for(i = 0, c = clients; c; c = c->next)
|
||||
{
|
||||
c->ismax = False;
|
||||
|
|
|
@ -3,8 +3,9 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "layout.h"
|
||||
#include "layouts/tile.h"
|
||||
#include "layout.h"
|
||||
#include "tag.h"
|
||||
|
||||
/* extern */
|
||||
extern int wax, way, wah, waw; /* windowarea geometry */
|
||||
|
@ -76,8 +77,9 @@ _tile(jdwm_config *jdwmconf, const Bool right)
|
|||
int n, th, i, mh;
|
||||
Client *c;
|
||||
|
||||
for(n = 0, c = nexttiled(clients, jdwmconf->selected_tags, jdwmconf->ntags); c; c = nexttiled(c->next, jdwmconf->selected_tags, jdwmconf->ntags))
|
||||
n++;
|
||||
for(n = 0, c = clients; c; c = c->next)
|
||||
if(IS_TILED(c, jdwmconf->selected_tags, jdwmconf->ntags))
|
||||
n++;
|
||||
|
||||
/* window geoms */
|
||||
mh = (n <= nmaster) ? wah / (n > 0 ? n : 1) : wah / nmaster;
|
||||
|
@ -88,8 +90,11 @@ _tile(jdwm_config *jdwmconf, const Bool right)
|
|||
|
||||
nx = wax;
|
||||
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;
|
||||
if(i < nmaster)
|
||||
{ /* master */
|
||||
|
@ -121,6 +126,7 @@ _tile(jdwm_config *jdwmconf, const Bool right)
|
|||
resize(c, nx, ny, nw, nh, False);
|
||||
if(n > nmaster && th != wah)
|
||||
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;
|
||||
Client *c;
|
||||
|
||||
for(n = 0, c = nexttiled(clients, jdwmconf->selected_tags, jdwmconf->ntags); c; c = nexttiled(c->next, jdwmconf->selected_tags, jdwmconf->ntags))
|
||||
n++;
|
||||
for(n = 0, c = clients; c; c = c->next)
|
||||
if(IS_TILED(c, jdwmconf->selected_tags, jdwmconf->ntags))
|
||||
n++;
|
||||
|
||||
/* window geoms */
|
||||
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;
|
||||
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;
|
||||
nx = wax;
|
||||
ny = way;
|
||||
|
@ -185,6 +195,7 @@ _bstack(jdwm_config *jdwmconf, Bool portrait)
|
|||
nh = wah - 2 * c->border;
|
||||
}
|
||||
resize(c, nx, ny, nw, nh, False);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
3
tag.h
3
tag.h
|
@ -6,6 +6,9 @@
|
|||
#include <regex.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 */
|
||||
Bool isvisible(Client *, Bool *, int);
|
||||
void applyrules(Client * c, jdwm_config *); /* applies rules to c */
|
||||
|
|
Loading…
Reference in New Issue