add a new cache system for arrange()ing
This commit is contained in:
parent
5f72c9f056
commit
6e4d13c9dc
|
@ -399,6 +399,7 @@ main(int argc, char *argv[])
|
|||
}
|
||||
|
||||
statusbar_refresh();
|
||||
layout_refresh();
|
||||
|
||||
/* need to resync */
|
||||
XSync(dpy, False);
|
||||
|
|
29
client.c
29
client.c
|
@ -338,7 +338,7 @@ client_manage(Window w, XWindowAttributes *wa, int screen)
|
|||
ewmh_update_net_client_list(phys_screen);
|
||||
|
||||
/* rearrange to display new window */
|
||||
arrange(c->screen);
|
||||
globalconf.screens[c->screen].need_arrange = True;
|
||||
}
|
||||
|
||||
/** Resize client window
|
||||
|
@ -447,8 +447,12 @@ void
|
|||
client_setfloating(Client *c, Bool floating)
|
||||
{
|
||||
if(c->isfloating != floating)
|
||||
{
|
||||
if((c->isfloating = floating))
|
||||
client_resize(c, c->f_geometry, False);
|
||||
globalconf.screens[c->screen].need_arrange = True;
|
||||
widget_invalidate_cache(c->screen, WIDGET_CACHE_CLIENTS);
|
||||
}
|
||||
}
|
||||
|
||||
/** Save client properties as an X property
|
||||
|
@ -516,7 +520,8 @@ client_unmanage(Client *c)
|
|||
XSync(globalconf.display, False);
|
||||
XUngrabServer(globalconf.display);
|
||||
|
||||
arrange(c->screen);
|
||||
globalconf.screens[c->screen].need_arrange = True;
|
||||
|
||||
p_delete(&c);
|
||||
}
|
||||
|
||||
|
@ -704,14 +709,15 @@ client_find_next_visible(Client *sel)
|
|||
* \ingroup ui_callback
|
||||
*/
|
||||
void
|
||||
uicb_client_swapprev(int screen, char *arg __attribute__ ((unused)))
|
||||
uicb_client_swapprev(int screen __attribute__ ((unused)),
|
||||
char *arg __attribute__ ((unused)))
|
||||
{
|
||||
Client *prev;
|
||||
|
||||
if((prev = client_find_prev_visible(globalconf.focus->client)))
|
||||
{
|
||||
client_list_swap(&globalconf.clients, prev, globalconf.focus->client);
|
||||
arrange(screen);
|
||||
globalconf.screens[prev->screen].need_arrange = True;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -721,14 +727,15 @@ uicb_client_swapprev(int screen, char *arg __attribute__ ((unused)))
|
|||
* \ingroup ui_callback
|
||||
*/
|
||||
void
|
||||
uicb_client_swapnext(int screen, char *arg __attribute__ ((unused)))
|
||||
uicb_client_swapnext(int screen __attribute__ ((unused)),
|
||||
char *arg __attribute__ ((unused)))
|
||||
{
|
||||
Client *next;
|
||||
|
||||
if((next = client_find_next_visible(globalconf.focus->client)))
|
||||
{
|
||||
client_list_swap(&globalconf.clients, globalconf.focus->client, next);
|
||||
arrange(screen);
|
||||
globalconf.screens[next->screen].need_arrange = True;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -846,7 +853,6 @@ client_maximize(Client *c, Area geometry)
|
|||
else
|
||||
{
|
||||
client_setfloating(c, False);
|
||||
arrange(c->screen);
|
||||
widget_invalidate_cache(c->screen, WIDGET_CACHE_CLIENTS);
|
||||
}
|
||||
}
|
||||
|
@ -936,7 +942,7 @@ uicb_client_zoom(int screen, char *arg __attribute__ ((unused)))
|
|||
|
||||
client_list_detach(&globalconf.clients, sel);
|
||||
client_list_push(&globalconf.clients, sel);
|
||||
arrange(screen);
|
||||
globalconf.screens[screen].need_arrange = True;
|
||||
}
|
||||
|
||||
/** Send focus to next client in stack
|
||||
|
@ -984,13 +990,14 @@ uicb_client_focusprev(int screen, char *arg __attribute__ ((unused)))
|
|||
* \ingroup ui_callback
|
||||
*/
|
||||
void
|
||||
uicb_client_togglefloating(int screen, char *arg)
|
||||
uicb_client_togglefloating(int screen __attribute__ ((unused)), char *arg)
|
||||
{
|
||||
Client *sel = globalconf.focus->client;
|
||||
|
||||
if(!sel)
|
||||
return;
|
||||
|
||||
/* XXX should use client_setfloating */
|
||||
if((sel->isfloating = !sel->isfloating))
|
||||
{
|
||||
if(!arg)
|
||||
|
@ -998,10 +1005,8 @@ uicb_client_togglefloating(int screen, char *arg)
|
|||
}
|
||||
else if(sel->ismax)
|
||||
client_resize(sel, sel->m_geometry, False);
|
||||
|
||||
globalconf.screens[sel->screen].need_arrange = True;
|
||||
widget_invalidate_cache(sel->screen, WIDGET_CACHE_CLIENTS);
|
||||
client_saveprops(sel);
|
||||
arrange(screen);
|
||||
}
|
||||
|
||||
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80
|
||||
|
|
11
event.c
11
event.c
|
@ -169,10 +169,10 @@ handle_event_configurerequest(XEvent * e)
|
|||
if(old_screen != c->screen)
|
||||
{
|
||||
widget_invalidate_cache(old_screen, WIDGET_CACHE_CLIENTS);
|
||||
arrange(old_screen);
|
||||
globalconf.screens[old_screen].need_arrange = True;
|
||||
}
|
||||
widget_invalidate_cache(c->screen, WIDGET_CACHE_CLIENTS);
|
||||
arrange(c->screen);
|
||||
globalconf.screens[c->screen].need_arrange = True;
|
||||
}
|
||||
else
|
||||
window_configure(c->win, geometry, c->border);
|
||||
|
@ -215,7 +215,7 @@ handle_event_configurenotify(XEvent * e)
|
|||
globalconf.screens[screen].statusbar->height);
|
||||
|
||||
widget_invalidate_cache(screen, WIDGET_CACHE_ALL);
|
||||
arrange(screen);
|
||||
globalconf.screens[screen].need_arrange = True;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -374,8 +374,9 @@ handle_event_propertynotify(XEvent * e)
|
|||
{
|
||||
case XA_WM_TRANSIENT_FOR:
|
||||
XGetTransientForHint(e->xany.display, c->win, &trans);
|
||||
if(!c->isfloating && (c->isfloating = (get_client_bywin(globalconf.clients, trans) != NULL)))
|
||||
arrange(c->screen);
|
||||
if(!c->isfloating
|
||||
&& (c->isfloating = (get_client_bywin(globalconf.clients, trans) != NULL)))
|
||||
globalconf.screens[c->screen].need_arrange = True;
|
||||
break;
|
||||
case XA_WM_NORMAL_HINTS:
|
||||
client_updatesizehints(c);
|
||||
|
|
2
ewmh.c
2
ewmh.c
|
@ -275,8 +275,8 @@ ewmh_process_state_atom(Client *c, Atom state, int set)
|
|||
widget_invalidate_cache(c->screen, WIDGET_CACHE_CLIENTS);
|
||||
client_resize(c, geometry, False);
|
||||
XRaiseWindow(globalconf.display, c->win);
|
||||
globalconf.screens[c->screen].need_arrange = True;
|
||||
}
|
||||
arrange(c->screen);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
20
layout.c
20
layout.c
|
@ -43,7 +43,7 @@ extern AwesomeConf globalconf;
|
|||
/** Arrange windows following current selected layout
|
||||
* \param screen the screen to arrange
|
||||
*/
|
||||
void
|
||||
static void
|
||||
arrange(int screen)
|
||||
{
|
||||
Client *c;
|
||||
|
@ -77,8 +77,26 @@ arrange(int screen)
|
|||
|
||||
p_delete(&curtags);
|
||||
restack(screen);
|
||||
|
||||
/* reset status */
|
||||
globalconf.screens[screen].need_arrange = False;
|
||||
}
|
||||
|
||||
Bool
|
||||
layout_refresh(void)
|
||||
{
|
||||
int screen;
|
||||
Bool arranged = False;
|
||||
|
||||
for(screen = 0; screen < get_screen_count(); screen++)
|
||||
if(globalconf.screens[screen].need_arrange)
|
||||
{
|
||||
arrange(screen);
|
||||
arranged = True;
|
||||
}
|
||||
|
||||
return arranged;
|
||||
}
|
||||
|
||||
Layout *
|
||||
get_current_layout(int screen)
|
||||
|
|
2
layout.h
2
layout.h
|
@ -38,7 +38,7 @@ struct Layout
|
|||
|
||||
DO_SLIST(Layout, layout, p_delete);
|
||||
|
||||
void arrange(int);
|
||||
Bool layout_refresh(void);
|
||||
Layout * get_current_layout(int);
|
||||
void restack(int);
|
||||
void loadawesomeprops(int);
|
||||
|
|
|
@ -48,7 +48,7 @@ uicb_tag_setnmaster(int screen, char * arg)
|
|||
|
||||
p_delete(&curtags);
|
||||
|
||||
arrange(screen);
|
||||
globalconf.screens[screen].need_arrange = True;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -68,7 +68,7 @@ uicb_tag_setncol(int screen, char * arg)
|
|||
|
||||
p_delete(&curtags);
|
||||
|
||||
arrange(screen);
|
||||
globalconf.screens[screen].need_arrange = True;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -100,7 +100,7 @@ uicb_tag_setmwfact(int screen, char *arg)
|
|||
|
||||
p_delete(&newarg);
|
||||
p_delete(&curtags);
|
||||
arrange(screen);
|
||||
globalconf.screens[screen].need_arrange = True;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
4
mouse.c
4
mouse.c
|
@ -217,9 +217,7 @@ uicb_client_resizemouse(int screen, char *arg __attribute__ ((unused)))
|
|||
if(fabs(curtags[0]->mwfact - mwfact) >= 0.05)
|
||||
{
|
||||
curtags[0]->mwfact = mwfact;
|
||||
arrange(screen);
|
||||
/* drop possibly arrived events while we where arrange()ing */
|
||||
while(XCheckMaskEvent(globalconf.display, PointerMotionMask, &ev));
|
||||
globalconf.screens[screen].need_arrange = True;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
5
screen.c
5
screen.c
|
@ -266,7 +266,8 @@ move_client_to_screen(Client *c, int new_screen, Bool doresize)
|
|||
else
|
||||
{
|
||||
c->f_geometry = new_f_geometry;
|
||||
arrange(c->screen);
|
||||
globalconf.screens[old_screen].need_arrange = True;
|
||||
globalconf.screens[c->screen].need_arrange = True;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -346,8 +347,6 @@ uicb_client_movetoscreen(int screen __attribute__ ((unused)), char *arg)
|
|||
prev_screen = sel->screen;
|
||||
move_client_to_screen(sel, new_screen, True);
|
||||
move_mouse_pointer_to_screen(new_screen);
|
||||
arrange(prev_screen);
|
||||
arrange(new_screen);
|
||||
focus(sel, True, sel->screen);
|
||||
/* drop EnterWindow event to keep focus */
|
||||
XCheckMaskEvent(globalconf.display, EnterWindowMask, &event);
|
||||
|
|
|
@ -339,7 +339,7 @@ uicb_statusbar_toggle(int screen, char *arg)
|
|||
for(sb = globalconf.screens[screen].statusbar; sb; sb = sb->next)
|
||||
statusbar_toggle(sb);
|
||||
|
||||
arrange(screen);
|
||||
globalconf.screens[screen].need_arrange = True;
|
||||
}
|
||||
|
||||
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80
|
||||
|
|
|
@ -266,6 +266,8 @@ typedef struct
|
|||
Bool new_get_focus;
|
||||
/** True if new clients should become master */
|
||||
Bool new_become_master;
|
||||
/** True if we need to arrange() */
|
||||
Bool need_arrange;
|
||||
/** Normal colors */
|
||||
XColor colors_normal[ColLast];
|
||||
/** Selected colors */
|
||||
|
|
28
tag.c
28
tag.c
|
@ -77,7 +77,9 @@ tag_client(Client *c, Tag *t)
|
|||
tc->tag = t;
|
||||
tag_client_node_list_push(&globalconf.tclink, tc);
|
||||
|
||||
client_saveprops(c);
|
||||
widget_invalidate_cache(c->screen, WIDGET_CACHE_CLIENTS);
|
||||
globalconf.screens[c->screen].need_arrange = True;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -93,7 +95,9 @@ untag_client(Client *c, Tag *t)
|
|||
break;
|
||||
}
|
||||
|
||||
client_saveprops(c);
|
||||
widget_invalidate_cache(c->screen, WIDGET_CACHE_CLIENTS);
|
||||
globalconf.screens[c->screen].need_arrange = True;
|
||||
}
|
||||
|
||||
Bool
|
||||
|
@ -201,9 +205,6 @@ uicb_client_tag(int screen, char *arg)
|
|||
else
|
||||
for(tag = globalconf.screens[screen].tags; tag; tag = tag->next)
|
||||
tag_client(sel, tag);
|
||||
|
||||
client_saveprops(sel);
|
||||
arrange(screen);
|
||||
}
|
||||
|
||||
/** Toggle a tag on client
|
||||
|
@ -247,9 +248,6 @@ uicb_client_toggletag(int screen, char *arg)
|
|||
tag_client(sel, tag);
|
||||
else
|
||||
untag_client(sel, tag);
|
||||
|
||||
client_saveprops(sel);
|
||||
arrange(screen);
|
||||
}
|
||||
|
||||
/** Add a tag to viewed tags
|
||||
|
@ -270,21 +268,16 @@ uicb_tag_toggleview(int screen, char *arg)
|
|||
target_tag = target_tag->next, i--);
|
||||
|
||||
if(target_tag)
|
||||
target_tag->selected = !target_tag->selected;
|
||||
tag_view(target_tag, !target_tag->selected);
|
||||
|
||||
/* check that there's at least one tag selected */
|
||||
for(tag = globalconf.screens[screen].tags; tag && !tag->selected; tag = tag->next);
|
||||
if(!tag)
|
||||
target_tag->selected = True;
|
||||
tag_view(target_tag, True);
|
||||
}
|
||||
else
|
||||
for(tag = globalconf.screens[screen].tags; tag; tag = tag->next)
|
||||
tag->selected = !tag->selected;
|
||||
|
||||
saveawesomeprops(screen);
|
||||
arrange(screen);
|
||||
ewmh_update_net_current_desktop(get_phys_screen(screen));
|
||||
widget_invalidate_cache(screen, WIDGET_CACHE_TAGS);
|
||||
tag_view(tag, !tag->selected);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -320,6 +313,7 @@ tag_view(Tag *tag, Bool view)
|
|||
ewmh_update_net_current_desktop(get_phys_screen(tag->screen));
|
||||
widget_invalidate_cache(tag->screen, WIDGET_CACHE_TAGS);
|
||||
saveawesomeprops(tag->screen);
|
||||
globalconf.screens[tag->screen].need_arrange = True;
|
||||
}
|
||||
|
||||
/** View tag
|
||||
|
@ -337,8 +331,6 @@ uicb_tag_view(int screen, char *arg)
|
|||
else
|
||||
for(tag = globalconf.screens[screen].tags; tag; tag = tag->next)
|
||||
tag_view(tag, True);
|
||||
|
||||
arrange(screen);
|
||||
}
|
||||
|
||||
/** View previously selected tags
|
||||
|
@ -358,8 +350,6 @@ uicb_tag_prev_selected(int screen, char *arg __attribute__ ((unused)))
|
|||
tag_view(tag, tag->was_selected);
|
||||
tag->was_selected = t;
|
||||
}
|
||||
|
||||
arrange(screen);
|
||||
}
|
||||
|
||||
/** View next tag
|
||||
|
@ -378,7 +368,6 @@ uicb_tag_viewnext(int screen, char *arg __attribute__ ((unused)))
|
|||
tag_view(tag, True);
|
||||
|
||||
p_delete(&curtags);
|
||||
arrange(screen);
|
||||
}
|
||||
|
||||
/** View previous tag
|
||||
|
@ -397,7 +386,6 @@ uicb_tag_viewprev(int screen, char *arg __attribute__ ((unused)))
|
|||
tag_view(tag, True);
|
||||
|
||||
p_delete(&curtags);
|
||||
arrange(screen);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
Loading…
Reference in New Issue