mirror of
https://github.com/0intro/wmii
synced 2024-11-22 22:02:30 +03:00
renamed local functions which names might conflict with other funcs from _ to x prefix (Pike style)
This commit is contained in:
parent
f3920c44dd
commit
d93bdf0558
@ -26,7 +26,7 @@ struct Cell {
|
|||||||
Frame *frame;
|
Frame *frame;
|
||||||
Cell *next;
|
Cell *next;
|
||||||
Cell *prev;
|
Cell *prev;
|
||||||
Column *col;
|
Column *column;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Column {
|
struct Column {
|
||||||
@ -38,25 +38,25 @@ struct Column {
|
|||||||
Column *next;
|
Column *next;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void init_col(Layout *l, Client * clients);
|
static void init_column(Layout *l, Client * clients);
|
||||||
static Client *deinit_col(Layout *l);
|
static Client *deinit_column(Layout *l);
|
||||||
static void arrange_col(Layout *l);
|
static void arrange_column(Layout *l);
|
||||||
static Bool attach_col(Layout *l, Client * c);
|
static Bool attach_column(Layout *l, Client * c);
|
||||||
static void detach_col(Layout *l, Client * c, Bool unmap);
|
static void detach_column(Layout *l, Client * c, Bool unmap);
|
||||||
static void resize_col(Frame * f, XRectangle * new, XPoint * pt);
|
static void resize_column(Frame * f, XRectangle * new, XPoint * pt);
|
||||||
static void focus_col(Layout *l, Client *c, Bool raise);
|
static void focus_column(Layout *l, Client *c, Bool raise);
|
||||||
static Frame *frames_col(Layout *l);
|
static Frame *frames_column(Layout *l);
|
||||||
static Client *sel_col(Layout *l);
|
static Client *sel_column(Layout *l);
|
||||||
static Action *actions_col(Layout *l);
|
static Action *actions_column(Layout *l);
|
||||||
|
|
||||||
static void select_frame(void *obj, char *arg);
|
static void select_frame(void *obj, char *arg);
|
||||||
static void swap_frame(void *obj, char *arg);
|
static void swap_frame(void *obj, char *arg);
|
||||||
static void new_col(void *obj, char *arg);
|
static void new_column(void *obj, char *arg);
|
||||||
|
|
||||||
static Action lcol_acttbl[] = {
|
static Action lcol_acttbl[] = {
|
||||||
{"select", select_frame},
|
{"select", select_frame},
|
||||||
{"swap", swap_frame},
|
{"swap", swap_frame},
|
||||||
{"new", new_col},
|
{"new", new_column},
|
||||||
{0, 0}
|
{0, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -65,16 +65,16 @@ init_layout_column()
|
|||||||
{
|
{
|
||||||
LayoutDef *lp, *l = cext_emallocz(sizeof(LayoutDef));
|
LayoutDef *lp, *l = cext_emallocz(sizeof(LayoutDef));
|
||||||
l->name = "column";
|
l->name = "column";
|
||||||
l->init = init_col;
|
l->init = init_column;
|
||||||
l->deinit = deinit_col;
|
l->deinit = deinit_column;
|
||||||
l->arrange = arrange_col;
|
l->arrange = arrange_column;
|
||||||
l->attach = attach_col;
|
l->attach = attach_column;
|
||||||
l->detach = detach_col;
|
l->detach = detach_column;
|
||||||
l->resize = resize_col;
|
l->resize = resize_column;
|
||||||
l->focus = focus_col;
|
l->focus = focus_column;
|
||||||
l->frames = frames_col;
|
l->frames = frames_column;
|
||||||
l->sel = sel_col;
|
l->sel = sel_column;
|
||||||
l->actions = actions_col;
|
l->actions = actions_column;
|
||||||
|
|
||||||
for(lp = layouts; lp && lp->next; lp = lp->next);
|
for(lp = layouts; lp && lp->next; lp = lp->next);
|
||||||
if(lp)
|
if(lp)
|
||||||
@ -84,13 +84,13 @@ init_layout_column()
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
arrange_column(Column * col)
|
xarrange_column(Column * column)
|
||||||
{
|
{
|
||||||
Cell *cell;
|
Cell *cell;
|
||||||
unsigned int i = 0, h = layout_rect.height / col->ncells;
|
unsigned int i = 0, h = layout_rect.height / column->ncells;
|
||||||
for(cell = col->cells; cell; cell = cell->next) {
|
for(cell = column->cells; cell; cell = cell->next) {
|
||||||
Frame *f = cell->frame;
|
Frame *f = cell->frame;
|
||||||
f->rect = col->rect;
|
f->rect = column->rect;
|
||||||
f->rect.y = layout_rect.y + i * h;
|
f->rect.y = layout_rect.y + i * h;
|
||||||
if(!cell->next)
|
if(!cell->next)
|
||||||
f->rect.height = layout_rect.height - f->rect.y + layout_rect.y;
|
f->rect.height = layout_rect.height - f->rect.y + layout_rect.y;
|
||||||
@ -102,46 +102,46 @@ arrange_column(Column * col)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
arrange_col(Layout *l)
|
arrange_column(Layout *l)
|
||||||
{
|
{
|
||||||
Acme *acme = l->aux;
|
Acme *acme = l->aux;
|
||||||
Column *col;
|
Column *column;
|
||||||
for(col = acme->columns; col; col = col->next)
|
for(column = acme->columns; column; column = column->next)
|
||||||
arrange_column(col);
|
xarrange_column(column);
|
||||||
XSync(dpy, False);
|
XSync(dpy, False);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
init_col(Layout *l, Client * clients)
|
init_column(Layout *l, Client * clients)
|
||||||
{
|
{
|
||||||
Client *n, *c = clients;
|
Client *n, *c = clients;
|
||||||
|
|
||||||
l->aux = cext_emallocz(sizeof(Acme));
|
l->aux = cext_emallocz(sizeof(Acme));
|
||||||
while(c) {
|
while(c) {
|
||||||
n = c->next;
|
n = c->next;
|
||||||
attach_col(l, c);
|
attach_column(l, c);
|
||||||
c = n;
|
c = n;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
attach_frame(Layout *l, Column * col, Frame * new)
|
attach_frame(Layout *l, Column * column, Frame * new)
|
||||||
{
|
{
|
||||||
Acme *acme = l->aux;
|
Acme *acme = l->aux;
|
||||||
Cell *c, *cell = cext_emallocz(sizeof(Cell));
|
Cell *c, *cell = cext_emallocz(sizeof(Cell));
|
||||||
Frame *f;
|
Frame *f;
|
||||||
|
|
||||||
cell->frame = new;
|
cell->frame = new;
|
||||||
cell->col = col;
|
cell->column = column;
|
||||||
new->aux = cell;
|
new->aux = cell;
|
||||||
for(c = col->cells; c && c->next; c = c->next);
|
for(c = column->cells; c && c->next; c = c->next);
|
||||||
if(!c)
|
if(!c)
|
||||||
col->cells = cell;
|
column->cells = cell;
|
||||||
else {
|
else {
|
||||||
c->next = cell;
|
c->next = cell;
|
||||||
cell->prev = c;
|
cell->prev = c;
|
||||||
}
|
}
|
||||||
col->ncells++;
|
column->ncells++;
|
||||||
|
|
||||||
for(f = acme->frames; f && f->next; f = f->next);
|
for(f = acme->frames; f && f->next; f = f->next);
|
||||||
if(!f)
|
if(!f)
|
||||||
@ -159,20 +159,20 @@ detach_frame(Layout *l, Frame * old)
|
|||||||
{
|
{
|
||||||
Acme *acme = l->aux;
|
Acme *acme = l->aux;
|
||||||
Cell *cell = old->aux;
|
Cell *cell = old->aux;
|
||||||
Column *col = cell->col;
|
Column *column = cell->column;
|
||||||
|
|
||||||
if(cell->prev)
|
if(cell->prev)
|
||||||
cell->prev->next = cell->next;
|
cell->prev->next = cell->next;
|
||||||
else
|
else
|
||||||
col->cells = cell->next;
|
column->cells = cell->next;
|
||||||
if(cell->next)
|
if(cell->next)
|
||||||
cell->next->prev = cell->prev;
|
cell->next->prev = cell->prev;
|
||||||
|
|
||||||
if(col->sel == cell)
|
if(column->sel == cell)
|
||||||
col->sel = col->cells;
|
column->sel = column->cells;
|
||||||
|
|
||||||
free(cell);
|
free(cell);
|
||||||
col->ncells--;
|
column->ncells--;
|
||||||
|
|
||||||
if(old->prev)
|
if(old->prev)
|
||||||
old->prev->next = old->next;
|
old->prev->next = old->next;
|
||||||
@ -187,12 +187,12 @@ detach_frame(Layout *l, Frame * old)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static Client *
|
static Client *
|
||||||
deinit_col(Layout *l)
|
deinit_column(Layout *l)
|
||||||
{
|
{
|
||||||
Acme *acme = l->aux;
|
Acme *acme = l->aux;
|
||||||
Frame *f;
|
Frame *f;
|
||||||
Client *cl, *res = nil, *c = nil;
|
Client *cl, *res = nil, *c = nil;
|
||||||
Column *col = acme->columns;
|
Column *column = acme->columns;
|
||||||
|
|
||||||
while((f = acme->frames)) {
|
while((f = acme->frames)) {
|
||||||
while((cl = f->clients)) {
|
while((cl = f->clients)) {
|
||||||
@ -209,9 +209,9 @@ deinit_col(Layout *l)
|
|||||||
detach_frame(l, f);
|
detach_frame(l, f);
|
||||||
destroy_frame(f);
|
destroy_frame(f);
|
||||||
}
|
}
|
||||||
while((col = acme->columns)) {
|
while((column = acme->columns)) {
|
||||||
acme->columns = col->next;
|
acme->columns = column->next;
|
||||||
free(col);
|
free(column);
|
||||||
}
|
}
|
||||||
free(acme);
|
free(acme);
|
||||||
l->aux = 0;
|
l->aux = 0;
|
||||||
@ -219,26 +219,26 @@ deinit_col(Layout *l)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static Bool
|
static Bool
|
||||||
attach_col(Layout *l, Client * c)
|
attach_column(Layout *l, Client * c)
|
||||||
{
|
{
|
||||||
Acme *acme = l->aux;
|
Acme *acme = l->aux;
|
||||||
Column *col = acme->sel;
|
Column *column = acme->sel;
|
||||||
Frame *f = nil;
|
Frame *f = nil;
|
||||||
|
|
||||||
if(!col) {
|
if(!column) {
|
||||||
col = cext_emallocz(sizeof(Column));
|
column = cext_emallocz(sizeof(Column));
|
||||||
col->rect = layout_rect;
|
column->rect = layout_rect;
|
||||||
acme->columns = acme->sel = col;
|
acme->columns = acme->sel = column;
|
||||||
acme->ncolumns++;
|
acme->ncolumns++;
|
||||||
}
|
}
|
||||||
|
|
||||||
f = alloc_frame(&c->rect);
|
f = alloc_frame(&c->rect);
|
||||||
attach_frame(l, col, f);
|
attach_frame(l, column, f);
|
||||||
attach_client_to_frame(f, c);
|
attach_client_to_frame(f, c);
|
||||||
arrange_column(col);
|
xarrange_column(column);
|
||||||
if(l->page == selpage)
|
if(l->page == selpage)
|
||||||
XMapWindow(dpy, f->win);
|
XMapWindow(dpy, f->win);
|
||||||
focus_col(l, c, True);
|
focus_column(l, c, True);
|
||||||
return True;
|
return True;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -247,28 +247,28 @@ update_column_width(Layout *l)
|
|||||||
{
|
{
|
||||||
Acme *acme = l->aux;
|
Acme *acme = l->aux;
|
||||||
unsigned int i = 0, width;
|
unsigned int i = 0, width;
|
||||||
Column *col;
|
Column *column;
|
||||||
|
|
||||||
if(!acme->ncolumns)
|
if(!acme->ncolumns)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
width = layout_rect.width / acme->ncolumns;
|
width = layout_rect.width / acme->ncolumns;
|
||||||
for(col = acme->columns; col; col = col->next) {
|
for(column = acme->columns; column; column = column->next) {
|
||||||
col->rect = layout_rect;
|
column->rect = layout_rect;
|
||||||
col->rect.x = i * width;
|
column->rect.x = i * width;
|
||||||
col->rect.width = width;
|
column->rect.width = width;
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
arrange_col(l);
|
arrange_column(l);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
detach_col(Layout *l, Client * c, Bool unmap)
|
detach_column(Layout *l, Client * c, Bool unmap)
|
||||||
{
|
{
|
||||||
Acme *acme = l->aux;
|
Acme *acme = l->aux;
|
||||||
Frame *f = c->frame;
|
Frame *f = c->frame;
|
||||||
Cell *cell = f->aux;
|
Cell *old = f->aux;
|
||||||
Column *col = cell->col;
|
Column *column = old->column;
|
||||||
|
|
||||||
detach_client_from_frame(c, unmap);
|
detach_client_from_frame(c, unmap);
|
||||||
if(!f->clients) {
|
if(!f->clients) {
|
||||||
@ -276,34 +276,37 @@ detach_col(Layout *l, Client * c, Bool unmap)
|
|||||||
destroy_frame(f);
|
destroy_frame(f);
|
||||||
} else
|
} else
|
||||||
return;
|
return;
|
||||||
if(col->cells)
|
if(column->cells) {
|
||||||
arrange_column(col);
|
if(column->sel == old)
|
||||||
|
column->sel = column->cells;
|
||||||
|
xarrange_column(column);
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
if(acme->sel == col) {
|
if(acme->sel == column) {
|
||||||
if(col->prev)
|
if(column->prev)
|
||||||
acme->sel = col->prev;
|
acme->sel = column->prev;
|
||||||
else
|
else
|
||||||
acme->sel = nil;
|
acme->sel = nil;
|
||||||
}
|
}
|
||||||
if(col->prev)
|
if(column->prev)
|
||||||
col->prev->next = col->next;
|
column->prev->next = column->next;
|
||||||
else
|
else
|
||||||
acme->columns = col->next;
|
acme->columns = column->next;
|
||||||
if(col->next)
|
if(column->next)
|
||||||
col->next->prev = col->prev;
|
column->next->prev = column->prev;
|
||||||
if(!acme->sel)
|
if(!acme->sel)
|
||||||
acme->sel = acme->columns;
|
acme->sel = acme->columns;
|
||||||
acme->ncolumns--;
|
acme->ncolumns--;
|
||||||
free(col);
|
free(column);
|
||||||
update_column_width(l);
|
update_column_width(l);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
match_frame_horiz(Column * col, XRectangle * r)
|
match_frame_horiz(Column * column, XRectangle * r)
|
||||||
{
|
{
|
||||||
Cell *cell;
|
Cell *cell;
|
||||||
for(cell = col->cells; cell; cell = cell->next) {
|
for(cell = column->cells; cell; cell = cell->next) {
|
||||||
Frame *f = cell->frame;
|
Frame *f = cell->frame;
|
||||||
f->rect.x = r->x;
|
f->rect.x = r->x;
|
||||||
f->rect.width = r->width;
|
f->rect.width = r->width;
|
||||||
@ -314,30 +317,30 @@ match_frame_horiz(Column * col, XRectangle * r)
|
|||||||
static void
|
static void
|
||||||
drop_resize(Frame * f, XRectangle * new)
|
drop_resize(Frame * f, XRectangle * new)
|
||||||
{
|
{
|
||||||
Column *west = nil, *east = nil, *col = nil;
|
Column *west = nil, *east = nil, *column = nil;
|
||||||
Cell *north = nil, *south = nil;
|
Cell *north = nil, *south = nil;
|
||||||
Cell *cell = f->aux;
|
Cell *cell = f->aux;
|
||||||
|
|
||||||
col = cell->col;
|
column = cell->column;
|
||||||
west = col->prev;
|
west = column->prev;
|
||||||
east = col->next;
|
east = column->next;
|
||||||
north = cell->prev;
|
north = cell->prev;
|
||||||
south = cell->next;
|
south = cell->next;
|
||||||
|
|
||||||
/* horizontal resize */
|
/* horizontal resize */
|
||||||
if(west && (new->x != f->rect.x)) {
|
if(west && (new->x != f->rect.x)) {
|
||||||
west->rect.width = new->x - west->rect.x;
|
west->rect.width = new->x - west->rect.x;
|
||||||
col->rect.width += f->rect.x - new->x;
|
column->rect.width += f->rect.x - new->x;
|
||||||
col->rect.x = new->x;
|
column->rect.x = new->x;
|
||||||
match_frame_horiz(west, &west->rect);
|
match_frame_horiz(west, &west->rect);
|
||||||
match_frame_horiz(col, &col->rect);
|
match_frame_horiz(column, &column->rect);
|
||||||
}
|
}
|
||||||
if(east && (new->x + new->width != f->rect.x + f->rect.width)) {
|
if(east && (new->x + new->width != f->rect.x + f->rect.width)) {
|
||||||
east->rect.width -= new->x + new->width - east->rect.x;
|
east->rect.width -= new->x + new->width - east->rect.x;
|
||||||
east->rect.x = new->x + new->width;
|
east->rect.x = new->x + new->width;
|
||||||
col->rect.x = new->x;
|
column->rect.x = new->x;
|
||||||
col->rect.width = new->width;
|
column->rect.width = new->width;
|
||||||
match_frame_horiz(col, &col->rect);
|
match_frame_horiz(column, &column->rect);
|
||||||
match_frame_horiz(east, &east->rect);
|
match_frame_horiz(east, &east->rect);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -365,7 +368,7 @@ drop_moving(Frame * f, XRectangle * new, XPoint * pt)
|
|||||||
{
|
{
|
||||||
Layout *l = f->layout;
|
Layout *l = f->layout;
|
||||||
Cell *cell = f->aux;
|
Cell *cell = f->aux;
|
||||||
Column *src = cell->col, *tgt = 0;
|
Column *src = cell->column, *tgt = 0;
|
||||||
Acme *acme = l->aux;
|
Acme *acme = l->aux;
|
||||||
|
|
||||||
if(!pt)
|
if(!pt)
|
||||||
@ -380,9 +383,9 @@ drop_moving(Frame * f, XRectangle * new, XPoint * pt)
|
|||||||
return;
|
return;
|
||||||
detach_frame(l, f);
|
detach_frame(l, f);
|
||||||
attach_frame(l, tgt, f);
|
attach_frame(l, tgt, f);
|
||||||
arrange_column(src);
|
xarrange_column(src);
|
||||||
arrange_column(tgt);
|
xarrange_column(tgt);
|
||||||
focus_col(l, f->sel, True);
|
focus_column(l, f->sel, True);
|
||||||
} else {
|
} else {
|
||||||
Cell *c;
|
Cell *c;
|
||||||
for(c = src->cells;
|
for(c = src->cells;
|
||||||
@ -392,15 +395,15 @@ drop_moving(Frame * f, XRectangle * new, XPoint * pt)
|
|||||||
Frame *tmp = c->frame;
|
Frame *tmp = c->frame;
|
||||||
c->frame = f;
|
c->frame = f;
|
||||||
cell->frame = tmp;
|
cell->frame = tmp;
|
||||||
arrange_column(src);
|
xarrange_column(src);
|
||||||
focus_col(l, f->sel, True);
|
focus_column(l, f->sel, True);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
resize_col(Frame * f, XRectangle * new, XPoint * pt)
|
resize_column(Frame * f, XRectangle * new, XPoint * pt)
|
||||||
{
|
{
|
||||||
if((f->rect.width == new->width)
|
if((f->rect.width == new->width)
|
||||||
&& (f->rect.height == new->height))
|
&& (f->rect.height == new->height))
|
||||||
@ -410,15 +413,15 @@ resize_col(Frame * f, XRectangle * new, XPoint * pt)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
focus_col(Layout *l, Client *c, Bool raise)
|
focus_column(Layout *l, Client *c, Bool raise)
|
||||||
{
|
{
|
||||||
Acme *acme = l->aux;
|
Acme *acme = l->aux;
|
||||||
Cell *cell = c->frame->aux;
|
Cell *cell = c->frame->aux;
|
||||||
Client *old = sel_client();
|
Client *old = sel_client();
|
||||||
|
|
||||||
c->frame->sel = c;
|
c->frame->sel = c;
|
||||||
acme->sel = cell->col;
|
acme->sel = cell->column;
|
||||||
cell->col->sel = cell;
|
cell->column->sel = cell;
|
||||||
l->file[L_SEL_FRAME]->content = c->frame->file[F_PREFIX]->content;
|
l->file[L_SEL_FRAME]->content = c->frame->file[F_PREFIX]->content;
|
||||||
|
|
||||||
if(raise)
|
if(raise)
|
||||||
@ -429,25 +432,25 @@ focus_col(Layout *l, Client *c, Bool raise)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static Frame *
|
static Frame *
|
||||||
frames_col(Layout *l)
|
frames_column(Layout *l)
|
||||||
{
|
{
|
||||||
Acme *acme = l->aux;
|
Acme *acme = l->aux;
|
||||||
return acme->frames;
|
return acme->frames;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Client *
|
static Client *
|
||||||
sel_col(Layout *l)
|
sel_column(Layout *l)
|
||||||
{
|
{
|
||||||
Acme *acme = l->aux;
|
Acme *acme = l->aux;
|
||||||
Column *col = acme->sel;
|
Column *column = acme->sel;
|
||||||
|
|
||||||
if(col && col->sel)
|
if(column && column->sel)
|
||||||
return col->sel->frame->sel;
|
return column->sel->frame->sel;
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Action *
|
static Action *
|
||||||
actions_col(Layout *l)
|
actions_column(Layout *l)
|
||||||
{
|
{
|
||||||
return lcol_acttbl;
|
return lcol_acttbl;
|
||||||
}
|
}
|
||||||
@ -457,44 +460,44 @@ select_frame(void *obj, char *arg)
|
|||||||
{
|
{
|
||||||
Layout *l = obj;
|
Layout *l = obj;
|
||||||
Acme *acme = l->aux;
|
Acme *acme = l->aux;
|
||||||
Column *c, *col = acme->sel;
|
Column *c, *column = acme->sel;
|
||||||
Cell *cell;
|
Cell *cell;
|
||||||
|
|
||||||
if(!col)
|
if(!column)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
cell = col->sel;
|
cell = column->sel;
|
||||||
if(!cell || !arg)
|
if(!cell || !arg)
|
||||||
return;
|
return;
|
||||||
if(!strncmp(arg, "prev", 5)) {
|
if(!strncmp(arg, "prev", 5)) {
|
||||||
if(cell->prev)
|
if(cell->prev)
|
||||||
cell = cell->prev;
|
cell = cell->prev;
|
||||||
else
|
else
|
||||||
for(cell = col->cells; cell && cell->next; cell = cell->next);
|
for(cell = column->cells; cell && cell->next; cell = cell->next);
|
||||||
} else if(!strncmp(arg, "next", 5)) {
|
} else if(!strncmp(arg, "next", 5)) {
|
||||||
if(cell->next)
|
if(cell->next)
|
||||||
cell = cell->next;
|
cell = cell->next;
|
||||||
else
|
else
|
||||||
cell = col->cells;
|
cell = column->cells;
|
||||||
} else if(!strncmp(arg, "west", 5)) {
|
} else if(!strncmp(arg, "west", 5)) {
|
||||||
if(col->prev)
|
if(column->prev)
|
||||||
cell = col->prev->sel;
|
cell = column->prev->sel;
|
||||||
else {
|
else {
|
||||||
for(c = acme->columns; c && c->next; c = c->next);
|
for(c = acme->columns; c && c->next; c = c->next);
|
||||||
cell = c->sel;
|
cell = c->sel;
|
||||||
}
|
}
|
||||||
} else if(!strncmp(arg, "east", 5)) {
|
} else if(!strncmp(arg, "east", 5)) {
|
||||||
if(col->next)
|
if(column->next)
|
||||||
cell = col->next->sel;
|
cell = column->next->sel;
|
||||||
else
|
else
|
||||||
cell = acme->columns->sel;
|
cell = acme->columns->sel;
|
||||||
} else {
|
} else {
|
||||||
unsigned int i = 0, idx = blitz_strtonum(arg, 0, col->ncells - 1);
|
unsigned int i = 0, idx = blitz_strtonum(arg, 0, column->ncells - 1);
|
||||||
for(cell = col->cells; cell && i != idx; cell = cell->next)
|
for(cell = column->cells; cell && i != idx; cell = cell->next)
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
if(cell && cell != col->sel)
|
if(cell && cell != column->sel)
|
||||||
focus_col(l, cell->frame->sel, True);
|
focus_column(l, cell->frame->sel, True);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -502,16 +505,16 @@ swap_frame(void *obj, char *arg)
|
|||||||
{
|
{
|
||||||
Layout *l = obj;
|
Layout *l = obj;
|
||||||
Acme *acme = l->aux;
|
Acme *acme = l->aux;
|
||||||
Column *west = nil, *east = nil, *col = acme->sel;
|
Column *west = nil, *east = nil, *column = acme->sel;
|
||||||
Cell *north = nil, *south = nil, *cell = col->sel;
|
Cell *north = nil, *south = nil, *cell = column->sel;
|
||||||
Frame *f;
|
Frame *f;
|
||||||
XRectangle r;
|
XRectangle r;
|
||||||
|
|
||||||
if(!col || !cell || !arg)
|
if(!column || !cell || !arg)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
west = col->prev;
|
west = column->prev;
|
||||||
east = col->next;
|
east = column->next;
|
||||||
north = cell->prev;
|
north = cell->prev;
|
||||||
south = cell->next;
|
south = cell->next;
|
||||||
|
|
||||||
@ -531,7 +534,7 @@ swap_frame(void *obj, char *arg)
|
|||||||
north->frame->aux = north;
|
north->frame->aux = north;
|
||||||
resize_frame(cell->frame, &cell->frame->rect, nil);
|
resize_frame(cell->frame, &cell->frame->rect, nil);
|
||||||
resize_frame(north->frame, &north->frame->rect, nil);
|
resize_frame(north->frame, &north->frame->rect, nil);
|
||||||
focus_col(l, cell->frame->sel, True);
|
focus_column(l, cell->frame->sel, True);
|
||||||
} else if(!strncmp(arg, "south", 6) && south) {
|
} else if(!strncmp(arg, "south", 6) && south) {
|
||||||
r = south->frame->rect;
|
r = south->frame->rect;
|
||||||
south->frame->rect = cell->frame->rect;
|
south->frame->rect = cell->frame->rect;
|
||||||
@ -543,8 +546,8 @@ swap_frame(void *obj, char *arg)
|
|||||||
south->frame->aux = south;
|
south->frame->aux = south;
|
||||||
resize_frame(cell->frame, &cell->frame->rect, nil);
|
resize_frame(cell->frame, &cell->frame->rect, nil);
|
||||||
resize_frame(south->frame, &south->frame->rect, nil);
|
resize_frame(south->frame, &south->frame->rect, nil);
|
||||||
focus_col(l, cell->frame->sel, True);
|
focus_column(l, cell->frame->sel, True);
|
||||||
} else if(!strncmp(arg, "west", 5) && west && col->ncells && west->ncells) {
|
} else if(!strncmp(arg, "west", 5) && west && column->ncells && west->ncells) {
|
||||||
Cell *other = west->sel;
|
Cell *other = west->sel;
|
||||||
r = other->frame->rect;
|
r = other->frame->rect;
|
||||||
other->frame->rect = cell->frame->rect;
|
other->frame->rect = cell->frame->rect;
|
||||||
@ -556,8 +559,8 @@ swap_frame(void *obj, char *arg)
|
|||||||
cell->frame->aux = cell;
|
cell->frame->aux = cell;
|
||||||
resize_frame(cell->frame, &cell->frame->rect, nil);
|
resize_frame(cell->frame, &cell->frame->rect, nil);
|
||||||
resize_frame(other->frame, &other->frame->rect, nil);
|
resize_frame(other->frame, &other->frame->rect, nil);
|
||||||
focus_col(l, other->frame->sel, True);
|
focus_column(l, other->frame->sel, True);
|
||||||
} else if(!strncmp(arg, "east", 5) && east && col->ncells && east->ncells) {
|
} else if(!strncmp(arg, "east", 5) && east && column->ncells && east->ncells) {
|
||||||
Cell *other = east->sel;
|
Cell *other = east->sel;
|
||||||
r = other->frame->rect;
|
r = other->frame->rect;
|
||||||
other->frame->rect = cell->frame->rect;
|
other->frame->rect = cell->frame->rect;
|
||||||
@ -569,22 +572,22 @@ swap_frame(void *obj, char *arg)
|
|||||||
cell->frame->aux = cell;
|
cell->frame->aux = cell;
|
||||||
resize_frame(cell->frame, &cell->frame->rect, nil);
|
resize_frame(cell->frame, &cell->frame->rect, nil);
|
||||||
resize_frame(other->frame, &other->frame->rect, nil);
|
resize_frame(other->frame, &other->frame->rect, nil);
|
||||||
focus_col(l, other->frame->sel, True);
|
focus_column(l, other->frame->sel, True);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
new_col(void *obj, char *arg)
|
new_column(void *obj, char *arg)
|
||||||
{
|
{
|
||||||
Layout *l = obj;
|
Layout *l = obj;
|
||||||
Acme *acme = l->aux;
|
Acme *acme = l->aux;
|
||||||
Column *c, *new, *col = acme->sel;
|
Column *c, *new, *column = acme->sel;
|
||||||
Frame *f;
|
Frame *f;
|
||||||
|
|
||||||
if(!col || col->ncells < 2)
|
if(!column || column->ncells < 2)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
f = col->sel->frame;
|
f = column->sel->frame;
|
||||||
for(c = acme->columns; c && c->next; c = c->next);
|
for(c = acme->columns; c && c->next; c = c->next);
|
||||||
|
|
||||||
new = cext_emallocz(sizeof(Column));
|
new = cext_emallocz(sizeof(Column));
|
||||||
@ -598,5 +601,5 @@ new_col(void *obj, char *arg)
|
|||||||
attach_frame(l, new, f);
|
attach_frame(l, new, f);
|
||||||
|
|
||||||
update_column_width(l);
|
update_column_width(l);
|
||||||
focus_col(l, f->sel, True);
|
focus_column(l, f->sel, True);
|
||||||
}
|
}
|
||||||
|
30
cmd/wm/wm.c
30
cmd/wm/wm.c
@ -21,23 +21,23 @@ static int other_wm_running;
|
|||||||
static int (*x_error_handler) (Display *, XErrorEvent *);
|
static int (*x_error_handler) (Display *, XErrorEvent *);
|
||||||
|
|
||||||
static void new_page(void *obj, char *arg);
|
static void new_page(void *obj, char *arg);
|
||||||
static void _select_page(void *obj, char *arg);
|
static void xselect_page(void *obj, char *arg);
|
||||||
static void _destroy_page(void *obj, char *arg);
|
static void xdestroy_page(void *obj, char *arg);
|
||||||
static void quit(void *obj, char *arg);
|
static void quit(void *obj, char *arg);
|
||||||
static void _attach_client(void *obj, char *arg);
|
static void xattach_client(void *obj, char *arg);
|
||||||
static void _detach_client(void *obj, char *arg);
|
static void xdetach_client(void *obj, char *arg);
|
||||||
static void _close_client(void *obj, char *arg);
|
static void xclose_client(void *obj, char *arg);
|
||||||
static void pager(void *obj, char *arg);
|
static void pager(void *obj, char *arg);
|
||||||
static void detached_clients(void *obj, char *arg);
|
static void detached_clients(void *obj, char *arg);
|
||||||
|
|
||||||
/* action table for /ctl namespace */
|
/* action table for /ctl namespace */
|
||||||
Action wm_acttbl[] = {
|
Action wm_acttbl[] = {
|
||||||
{"new", new_page},
|
{"new", new_page},
|
||||||
{"destroy", _destroy_page},
|
{"destroy", xdestroy_page},
|
||||||
{"select", _select_page},
|
{"select", xselect_page},
|
||||||
{"attach", _attach_client},
|
{"attach", xattach_client},
|
||||||
{"detach", _detach_client},
|
{"detach", xdetach_client},
|
||||||
{"close", _close_client},
|
{"close", xclose_client},
|
||||||
{"quit", quit},
|
{"quit", quit},
|
||||||
{"pager", pager},
|
{"pager", pager},
|
||||||
{"detclients", detached_clients},
|
{"detclients", detached_clients},
|
||||||
@ -390,7 +390,7 @@ detached_clients(void *obj, char *arg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_close_client(void *obj, char *arg)
|
xclose_client(void *obj, char *arg)
|
||||||
{
|
{
|
||||||
Client *c = sel_client();
|
Client *c = sel_client();
|
||||||
if(c)
|
if(c)
|
||||||
@ -398,7 +398,7 @@ _close_client(void *obj, char *arg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_attach_client(void *obj, char *arg)
|
xattach_client(void *obj, char *arg)
|
||||||
{
|
{
|
||||||
Client *c = detached;
|
Client *c = detached;
|
||||||
if(c) {
|
if(c) {
|
||||||
@ -408,7 +408,7 @@ _attach_client(void *obj, char *arg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_detach_client(void *obj, char *arg)
|
xdetach_client(void *obj, char *arg)
|
||||||
{
|
{
|
||||||
Client *c = sel_client();
|
Client *c = sel_client();
|
||||||
if(c)
|
if(c)
|
||||||
@ -416,7 +416,7 @@ _detach_client(void *obj, char *arg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_select_page(void *obj, char *arg)
|
xselect_page(void *obj, char *arg)
|
||||||
{
|
{
|
||||||
Page *p = selpage;
|
Page *p = selpage;
|
||||||
if(!p || !arg)
|
if(!p || !arg)
|
||||||
@ -443,7 +443,7 @@ _select_page(void *obj, char *arg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_destroy_page(void *obj, char *arg)
|
xdestroy_page(void *obj, char *arg)
|
||||||
{
|
{
|
||||||
destroy_page(selpage);
|
destroy_page(selpage);
|
||||||
focus_page(selpage);
|
focus_page(selpage);
|
||||||
|
@ -60,7 +60,7 @@ static void draw_bar(void *obj, char *arg);
|
|||||||
static void quit(void *obj, char *arg);
|
static void quit(void *obj, char *arg);
|
||||||
static void display(void *obj, char *arg);
|
static void display(void *obj, char *arg);
|
||||||
static void reset(void *obj, char *arg);
|
static void reset(void *obj, char *arg);
|
||||||
static void _destroy(void *obj, char *arg);
|
static void xdestroy(void *obj, char *arg);
|
||||||
static void handle_after_write(IXPServer * s, File * f);
|
static void handle_after_write(IXPServer * s, File * f);
|
||||||
|
|
||||||
static Action acttbl[] = {
|
static Action acttbl[] = {
|
||||||
@ -68,7 +68,7 @@ static Action acttbl[] = {
|
|||||||
{"display", display},
|
{"display", display},
|
||||||
{"update", draw_bar},
|
{"update", draw_bar},
|
||||||
{"reset", reset},
|
{"reset", reset},
|
||||||
{"destroy", _destroy},
|
{"destroy", xdestroy},
|
||||||
{0, 0}
|
{0, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -120,7 +120,7 @@ create_label(char *path)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_destroy(void *obj, char *arg)
|
xdestroy(void *obj, char *arg)
|
||||||
{
|
{
|
||||||
char buf[512];
|
char buf[512];
|
||||||
if(!arg)
|
if(!arg)
|
||||||
|
Loading…
Reference in New Issue
Block a user