simplify arrange and restack
This commit is contained in:
parent
bf9601f79c
commit
30e7cf5b40
4
client.c
4
client.c
|
@ -416,7 +416,7 @@ manage(Display * disp, int screen, DC *drawcontext, Window w, XWindowAttributes
|
|||
attachstack(c);
|
||||
XMoveResizeWindow(disp, c->win, c->x, c->y, c->w, c->h); /* some windows require this */
|
||||
c->isbanned = True;
|
||||
arrange(disp, screen, drawcontext, awesomeconf);
|
||||
arrange(disp, drawcontext, awesomeconf);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -578,7 +578,7 @@ unmanage(Client * c, DC *drawcontext, long state, awesome_config *awesomeconf)
|
|||
XSetErrorHandler(xerror);
|
||||
XUngrabServer(c->display);
|
||||
if(state != NormalState)
|
||||
arrange(c->display, c->screen, drawcontext, awesomeconf);
|
||||
arrange(c->display, drawcontext, awesomeconf);
|
||||
p_delete(&c->tags);
|
||||
p_delete(&c);
|
||||
}
|
||||
|
|
8
event.c
8
event.c
|
@ -189,7 +189,7 @@ handle_event_buttonpress(XEvent * e, awesome_config *awesomeconf)
|
|||
if(!IS_ARRANGE(floating) && !c->isfloating)
|
||||
uicb_togglefloating(e->xany.display, c->screen, &dc[c->screen], &awesomeconf[c->screen], NULL);
|
||||
else
|
||||
restack(e->xany.display, c->screen, &dc[c->screen], &awesomeconf[c->screen]);
|
||||
restack(e->xany.display, &dc[c->screen], &awesomeconf[c->screen]);
|
||||
movemouse(c, &awesomeconf[c->screen]);
|
||||
}
|
||||
else if(ev->button == Button2)
|
||||
|
@ -204,7 +204,7 @@ handle_event_buttonpress(XEvent * e, awesome_config *awesomeconf)
|
|||
if(!IS_ARRANGE(floating) && !c->isfloating)
|
||||
uicb_togglefloating(e->xany.display, c->screen, &dc[c->screen], &awesomeconf[c->screen], NULL);
|
||||
else
|
||||
restack(e->xany.display, c->screen, &dc[c->screen], &awesomeconf[c->screen]);
|
||||
restack(e->xany.display, &dc[c->screen], &awesomeconf[c->screen]);
|
||||
resizemouse(c, &awesomeconf[c->screen]);
|
||||
}
|
||||
}
|
||||
|
@ -288,7 +288,7 @@ handle_event_configurenotify(XEvent * e, awesome_config *awesomeconf)
|
|||
XResizeWindow(e->xany.display, awesomeconf[screen].statusbar.window,
|
||||
DisplayWidth(e->xany.display, screen), awesomeconf[screen].statusbar.height);
|
||||
updatebarpos(e->xany.display, awesomeconf[screen].statusbar);
|
||||
arrange(e->xany.display, screen, &dc[screen], &awesomeconf[screen]);
|
||||
arrange(e->xany.display, &dc[screen], &awesomeconf[screen]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -407,7 +407,7 @@ handle_event_propertynotify(XEvent * e, awesome_config *awesomeconf)
|
|||
case XA_WM_TRANSIENT_FOR:
|
||||
XGetTransientForHint(e->xany.display, c->win, &trans);
|
||||
if(!c->isfloating && (c->isfloating = (getclient(trans) != NULL)))
|
||||
arrange(e->xany.display, c->screen, &dc[c->screen], &awesomeconf[c->screen]);
|
||||
arrange(e->xany.display, &dc[c->screen], &awesomeconf[c->screen]);
|
||||
break;
|
||||
case XA_WM_NORMAL_HINTS:
|
||||
updatesizehints(c);
|
||||
|
|
27
layout.c
27
layout.c
|
@ -33,22 +33,21 @@
|
|||
extern Client *clients, *sel; /* global client list */
|
||||
|
||||
void
|
||||
arrange(Display * disp, int screen, DC *drawcontext, awesome_config *awesomeconf)
|
||||
arrange(Display * disp, DC *drawcontext, awesome_config *awesomeconf)
|
||||
{
|
||||
Client *c;
|
||||
|
||||
for(c = clients; c; c = c->next)
|
||||
{
|
||||
if(c->screen != screen)
|
||||
continue;
|
||||
if(isvisible(c, screen, awesomeconf->selected_tags, awesomeconf->ntags))
|
||||
if(isvisible(c, awesomeconf->screen, awesomeconf->selected_tags, awesomeconf->ntags))
|
||||
unban(c);
|
||||
else
|
||||
/* we don't touch other screens windows */
|
||||
else if(c->screen == awesomeconf->screen)
|
||||
ban(c);
|
||||
}
|
||||
awesomeconf->current_layout->arrange(disp, screen, awesomeconf);
|
||||
awesomeconf->current_layout->arrange(disp, awesomeconf->screen, awesomeconf);
|
||||
focus(disp, drawcontext, NULL, True, awesomeconf);
|
||||
restack(disp, screen, drawcontext, awesomeconf);
|
||||
restack(disp, drawcontext, awesomeconf);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -68,7 +67,7 @@ uicb_focusnext(Display *disp __attribute__ ((unused)),
|
|||
if(c)
|
||||
{
|
||||
focus(c->display, drawcontext, c, True, awesomeconf);
|
||||
restack(c->display, screen, drawcontext, awesomeconf);
|
||||
restack(c->display, drawcontext, awesomeconf);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -92,7 +91,7 @@ uicb_focusprev(Display *disp __attribute__ ((unused)),
|
|||
if(c)
|
||||
{
|
||||
focus(c->display, drawcontext, c, True, awesomeconf);
|
||||
restack(c->display, screen, drawcontext, awesomeconf);
|
||||
restack(c->display, drawcontext, awesomeconf);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -112,13 +111,13 @@ loadawesomeprops(Display *disp, int screen, awesome_config * awesomeconf)
|
|||
}
|
||||
|
||||
void
|
||||
restack(Display * disp, int screen, DC * drawcontext, awesome_config *awesomeconf)
|
||||
restack(Display * disp, DC * drawcontext, awesome_config *awesomeconf)
|
||||
{
|
||||
Client *c;
|
||||
XEvent ev;
|
||||
XWindowChanges wc;
|
||||
|
||||
drawstatusbar(disp, screen, drawcontext, awesomeconf);
|
||||
drawstatusbar(disp, awesomeconf->screen, drawcontext, awesomeconf);
|
||||
if(!sel)
|
||||
return;
|
||||
if(sel->isfloating || IS_ARRANGE(floating))
|
||||
|
@ -134,7 +133,7 @@ restack(Display * disp, int screen, DC * drawcontext, awesome_config *awesomecon
|
|||
}
|
||||
for(c = clients; c; c = c->next)
|
||||
{
|
||||
if(!IS_TILED(c, screen, awesomeconf->selected_tags, awesomeconf->ntags) || c == sel)
|
||||
if(!IS_TILED(c, awesomeconf->screen, awesomeconf->selected_tags, awesomeconf->ntags) || c == sel)
|
||||
continue;
|
||||
XConfigureWindow(disp, c->win, CWSibling | CWStackMode, &wc);
|
||||
wc.sibling = c->win;
|
||||
|
@ -187,7 +186,7 @@ uicb_setlayout(Display *disp,
|
|||
c->ftview = True;
|
||||
|
||||
if(sel)
|
||||
arrange(disp, screen, drawcontext, awesomeconf);
|
||||
arrange(disp, drawcontext, awesomeconf);
|
||||
else
|
||||
drawstatusbar(disp, DefaultScreen(disp), drawcontext, awesomeconf);
|
||||
|
||||
|
@ -286,6 +285,6 @@ uicb_zoom(Display *disp __attribute__ ((unused)),
|
|||
detach(sel);
|
||||
attach(sel);
|
||||
focus(sel->display, drawcontext, sel, True, awesomeconf);
|
||||
arrange(sel->display, sel->screen, drawcontext, awesomeconf);
|
||||
arrange(sel->display, drawcontext, awesomeconf);
|
||||
}
|
||||
|
||||
|
|
4
layout.h
4
layout.h
|
@ -29,8 +29,8 @@
|
|||
|
||||
#define AWESOMEPROPS_ATOM(disp) XInternAtom(disp, "_AWESOME_PROPERTIES", False)
|
||||
|
||||
void arrange(Display *, int, DC *, awesome_config *); /* arranges all windows depending on the layout in use */
|
||||
void restack(Display *, int, DC *, awesome_config *); /* restores z layers of all clients */
|
||||
void arrange(Display *, DC *, awesome_config *); /* arranges all windows depending on the layout in use */
|
||||
void restack(Display *, DC *, awesome_config *); /* restores z layers of all clients */
|
||||
void uicb_focusnext(Display *, int, DC *, awesome_config *, const char *); /* focuses next visible client */
|
||||
void uicb_focusprev(Display *, int, DC *, awesome_config *, const char *); /* focuses prev visible client */
|
||||
void uicb_setlayout(Display *, int, DC *, awesome_config *, const char *); /* sets layout, NULL means next layout */
|
||||
|
|
|
@ -44,7 +44,7 @@ uicb_setnmaster(Display *disp,
|
|||
if((awesomeconf->nmaster = (int) compute_new_value_from_arg(arg, (double) awesomeconf->nmaster)) < 0)
|
||||
awesomeconf->nmaster = 0;
|
||||
|
||||
arrange(disp, screen, drawcontext, awesomeconf);
|
||||
arrange(disp, drawcontext, awesomeconf);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -60,7 +60,7 @@ uicb_setncols(Display *disp,
|
|||
if((awesomeconf->ncols = (int) compute_new_value_from_arg(arg, (double) awesomeconf->ncols)) < 1)
|
||||
awesomeconf->ncols = 1;
|
||||
|
||||
arrange(disp, screen, drawcontext, awesomeconf);
|
||||
arrange(disp, drawcontext, awesomeconf);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -78,7 +78,7 @@ uicb_setmwfact(Display *disp,
|
|||
else if(awesomeconf->mwfact > 0.9)
|
||||
awesomeconf->mwfact = 0.9;
|
||||
|
||||
arrange(disp, screen, drawcontext, awesomeconf);
|
||||
arrange(disp, drawcontext, awesomeconf);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -152,6 +152,6 @@ uicb_togglebar(Display *disp,
|
|||
else
|
||||
awesomeconf->statusbar.position = BarOff;
|
||||
updatebarpos(disp, awesomeconf->statusbar);
|
||||
arrange(disp, screen, drawcontext, awesomeconf);
|
||||
arrange(disp, drawcontext, awesomeconf);
|
||||
}
|
||||
|
||||
|
|
16
tag.c
16
tag.c
|
@ -160,7 +160,7 @@ uicb_tag(Display *disp,
|
|||
if(i >= 0 && i < awesomeconf->ntags)
|
||||
sel->tags[i] = True;
|
||||
saveprops(sel, awesomeconf->ntags);
|
||||
arrange(disp, screen, drawcontext, awesomeconf);
|
||||
arrange(disp, drawcontext, awesomeconf);
|
||||
}
|
||||
|
||||
/** Toggle floating state of a client
|
||||
|
@ -190,7 +190,7 @@ uicb_togglefloating(Display *disp,
|
|||
sel->rh = sel->h;
|
||||
}
|
||||
saveprops(sel, awesomeconf->ntags);
|
||||
arrange(disp, screen, drawcontext, awesomeconf);
|
||||
arrange(disp, drawcontext, awesomeconf);
|
||||
}
|
||||
|
||||
/** Toggle tag view
|
||||
|
@ -216,7 +216,7 @@ uicb_toggletag(Display *disp,
|
|||
if(j == awesomeconf->ntags)
|
||||
sel->tags[i] = True;
|
||||
saveprops(sel, awesomeconf->ntags);
|
||||
arrange(disp, screen, drawcontext, awesomeconf);
|
||||
arrange(disp, drawcontext, awesomeconf);
|
||||
}
|
||||
|
||||
/** Add a tag to viewed tags
|
||||
|
@ -240,7 +240,7 @@ uicb_toggleview(Display *disp,
|
|||
if(j == awesomeconf->ntags)
|
||||
awesomeconf->selected_tags[i] = True; /* cannot toggle last view */
|
||||
saveawesomeprops(disp, screen, awesomeconf);
|
||||
arrange(disp, screen, drawcontext, awesomeconf);
|
||||
arrange(disp, drawcontext, awesomeconf);
|
||||
}
|
||||
|
||||
/** View tag
|
||||
|
@ -270,7 +270,7 @@ uicb_view(Display *disp,
|
|||
awesomeconf->current_layout = awesomeconf->tag_layouts[i];
|
||||
}
|
||||
saveawesomeprops(disp, screen, awesomeconf);
|
||||
arrange(disp, screen, drawcontext, awesomeconf);
|
||||
arrange(disp, drawcontext, awesomeconf);
|
||||
}
|
||||
|
||||
/** View previously selected tags
|
||||
|
@ -295,7 +295,7 @@ uicb_viewprevtags(Display * disp,
|
|||
awesomeconf->selected_tags[i] = awesomeconf->prev_selected_tags[i];
|
||||
awesomeconf->prev_selected_tags[i] = t;
|
||||
}
|
||||
arrange(disp, screen, drawcontext, awesomeconf);
|
||||
arrange(disp, drawcontext, awesomeconf);
|
||||
}
|
||||
|
||||
/** View next tag
|
||||
|
@ -323,7 +323,7 @@ uicb_tag_viewnext(Display *disp,
|
|||
firsttag = 0;
|
||||
awesomeconf->selected_tags[firsttag] = True;
|
||||
saveawesomeprops(disp, screen, awesomeconf);
|
||||
arrange(disp, screen, drawcontext, awesomeconf);
|
||||
arrange(disp, drawcontext, awesomeconf);
|
||||
}
|
||||
|
||||
/** View previous tag
|
||||
|
@ -351,5 +351,5 @@ uicb_tag_viewprev(Display *disp,
|
|||
firsttag = awesomeconf->ntags - 1;
|
||||
awesomeconf->selected_tags[firsttag] = True;
|
||||
saveawesomeprops(disp, screen, awesomeconf);
|
||||
arrange(disp, screen, drawcontext, awesomeconf);
|
||||
arrange(disp, drawcontext, awesomeconf);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue