All: Remove split layout (will make a split mode instead) and replace all tag struct bool by flags
This commit is contained in:
parent
99018268ef
commit
57ab723f5d
@ -40,7 +40,7 @@ cfactor_clean(Client *c)
|
||||
{
|
||||
CHECK(c);
|
||||
|
||||
if(!tags[c->screen][c->tag].cleanfact)
|
||||
if(!(tags[c->screen][c->tag].flags & CleanFactFlag))
|
||||
return;
|
||||
|
||||
c->tilefact[Right] = c->tilefact[Left] = 0;
|
||||
@ -131,7 +131,7 @@ _cfactor_arrange_row(Client *c, Position p, int fac)
|
||||
if(cfactor_parentrow(cgeo, cc->frame_geo, p))
|
||||
{
|
||||
cc->tilefact[p] += fac;
|
||||
client_moveresize(cc, cc->geo, tags[cc->screen][cc->tag].resizehint);
|
||||
client_moveresize(cc, cc->geo, (tags[cc->screen][cc->tag].flags & ResizeHintFlag));
|
||||
}
|
||||
|
||||
return;
|
||||
@ -183,8 +183,8 @@ cfactor_arrange_two(Client *c1, Client *c2, Position p, int fac)
|
||||
c2->flags |= FLayFlag;
|
||||
}
|
||||
|
||||
client_moveresize(c1, c1->geo, tags[c1->screen][c1->tag].resizehint);
|
||||
client_moveresize(c2, c2->geo, tags[c2->screen][c2->tag].resizehint);
|
||||
client_moveresize(c1, c1->geo, (tags[c1->screen][c1->tag].flags & ResizeHintFlag));
|
||||
client_moveresize(c2, c2->geo, (tags[c2->screen][c2->tag].flags & ResizeHintFlag));
|
||||
|
||||
return;
|
||||
|
||||
@ -214,7 +214,6 @@ cfactor_check_2pc(XRectangle g1, XRectangle g2, Position p)
|
||||
static void
|
||||
cfactor_arrange_row(Client *c, Client *gc, Position p, int fac)
|
||||
{
|
||||
|
||||
if(cfactor_check_2pc(c->frame_geo, gc->frame_geo, p))
|
||||
cfactor_arrange_two(c, gc, p, fac);
|
||||
else
|
||||
@ -223,7 +222,8 @@ cfactor_arrange_row(Client *c, Client *gc, Position p, int fac)
|
||||
_cfactor_arrange_row(gc, RPOS(p), -fac);
|
||||
}
|
||||
|
||||
split_store_geo(c->screen, c->tag);
|
||||
/* in case of tag additional, use selscreen/seltag */
|
||||
split_store_geo(selscreen, seltag[selscreen]);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
44
src/client.c
44
src/client.c
@ -328,10 +328,9 @@ client_above(Client *c)
|
||||
geo.y = spgeo[c->screen].y + (spgeo[c->screen].height / 2) - (geo.height / 2);
|
||||
geo.x = spgeo[c->screen].x + (spgeo[c->screen].width / 2)- (geo.width / 2);
|
||||
|
||||
client_moveresize(c, geo, tags[c->screen][c->tag].resizehint);
|
||||
client_moveresize(c, geo, (tags[c->screen][c->tag].flags & ResizeHintFlag));
|
||||
client_raise(c);
|
||||
|
||||
split_arrange_closed(c);
|
||||
tags[c->screen][c->tag].layout.func(c->screen);
|
||||
|
||||
return;
|
||||
@ -350,10 +349,7 @@ client_focus(Client *c)
|
||||
if(sel && sel != c)
|
||||
{
|
||||
if(sel->flags & AboveFlag)
|
||||
{
|
||||
sel->flags &= ~AboveFlag;
|
||||
split_client_integrate(sel, client_get_next(), sel->screen, sel->tag);
|
||||
}
|
||||
|
||||
XChangeProperty(dpy, sel->frame, net_atom[net_wm_window_opacity], XA_CARDINAL,
|
||||
32, PropModeReplace, (uchar *)&conf.opacity, 1);
|
||||
@ -389,7 +385,8 @@ client_focus(Client *c)
|
||||
client_raise(c);
|
||||
}
|
||||
|
||||
if(tags[sel->screen][sel->tag].abovefc && !conf.focus_fmouse)
|
||||
if((tags[sel->screen][sel->tag].flags & AboveFCFlag)
|
||||
&& !conf.focus_fmouse)
|
||||
client_above(sel);
|
||||
|
||||
if(c->flags & UrgentFlag)
|
||||
@ -417,12 +414,9 @@ client_focus(Client *c)
|
||||
void
|
||||
client_urgent(Client *c, Bool u)
|
||||
{
|
||||
if(u)
|
||||
c->flags |= UrgentFlag;
|
||||
else
|
||||
c->flags &= ~UrgentFlag;
|
||||
FLAGAPPLY(c->flags, u, UrgentFlag);
|
||||
FLAGAPPLY(tags[c->screen][c->tag].flags, u, TagUrgentFlag);
|
||||
|
||||
tags[c->screen][c->tag].urgent = u;
|
||||
infobar_draw_taglist(c->screen);
|
||||
}
|
||||
|
||||
@ -745,7 +739,7 @@ client_set_rules(Client *c)
|
||||
|
||||
if(c->tag != (uint)seltag[selscreen])
|
||||
{
|
||||
tags[c->screen][c->tag].request_update = True;
|
||||
tags[c->screen][c->tag].flags |= RequestUpdateFlag;
|
||||
client_focus(NULL);
|
||||
}
|
||||
|
||||
@ -764,7 +758,7 @@ client_set_rules(Client *c)
|
||||
c->tag = conf.client.default_open_tag;
|
||||
|
||||
client_focus_next(c);
|
||||
tags[c->screen][c->tag].request_update = True;
|
||||
tags[c->screen][c->tag].flags |= RequestUpdateFlag;
|
||||
}
|
||||
|
||||
if(!applied_screen_rule && conf.client.default_open_screen > -1
|
||||
@ -773,7 +767,7 @@ client_set_rules(Client *c)
|
||||
c->screen = conf.client.default_open_screen;
|
||||
|
||||
client_focus_next(c);
|
||||
tags[c->screen][c->tag].request_update = True;
|
||||
tags[c->screen][c->tag].flags |= RequestUpdateFlag;
|
||||
}
|
||||
|
||||
return;
|
||||
@ -873,13 +867,10 @@ client_manage(Window w, XWindowAttributes *wa, Bool ar)
|
||||
/* Handle client from here */
|
||||
client_attach(c);
|
||||
client_get_name(c);
|
||||
tags[c->screen][c->tag].cleanfact = True;
|
||||
tags[c->screen][c->tag].flags |= CleanFactFlag;;
|
||||
|
||||
client_set_rules(c);
|
||||
|
||||
/* Case of split layout */
|
||||
split_client_integrate(c, sel, c->screen, c->tag);
|
||||
|
||||
client_update_attributes(c);
|
||||
|
||||
/* If client will be visible soon so.. */
|
||||
@ -1047,7 +1038,7 @@ client_maximize(Client *c)
|
||||
c->geo.width = sgeo[c->screen].width - BORDH * 2;
|
||||
c->geo.height = sgeo[c->screen].height - BORDH;
|
||||
|
||||
client_moveresize(c, (c->pgeo = c->geo), tags[c->screen][c->tag].resizehint);
|
||||
client_moveresize(c, (c->pgeo = c->geo), (tags[c->screen][c->tag].flags & ResizeHintFlag));
|
||||
|
||||
return;
|
||||
}
|
||||
@ -1163,8 +1154,8 @@ client_swap(Client *c1, Client *c2)
|
||||
client_size_hints(c2);
|
||||
|
||||
/* Resize the windows */
|
||||
client_moveresize(c1, c1->geo, tags[c1->screen][c1->tag].resizehint);
|
||||
client_moveresize(c2, c2->geo, tags[c2->screen][c2->tag].resizehint);
|
||||
client_moveresize(c1, c1->geo, (tags[c1->screen][c1->tag].flags & ResizeHintFlag));
|
||||
client_moveresize(c2, c2->geo, (tags[c2->screen][c2->tag].flags & ResizeHintFlag));
|
||||
|
||||
/* Get the new client name */
|
||||
client_get_name(c1);
|
||||
@ -1288,16 +1279,10 @@ client_unmanage(Client *c)
|
||||
XUngrabServer(dpy);
|
||||
ewmh_get_client_list();
|
||||
|
||||
if(c->flags & TileFlag)
|
||||
{
|
||||
tags[c->screen][c->tag].cleanfact = True;
|
||||
split_arrange_closed(c);
|
||||
}
|
||||
|
||||
if(c->tag == MAXTAG + 1)
|
||||
{
|
||||
for(i = 0; i < conf.ntag[c->screen]; i++)
|
||||
tags[c->screen][i].request_update = True;
|
||||
tags[c->screen][i].flags |= RequestUpdateFlag;
|
||||
tags[c->screen][seltag[c->screen]].layout.func(c->screen);
|
||||
}
|
||||
else
|
||||
@ -1319,7 +1304,7 @@ client_unmanage(Client *c)
|
||||
tags[c->screen][c->tag].layout.func(c->screen);
|
||||
else
|
||||
{
|
||||
tags[c->screen][c->tag].request_update = True;
|
||||
tags[c->screen][c->tag].flags |= RequestUpdateFlag;
|
||||
infobar_draw(c->screen);
|
||||
}
|
||||
}
|
||||
@ -1390,7 +1375,6 @@ client_set_screen(Client *c, int s)
|
||||
|
||||
arrange(s, True);
|
||||
arrange(os, True);
|
||||
split_client_integrate(c, NULL, c->screen, c->tag);
|
||||
|
||||
if(!(c->flags & TileFlag))
|
||||
{
|
||||
|
||||
35
src/config.c
35
src/config.c
@ -527,13 +527,25 @@ conf_tag_section(void)
|
||||
/* If there is no tag in the conf or more than
|
||||
* MAXTAG (36) print an error and create only one.
|
||||
*/
|
||||
Tag default_tag = { fetch_opt_first(def_tag, "new tag", "name").str, NULL, 1,
|
||||
fetch_opt_first(def_tag, "0.6", "mwfact").fnum,
|
||||
fetch_opt_first(def_tag, "1", "nmaster").num,
|
||||
False, fetch_opt_first(def_tag, "False", "resizehint").bool,
|
||||
False, False, False, bar_pos, bar_pos,
|
||||
layout_name_to_struct(conf.layout, fetch_opt_first(def_tag, "tile", "layout").str, conf.nlayout, layout_list),
|
||||
0, NULL, 0, False };
|
||||
Tag default_tag =
|
||||
{
|
||||
fetch_opt_first(def_tag, "new tag", "name").str,
|
||||
NULL,
|
||||
1,
|
||||
fetch_opt_first(def_tag, "0.6", "mwfact").fnum,
|
||||
fetch_opt_first(def_tag, "1", "nmaster").num,
|
||||
0,
|
||||
bar_pos,
|
||||
bar_pos,
|
||||
layout_name_to_struct(conf.layout, fetch_opt_first(def_tag, "tile", "layout").str, conf.nlayout, layout_list),
|
||||
0,
|
||||
NULL,
|
||||
0
|
||||
};
|
||||
|
||||
FLAGAPPLY(default_tag.flags,
|
||||
fetch_opt_first(def_tag, "False", "resizehint").bool,
|
||||
ResizeHintFlag);
|
||||
|
||||
conf.default_tag = default_tag;
|
||||
|
||||
@ -582,8 +594,13 @@ conf_tag_section(void)
|
||||
tags[k][conf.ntag[k]].name = fetch_opt_first(tag[i], fetch_opt_first(def_tag, "", "name").str, "name").str;
|
||||
tags[k][conf.ntag[k]].mwfact = fetch_opt_first(tag[i], fetch_opt_first(def_tag, "0.65", "mwfact").str, "mwfact").fnum;
|
||||
tags[k][conf.ntag[k]].nmaster = fetch_opt_first(tag[i], fetch_opt_first(def_tag, "1", "nmaster").str, "nmaster").num;
|
||||
tags[k][conf.ntag[k]].resizehint = fetch_opt_first(tag[i], fetch_opt_first(def_tag, "false", "resizehint").str, "resizehint").bool;
|
||||
tags[k][conf.ntag[k]].abovefc = fetch_opt_first(tag[i], "false", "abovefc").bool;
|
||||
FLAGAPPLY(tags[k][conf.ntag[k]].flags,
|
||||
fetch_opt_first(tag[i], fetch_opt_first(def_tag, "false", "resizehint").str, "resizehint").bool,
|
||||
ResizeHintFlag);
|
||||
|
||||
FLAGAPPLY(tags[k][conf.ntag[k]].flags,
|
||||
fetch_opt_first(tag[i], "false", "abovefc").bool,
|
||||
AboveFCFlag);
|
||||
|
||||
tmp = fetch_opt_first(tag[i], fetch_opt_first(def_tag, "top", "infobar_position").str, "infobar_position").str;
|
||||
|
||||
|
||||
@ -256,7 +256,7 @@ infobar_draw_taglist(int sc)
|
||||
barwin_resize(infobar[sc].tags_board, x, infobar[sc].geo.height);
|
||||
}
|
||||
|
||||
infobar[sc].tags[i]->bg = tags[sc][i].urgent
|
||||
infobar[sc].tags[i]->bg = (tags[sc][i].flags & TagUrgentFlag)
|
||||
? conf.colors.tagurbg
|
||||
: ((i == seltag[sc] || tags[sc][seltag[sc]].tagad & TagFlag(i))
|
||||
? conf.colors.tagselbg
|
||||
@ -264,7 +264,7 @@ infobar_draw_taglist(int sc)
|
||||
? conf.colors.tag_occupied_bg
|
||||
: conf.colors.bar));
|
||||
|
||||
infobar[sc].tags[i]->fg = tags[sc][i].urgent
|
||||
infobar[sc].tags[i]->fg = (tags[sc][i].flags & TagUrgentFlag)
|
||||
? conf.colors.tagurfg
|
||||
: ((i == seltag[sc] || tags[sc][seltag[sc]].tagad & TagFlag(i))
|
||||
? conf.colors.tagselfg
|
||||
|
||||
@ -52,7 +52,6 @@ const func_name_list_t layout_list[] =
|
||||
{"maxlayout", maxlayout },
|
||||
{"freelayout", freelayout },
|
||||
{"free", freelayout },
|
||||
{"split", split },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
|
||||
83
src/layout.c
83
src/layout.c
@ -116,7 +116,7 @@ layoutswitch(Bool b)
|
||||
}
|
||||
|
||||
ewmh_update_current_tag_prop();
|
||||
tags[selscreen][seltag[selscreen]].cleanfact = True;
|
||||
tags[selscreen][seltag[selscreen]].flags |= CleanFactFlag;
|
||||
tags[selscreen][seltag[selscreen]].layout.func(selscreen);
|
||||
infobar_draw(selscreen);
|
||||
|
||||
@ -230,7 +230,7 @@ uicb_set_nmaster(uicb_t cmd)
|
||||
return;
|
||||
|
||||
tags[selscreen][seltag[selscreen]].nmaster += n;
|
||||
tags[selscreen][seltag[selscreen]].cleanfact = True;
|
||||
tags[selscreen][seltag[selscreen]].flags |= CleanFactFlag;
|
||||
tags[selscreen][seltag[selscreen]].layout.func(selscreen);
|
||||
|
||||
ewmh_update_current_tag_prop();
|
||||
@ -287,7 +287,7 @@ grid(int screen, Bool horizontal)
|
||||
cgeo.width = sg.width - (cgeo.x - (sg.x - (BORDH * 2)));
|
||||
|
||||
/* Resize */
|
||||
client_moveresize(c, (c->pgeo = cgeo), tags[screen][seltag[screen]].resizehint);
|
||||
client_moveresize(c, (c->pgeo = cgeo), (tags[screen][seltag[screen]].flags & ResizeHintFlag));
|
||||
|
||||
/* Set all the other size with current client info */
|
||||
cgeo.y = c->pgeo.y + c->pgeo.height + BORDH + TBARH;
|
||||
@ -300,45 +300,7 @@ grid(int screen, Bool horizontal)
|
||||
}
|
||||
}
|
||||
|
||||
tags[screen][seltag[screen]].cleanfact = False;
|
||||
ewmh_update_current_tag_prop();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/** Split layout function
|
||||
* This function is a trick compared to dynamic layout function, see split.c
|
||||
*/
|
||||
void
|
||||
split(int screen)
|
||||
{
|
||||
Client *c, *tc;
|
||||
unsigned int n, ns;
|
||||
|
||||
for(n = ns = 0, (c = tc = tiled_client(screen, clients)); c; c = tiled_client(screen, c->next), ++n)
|
||||
if(c->flags & SplitFlag)
|
||||
++ns;
|
||||
|
||||
CHECK((tags[screen][seltag[screen]].nclients = n));
|
||||
|
||||
if(n == 1 && !(tc->flags & SplitFlag))
|
||||
client_maximize(tc);
|
||||
if(!ns)
|
||||
grid(screen, True);
|
||||
|
||||
for(c = tiled_client(screen, clients); c; c = tiled_client(screen, c->next))
|
||||
{
|
||||
c->flags &= ~(MaxFlag | LMaxFlag);
|
||||
c->flags |= (TileFlag | SplitFlag);
|
||||
|
||||
if(tags[screen][seltag[screen]].layout.splitusegeo)
|
||||
client_moveresize(c, (c->pgeo = c->split_geo), tags[screen][seltag[screen]].resizehint);
|
||||
|
||||
}
|
||||
|
||||
if(tags[screen][seltag[screen]].layout.splitusegeo)
|
||||
tags[screen][seltag[screen]].layout.splitusegeo = False;
|
||||
|
||||
tags[selscreen][seltag[selscreen]].flags &= ~CleanFactFlag;
|
||||
ewmh_update_current_tag_prop();
|
||||
|
||||
return;
|
||||
@ -461,7 +423,7 @@ multi_tile(int screen, Position type)
|
||||
}
|
||||
|
||||
/* Magic instant */
|
||||
client_moveresize(c, (c->pgeo = cgeo), tags[screen][seltag[screen]].resizehint);
|
||||
client_moveresize(c, (c->pgeo = cgeo), (tags[screen][seltag[screen]].flags & ResizeHintFlag));
|
||||
|
||||
/* Set the position of the next client */
|
||||
if(type == Top || type == Bottom)
|
||||
@ -470,7 +432,7 @@ multi_tile(int screen, Position type)
|
||||
cgeo.y = c->pgeo.y + c->pgeo.height + BORDH + TBARH;
|
||||
}
|
||||
|
||||
tags[screen][seltag[screen]].cleanfact = False;
|
||||
tags[selscreen][seltag[selscreen]].flags &= ~CleanFactFlag;
|
||||
ewmh_update_current_tag_prop();
|
||||
|
||||
return;
|
||||
@ -620,7 +582,7 @@ mirror(int screen, Bool horizontal)
|
||||
}
|
||||
}
|
||||
|
||||
client_moveresize(c, (c->pgeo = cgeo), tags[screen][seltag[screen]].resizehint);
|
||||
client_moveresize(c, (c->pgeo = cgeo), (tags[screen][seltag[screen]].flags & ResizeHintFlag));
|
||||
|
||||
if(i >= nmaster)
|
||||
nextg[!isp] = c->pgeo;
|
||||
@ -653,7 +615,7 @@ mirror(int screen, Bool horizontal)
|
||||
|
||||
}
|
||||
|
||||
tags[screen][seltag[screen]].cleanfact = False;
|
||||
tags[selscreen][seltag[selscreen]].flags &= ~CleanFactFlag;
|
||||
ewmh_update_current_tag_prop();
|
||||
|
||||
return;
|
||||
@ -758,8 +720,8 @@ uicb_togglefree(uicb_t cmd)
|
||||
|
||||
if(sel->flags & FreeFlag)
|
||||
{
|
||||
split_arrange_closed(sel);
|
||||
sel->flags &= ~(TileFlag | MaxFlag | LMaxFlag | SplitFlag);
|
||||
sel->flags &= ~(TileFlag | MaxFlag | LMaxFlag);
|
||||
|
||||
client_moveresize(sel, sel->free_geo, True);
|
||||
client_raise(sel);
|
||||
}
|
||||
@ -767,12 +729,11 @@ uicb_togglefree(uicb_t cmd)
|
||||
{
|
||||
sel->free_geo = sel->geo;
|
||||
sel->ogeo = sel->geo;
|
||||
split_client_integrate(sel, client_get_next(), sel->screen, sel->tag);
|
||||
}
|
||||
|
||||
client_update_attributes(sel);
|
||||
|
||||
tags[selscreen][seltag[selscreen]].cleanfact = True;
|
||||
tags[selscreen][seltag[selscreen]].flags |= CleanFactFlag;
|
||||
tags[selscreen][seltag[selscreen]].layout.func(selscreen);
|
||||
|
||||
return;
|
||||
@ -797,16 +758,17 @@ uicb_togglemax(uicb_t cmd)
|
||||
sel->ogeo = sel->geo;
|
||||
sel->free_geo = sel->geo;
|
||||
sel->flags &= ~(TileFlag | FreeFlag);
|
||||
split_arrange_closed(sel);
|
||||
|
||||
client_maximize(sel);
|
||||
XRaiseWindow(dpy, sel->frame);
|
||||
}
|
||||
else
|
||||
{
|
||||
sel->geo = sel->ogeo;
|
||||
|
||||
client_moveresize(sel, sel->geo, True);
|
||||
split_client_integrate(sel, client_get_next(), sel->screen, sel->tag);
|
||||
tags[selscreen][seltag[selscreen]].cleanfact = True;
|
||||
|
||||
tags[selscreen][seltag[selscreen]].flags |= CleanFactFlag;
|
||||
tags[selscreen][seltag[selscreen]].layout.func(selscreen);
|
||||
}
|
||||
|
||||
@ -824,10 +786,10 @@ uicb_toggle_resizehint(uicb_t cmd)
|
||||
screen_get_sel();
|
||||
(void)cmd;
|
||||
|
||||
tags[selscreen][seltag[selscreen]].resizehint = !tags[selscreen][seltag[selscreen]].resizehint;
|
||||
tags[selscreen][seltag[selscreen]].flags ^= ResizeHintFlag;
|
||||
|
||||
for(c = tiled_client(selscreen, clients); c; c = tiled_client(selscreen, c->next))
|
||||
client_moveresize(c, c->geo, tags[selscreen][seltag[selscreen]].resizehint);
|
||||
client_moveresize(c, c->geo, (tags[selscreen][seltag[selscreen]].flags & ResizeHintFlag));
|
||||
|
||||
return;
|
||||
}
|
||||
@ -843,7 +805,9 @@ uicb_toggle_abovefc(uicb_t cmd)
|
||||
|
||||
screen_get_sel();
|
||||
|
||||
if(!(tags[selscreen][seltag[selscreen]].abovefc = !tags[selscreen][seltag[selscreen]].abovefc))
|
||||
tags[selscreen][seltag[selscreen]].flags ^= AboveFCFlag;
|
||||
|
||||
if(!(tags[selscreen][seltag[selscreen]].flags & AboveFCFlag))
|
||||
{
|
||||
for(c = clients; c; c = c->next)
|
||||
if(c->flags & AboveFlag
|
||||
@ -851,11 +815,10 @@ uicb_toggle_abovefc(uicb_t cmd)
|
||||
&& c->tag == (uint)seltag[selscreen])
|
||||
{
|
||||
c->flags &= ~AboveFlag;
|
||||
split_client_integrate(c, NULL, sel->screen, sel->tag);
|
||||
break;
|
||||
}
|
||||
|
||||
tags[selscreen][seltag[selscreen]].cleanfact = True;
|
||||
tags[selscreen][seltag[selscreen]].flags |= CleanFactFlag;
|
||||
tags[selscreen][seltag[selscreen]].layout.func(selscreen);
|
||||
}
|
||||
|
||||
@ -883,7 +846,7 @@ uicb_set_layout(uicb_t cmd)
|
||||
if(layout_list[i].func == conf.layout[j].func)
|
||||
tags[selscreen][seltag[selscreen]].layout = conf.layout[j];
|
||||
|
||||
tags[selscreen][seltag[selscreen]].cleanfact = True;
|
||||
tags[selscreen][seltag[selscreen]].flags |= CleanFactFlag;
|
||||
arrange(selscreen, True);
|
||||
|
||||
return;
|
||||
@ -907,7 +870,7 @@ layout_set_client_master(Client *c)
|
||||
client_detach(c);
|
||||
client_attach(c);
|
||||
|
||||
tags[selscreen][seltag[selscreen]].cleanfact = True;
|
||||
tags[selscreen][seltag[selscreen]].flags |= CleanFactFlag;
|
||||
tags[selscreen][seltag[selscreen]].layout.func(selscreen);
|
||||
|
||||
return;
|
||||
|
||||
26
src/split.c
26
src/split.c
@ -67,15 +67,11 @@ _split_check_row(XRectangle g1, XRectangle g2, Position p)
|
||||
void
|
||||
split_store_geo(int screen, int tag)
|
||||
{
|
||||
int e;
|
||||
Client *c;
|
||||
|
||||
if(tags[screen][tag].layout.func != split)
|
||||
return;
|
||||
|
||||
for(c = clients; c; c = c->next)
|
||||
if(c->screen == screen && c->tag == tag
|
||||
&& (c->flags & (SplitFlag | TileFlag)))
|
||||
&& (c->flags & TileFlag))
|
||||
c->split_geo = c->wrgeo;
|
||||
|
||||
return;
|
||||
@ -125,9 +121,6 @@ split_arrange_closed(Client *ghost)
|
||||
int screen = ghost->screen;
|
||||
int tag = (ghost->tag ? ghost->tag : seltag[screen]);
|
||||
|
||||
if(tags[screen][tag].layout.func != split)
|
||||
return;
|
||||
|
||||
/* Use ghost client properties to fix holes in tile
|
||||
* .--. ~ ~
|
||||
* /xx \ ~ ~
|
||||
@ -153,7 +146,7 @@ split_arrange_closed(Client *ghost)
|
||||
{
|
||||
_split_arrange_size(ghost->wrgeo, &c->wrgeo, p);
|
||||
cfactor_clean(c);
|
||||
client_moveresize(c, (c->pgeo = c->wrgeo), tags[screen][tag].resizehint);
|
||||
client_moveresize(c, (c->pgeo = c->wrgeo), (tags[screen][tag].flags & ResizeHintFlag));
|
||||
|
||||
return;
|
||||
}
|
||||
@ -176,7 +169,7 @@ split_arrange_closed(Client *ghost)
|
||||
{
|
||||
_split_arrange_size(ghost->wrgeo, &cc->wrgeo, p);
|
||||
cfactor_clean(cc);
|
||||
client_moveresize(cc, (cc->pgeo = cc->wrgeo), tags[screen][cc->tag].resizehint);
|
||||
client_moveresize(cc, (cc->pgeo = cc->wrgeo), (tags[screen][tag].flags & ResizeHintFlag));
|
||||
b = True;
|
||||
}
|
||||
}
|
||||
@ -196,14 +189,13 @@ split_client(Client *c, Bool p)
|
||||
{
|
||||
XRectangle geo, sgeo;
|
||||
|
||||
if(!c || !(c->flags & TileFlag)
|
||||
|| tags[c->screen][c->tag].layout.func != split)
|
||||
if(!c || !(c->flags & TileFlag))
|
||||
return c->wrgeo;
|
||||
|
||||
cfactor_clean(c);
|
||||
|
||||
c->flags &= ~(MaxFlag | LMaxFlag);
|
||||
c->flags |= (TileFlag | SplitFlag);
|
||||
c->flags |= TileFlag;
|
||||
|
||||
/* Use geometry without resizehint applied on it */
|
||||
geo = sgeo = c->wrgeo;
|
||||
@ -229,7 +221,7 @@ split_client(Client *c, Bool p)
|
||||
sgeo.height += (c->wrgeo.y + c->wrgeo.height) - (sgeo.y + sgeo.height);
|
||||
}
|
||||
|
||||
client_moveresize(c, (c->pgeo = geo), tags[c->screen][c->tag].resizehint);
|
||||
client_moveresize(c, (c->pgeo = geo), (tags[c->screen][c->tag].flags & ResizeHintFlag));
|
||||
|
||||
return sgeo;
|
||||
}
|
||||
@ -245,10 +237,10 @@ split_client_fill(Client *c, XRectangle geo)
|
||||
return;
|
||||
|
||||
c->flags &= ~(MaxFlag | LMaxFlag);
|
||||
c->flags |= (TileFlag | SplitFlag);
|
||||
c->flags |= TileFlag;
|
||||
|
||||
cfactor_clean(c);
|
||||
client_moveresize(c, (c->pgeo = geo), tags[c->screen][c->tag].resizehint);
|
||||
client_moveresize(c, (c->pgeo = geo), (tags[c->screen][c->tag].flags & ResizeHintFlag));
|
||||
|
||||
return;
|
||||
}
|
||||
@ -271,7 +263,7 @@ split_client_integrate(Client *c, Client *sc, int screen, int tag)
|
||||
/* Looking for first client on wanted tag */
|
||||
for(b = False, sc = clients; sc; sc = sc->next)
|
||||
if(sc->screen == screen && sc->tag == tag
|
||||
&& (c->flags & (TileFlag | SplitFlag)))
|
||||
&& (c->flags & TileFlag))
|
||||
{
|
||||
b = True;
|
||||
break;
|
||||
|
||||
@ -53,7 +53,14 @@
|
||||
#define UrgentFlag (1 << 10)
|
||||
#define FLayFlag (1 << 11)
|
||||
#define DockFlag (1 << 12)
|
||||
#define SplitFlag (1 << 13)
|
||||
|
||||
/* Tag flags definition */
|
||||
#define TagUrgentFlag (1 << 1)
|
||||
#define ResizeHintFlag (1 << 2)
|
||||
#define RequestUpdateFlag (1 << 3)
|
||||
#define AboveFCFlag (1 << 4)
|
||||
#define CleanFactFlag (1 << 5)
|
||||
#define StayLastFlag (1 << 6)
|
||||
|
||||
#define TagFlag(t) (1 << (t))
|
||||
|
||||
@ -281,18 +288,13 @@ typedef struct
|
||||
int nclients;
|
||||
float mwfact;
|
||||
int nmaster;
|
||||
Bool urgent;
|
||||
Bool resizehint;
|
||||
Bool request_update;
|
||||
Bool abovefc;
|
||||
Bool cleanfact;
|
||||
uint flags;
|
||||
int barpos;
|
||||
int prev_barpos;
|
||||
Layout layout;
|
||||
uint tagad;
|
||||
MouseBinding *mouse;
|
||||
int nmouse;
|
||||
Bool stay_last;
|
||||
} Tag;
|
||||
|
||||
/* Menu Item Struct */
|
||||
|
||||
70
src/tag.c
70
src/tag.c
@ -81,10 +81,10 @@ tag_set(int tag)
|
||||
/* Check if a layout update is needed with additional tags */
|
||||
if(tags[selscreen][seltag[selscreen]].tagad)
|
||||
al = True;
|
||||
else if(tags[selscreen][seltag[selscreen]].request_update)
|
||||
else if(tags[selscreen][seltag[selscreen]].flags & RequestUpdateFlag)
|
||||
{
|
||||
al = True;
|
||||
tags[selscreen][seltag[selscreen]].request_update = False;
|
||||
tags[selscreen][seltag[selscreen]].flags &= ~RequestUpdateFlag;
|
||||
}
|
||||
|
||||
for(i = 1; i < conf.ntag[selscreen] + 1; ++i)
|
||||
@ -104,10 +104,10 @@ tag_set(int tag)
|
||||
|
||||
arrange(selscreen, al);
|
||||
|
||||
if(tags[selscreen][tag].request_update)
|
||||
if(tags[selscreen][tag].flags & RequestUpdateFlag)
|
||||
{
|
||||
tags[selscreen][seltag[selscreen]].layout.func(selscreen);
|
||||
tags[selscreen][tag].request_update = False;
|
||||
tags[selscreen][seltag[selscreen]].flags &= ~RequestUpdateFlag;
|
||||
}
|
||||
|
||||
/* To focus selected client of the via focusontag option */
|
||||
@ -148,14 +148,6 @@ tag_transfert(Client *c, int tag)
|
||||
|
||||
s = c->screen;
|
||||
|
||||
if(c->flags & SplitFlag)
|
||||
{
|
||||
split_arrange_closed(c);
|
||||
split_client_integrate(c, NULL, selscreen, tag);
|
||||
tags[c->screen][c->tag].cleanfact = True;
|
||||
cfactor_clean(c);
|
||||
}
|
||||
|
||||
c->tag = tag;
|
||||
c->screen = selscreen;
|
||||
|
||||
@ -167,7 +159,7 @@ tag_transfert(Client *c, int tag)
|
||||
client_focus_next(c);
|
||||
client_update_attributes(c);
|
||||
|
||||
tags[c->screen][tag].request_update = True;
|
||||
tags[c->screen][c->tag].flags |= RequestUpdateFlag;
|
||||
|
||||
return;
|
||||
}
|
||||
@ -327,9 +319,9 @@ remove_old_last_tag(int selscreen)
|
||||
int i;
|
||||
for(i = 0; i <= conf.ntag[selscreen]; i++)
|
||||
{
|
||||
if(tags[selscreen][i].stay_last)
|
||||
if(tags[selscreen][i].flags & StayLastFlag)
|
||||
{
|
||||
tags[selscreen][i].stay_last = False;
|
||||
tags[selscreen][i].flags &= ~StayLastFlag;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -380,8 +372,8 @@ uicb_tag_stay_last(uicb_t cmd)
|
||||
|
||||
screen_get_sel();
|
||||
|
||||
if(tags[selscreen][seltag[selscreen]].stay_last)
|
||||
tags[selscreen][seltag[selscreen]].stay_last = False;
|
||||
if(tags[selscreen][seltag[selscreen]].flags & StayLastFlag)
|
||||
tags[selscreen][seltag[selscreen]].flags &= ~StayLastFlag;
|
||||
|
||||
else
|
||||
{
|
||||
@ -394,7 +386,7 @@ uicb_tag_stay_last(uicb_t cmd)
|
||||
}
|
||||
|
||||
tag_set(conf.ntag[selscreen]);
|
||||
tags[selscreen][seltag[selscreen]].stay_last = True;
|
||||
tags[selscreen][seltag[selscreen]].flags |= StayLastFlag;
|
||||
arrange(selscreen, True);
|
||||
}
|
||||
|
||||
@ -508,17 +500,10 @@ tag_additional(int sc, int tag, int adtag)
|
||||
|| adtag < 1 || adtag > conf.ntag[sc] || adtag == seltag[sc])
|
||||
return;
|
||||
|
||||
/* TODO: Find a way to use split + additional properly */
|
||||
if(tags[sc][tag].layout.func == split)
|
||||
return;
|
||||
|
||||
tags[sc][tag].tagad ^= TagFlag(adtag);
|
||||
tags[sc][adtag].request_update = True;
|
||||
tags[sc][tag].cleanfact = True;
|
||||
tags[sc][adtag].cleanfact = True;
|
||||
|
||||
if(tags[sc][adtag].layout.func == split)
|
||||
tags[sc][adtag].layout.splitusegeo = True;
|
||||
tags[sc][adtag].flags |= RequestUpdateFlag;
|
||||
tags[sc][tag].flags |= CleanFactFlag;
|
||||
tags[sc][adtag].flags |= CleanFactFlag;
|
||||
|
||||
arrange(sc, True);
|
||||
|
||||
@ -561,14 +546,10 @@ uicb_tag_swap_next(uicb_t cmd)
|
||||
screen_get_sel();
|
||||
|
||||
/* Check if the next one does have the stay_last bool */
|
||||
if(!tags[selscreen][conf.ntag[selscreen]].stay_last)
|
||||
{
|
||||
if(!(tags[selscreen][conf.ntag[selscreen]].flags & StayLastFlag))
|
||||
tag_swap(selscreen, seltag[selscreen], seltag[selscreen] + 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
warnx("The next tag is set to always stay the last one");
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
@ -622,18 +603,17 @@ tag_new(int s, char *name)
|
||||
|
||||
|
||||
Tag t = { displayedName, NULL, 0,
|
||||
conf.default_tag.mwfact, conf.default_tag.nmaster,
|
||||
False, conf.default_tag.resizehint, False, False, False,
|
||||
conf.default_tag.mwfact, conf.default_tag.nmaster, conf.default_tag.flags,
|
||||
conf.default_tag.barpos, conf.default_tag.barpos,
|
||||
conf.default_tag.layout, 0, NULL, 0, False };
|
||||
conf.default_tag.layout, 0, NULL, 0 };
|
||||
|
||||
tags[s][conf.ntag[s]] = t;
|
||||
|
||||
/* For stay_last_tag */
|
||||
if(tags[s][conf.ntag[s]-1].stay_last)
|
||||
if(tags[s][conf.ntag[s] - 1].flags & StayLastFlag)
|
||||
{
|
||||
tag_swap(s, conf.ntag[s], conf.ntag[s]-1);
|
||||
goToTag = conf.ntag[s]-1;
|
||||
tag_swap(s, conf.ntag[s], conf.ntag[s] - 1);
|
||||
goToTag = conf.ntag[s] - 1;
|
||||
}
|
||||
else
|
||||
goToTag = conf.ntag[s];
|
||||
@ -773,7 +753,7 @@ uicb_tag_toggle_expose(uicb_t cmd)
|
||||
tag_delete(selscreen, i);
|
||||
|
||||
for(j = 0; j < conf.ntag[selscreen]; j++)
|
||||
tags[selscreen][j].request_update = True;
|
||||
tags[selscreen][j].flags |= RequestUpdateFlag;
|
||||
|
||||
arrange(selscreen, True);
|
||||
|
||||
@ -784,19 +764,13 @@ uicb_tag_toggle_expose(uicb_t cmd)
|
||||
tag_new(selscreen, conf.tag_expose_name);
|
||||
|
||||
for(i = 0; i < conf.nlayout; ++i)
|
||||
{
|
||||
if(strcmp(conf.expose_layout, conf.layout[i].type) == 0)
|
||||
{
|
||||
tags[selscreen][conf.ntag[selscreen]].layout = conf.layout[i];
|
||||
}
|
||||
}
|
||||
tags[selscreen][conf.ntag[selscreen]].layout = conf.layout[i];
|
||||
|
||||
for(i = 1; i < conf.ntag[selscreen]; ++i)
|
||||
{
|
||||
tags[selscreen][conf.ntag[selscreen]].tagad ^= TagFlag(i);
|
||||
}
|
||||
|
||||
tags[selscreen][conf.ntag[selscreen]].request_update = True;
|
||||
tags[selscreen][conf.ntag[selscreen]].flags |= RequestUpdateFlag;
|
||||
arrange(selscreen, True);
|
||||
|
||||
return;
|
||||
|
||||
@ -285,7 +285,7 @@ scan(void)
|
||||
{
|
||||
if(c->tag > (uint)conf.ntag[c->screen])
|
||||
c->tag = conf.ntag[c->screen];
|
||||
tags[c->screen][c->tag].request_update = True;
|
||||
tags[c->screen][c->tag].flags |= RequestUpdateFlag;
|
||||
}
|
||||
|
||||
for(i = 0; i < s; ++i)
|
||||
|
||||
20
src/wmfs.h
20
src/wmfs.h
@ -102,15 +102,16 @@
|
||||
XSetWindowBackground(dpy, win, (col)); \
|
||||
} while (/* CONSTCOND */ 0)
|
||||
|
||||
#define ATOM(a) XInternAtom(dpy, (a), False)
|
||||
#define FRAMEW(w) ((w) + BORDH * 2)
|
||||
#define FRAMEH(h) ((h) + (BORDH + TBARH))
|
||||
#define ROUND(x) (float)((x > 0) ? x + (float)0.5 : x - (float)0.5)
|
||||
#define CHECK(x) if(!(x)) return
|
||||
#define LEN(x) (sizeof(x) / sizeof((x)[0]))
|
||||
#define MAXCLIST (64)
|
||||
#define RPOS(x) (x % 2 ? x - 1 : x + 1)
|
||||
#define LDIR(x) (x < Top)
|
||||
#define ATOM(a) XInternAtom(dpy, (a), False)
|
||||
#define FRAMEW(w) ((w) + BORDH * 2)
|
||||
#define FRAMEH(h) ((h) + (BORDH + TBARH))
|
||||
#define ROUND(x) (float)((x > 0) ? x + (float)0.5 : x - (float)0.5)
|
||||
#define CHECK(x) if(!(x)) return
|
||||
#define LEN(x) (sizeof(x) / sizeof((x)[0]))
|
||||
#define MAXCLIST (64)
|
||||
#define RPOS(x) (x % 2 ? x - 1 : x + 1)
|
||||
#define LDIR(x) (x < Top)
|
||||
#define FLAGAPPLY(v, b, f) ((b) ? (v |= (f)) : (v &= ~(f)))
|
||||
|
||||
/* barwin.c */
|
||||
BarWindow *barwin_create(Window parent,
|
||||
@ -351,7 +352,6 @@ Client *tiled_client(int screen, Client *c);
|
||||
void freelayout(int screen);
|
||||
void layoutswitch(Bool b);
|
||||
void maxlayout(int screen);
|
||||
void split(int screen);
|
||||
/* tile {{{ */
|
||||
void tile(int screen);
|
||||
void tile_left(int screen);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user