mirror of
https://github.com/0intro/wmii
synced 2024-11-22 05:42:05 +03:00
several changes in column layout to make it compile
This commit is contained in:
parent
1e456a1913
commit
e7cafad888
@ -27,17 +27,14 @@ struct Column {
|
||||
XRectangle rect;
|
||||
};
|
||||
|
||||
static void init_col(Page * p, int argc, char **argv);
|
||||
static void deinit_col(Page * p);
|
||||
static void arrange_col(Page * p);
|
||||
static void attach_col(Page * p, Client * c);
|
||||
static void detach_col(Page *, Client * c, int unmapped, int destroyed);
|
||||
static void resize_col(Frame * f, XRectangle * new, XPoint * pt);
|
||||
static void aux_col(Frame * f, char *what);
|
||||
static void init_col(Area *a);
|
||||
static void deinit_col(Area *a);
|
||||
static void arrange_col(Area *a);
|
||||
static void attach_col(Area *a, Client *c);
|
||||
static void detach_col(Area *a, Client *c, int unmapped, int destroyed);
|
||||
static void resize_col(Frame *f, XRectangle *new, XPoint * pt);
|
||||
|
||||
static LayoutImpl lcol = {"col", init_col, deinit_col, arrange_col, attach_col,
|
||||
detach_col, resize_col, aux_col
|
||||
};
|
||||
static Layout lcol = {"col", init_col, deinit_col, arrange_col, attach_col, detach_col, resize_col};
|
||||
|
||||
static Column zero_column = {0};
|
||||
static Acme zero_acme = {0};
|
||||
@ -52,11 +49,11 @@ init_layout_col()
|
||||
|
||||
|
||||
static void
|
||||
arrange_column(Page * p, Column * col)
|
||||
arrange_column(Area *a, Column *col)
|
||||
{
|
||||
int i;
|
||||
int n = count_items((void **) col->frames);
|
||||
unsigned int height = p->managed_rect.height / n;
|
||||
unsigned int height = a->rect.height / n;
|
||||
for (i = 0; col->frames && col->frames[i]; i++) {
|
||||
if (col->refresh) {
|
||||
col->frames[i]->rect = col->rect;
|
||||
@ -68,9 +65,9 @@ arrange_column(Page * p, Column * col)
|
||||
}
|
||||
|
||||
static void
|
||||
arrange_col(Page * p)
|
||||
arrange_col(Area *a)
|
||||
{
|
||||
Acme *acme = p->aux;
|
||||
Acme *acme = a->aux;
|
||||
int i;
|
||||
|
||||
if (!acme) {
|
||||
@ -78,11 +75,11 @@ arrange_col(Page * p)
|
||||
exit(1);
|
||||
}
|
||||
for (i = 0; acme->column && acme->column[i]; i++)
|
||||
arrange_column(p, acme->column[i]);
|
||||
arrange_column(a, acme->column[i]);
|
||||
}
|
||||
|
||||
static void
|
||||
init_col(Page * p, int argc, char **argv)
|
||||
init_col(Area *a)
|
||||
{
|
||||
Acme *acme = emalloc(sizeof(Acme));
|
||||
int i, j, n, cols = 1;
|
||||
@ -90,9 +87,10 @@ init_col(Page * p, int argc, char **argv)
|
||||
Column *col;
|
||||
|
||||
*acme = zero_acme;
|
||||
p->aux = acme;
|
||||
a->aux = acme;
|
||||
|
||||
/* processing argv */
|
||||
/*
|
||||
for (i = 1; (i < argc) && (argv[i][0] == '-'); i++) {
|
||||
switch (argv[i][1]) {
|
||||
case 'c':
|
||||
@ -102,13 +100,14 @@ init_col(Page * p, int argc, char **argv)
|
||||
break;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
width = p->managed_rect.width / cols;
|
||||
width = a->rect.width / cols;
|
||||
acme->column = emalloc((cols + 1) * sizeof(Column *));
|
||||
for (i = 0; i < cols; i++) {
|
||||
acme->column[i] = emalloc(sizeof(Column));
|
||||
*acme->column[i] = zero_column;
|
||||
acme->column[i]->rect = p->managed_rect;
|
||||
acme->column[i]->rect = a->rect;
|
||||
acme->column[i]->rect.x = i * width;
|
||||
acme->column[i]->rect.width = width;
|
||||
acme->column[i]->refresh = 1;
|
||||
@ -131,7 +130,7 @@ init_col(Page * p, int argc, char **argv)
|
||||
col->frames = (Frame **) attach_item_end((void **) col->frames,
|
||||
alloc_frame(&clients[i]->rect, 1, 1), sizeof(Frame *));
|
||||
col->frames[0]->aux = col;
|
||||
attach_Frameo_page(p, col->frames[0], 1);
|
||||
attach_frame_to_area(a, col->frames[0], 1);
|
||||
attach_Cliento_frame(col->frames[0], clients[j]);
|
||||
j++;
|
||||
}
|
||||
|
112
cmd/wm/page.c
112
cmd/wm/page.c
@ -15,7 +15,6 @@ static Page zero_page = {0};
|
||||
|
||||
static void select_frame(void *obj, char *cmd);
|
||||
static void handle_after_write_page(IXPServer * s, File * f);
|
||||
static void handle_before_read_page(IXPServer * s, File * f);
|
||||
|
||||
/* action table for /page/?/ namespace */
|
||||
Action page_acttbl[] = {
|
||||
@ -108,22 +107,6 @@ rectangles(unsigned int *num)
|
||||
return result;
|
||||
}
|
||||
|
||||
Frame *
|
||||
select_floating(Page * p, Frame * f, char *what)
|
||||
{
|
||||
int idx;
|
||||
if (!strncmp(what, "prev", 5)) {
|
||||
idx = index_prev_item((void **) p->floating, f);
|
||||
if (idx >= 0)
|
||||
return p->floating[idx];
|
||||
} else if (!strncmp(what, "next", 5)) {
|
||||
idx = index_next_item((void **) p->floating, f);
|
||||
if (idx >= 0)
|
||||
return p->floating[idx];
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
center_pointer(Frame * f)
|
||||
{
|
||||
@ -131,19 +114,15 @@ center_pointer(Frame * f)
|
||||
Window dummy;
|
||||
int wex, wey, ex, ey, i;
|
||||
unsigned int dmask;
|
||||
XRectangle *r;
|
||||
|
||||
if (!f)
|
||||
return;
|
||||
r = rect_of_frame(f);
|
||||
XQueryPointer(dpy, f->win, &dummy, &dummy, &i, &i, &wex, &wey, &dmask);
|
||||
XTranslateCoordinates(dpy, f->win, root, wex, wey, &ex, &ey, &dummy);
|
||||
if (blitz_ispointinrect(ex, ey, r))
|
||||
if (blitz_ispointinrect(ex, ey, &f->rect))
|
||||
return;
|
||||
/* suppress EnterNotify's while mouse warping */
|
||||
XSelectInput(dpy, root, ROOT_MASK & ~StructureNotifyMask);
|
||||
XWarpPointer(dpy, None, f->win, 0, 0, 0, 0,
|
||||
r->width / 2, r->height / 2);
|
||||
XWarpPointer(dpy, None, f->win, 0, 0, 0, 0, f->rect.width / 2, f->rect.height / 2);
|
||||
XSync(dpy, False);
|
||||
XSelectInput(dpy, root, ROOT_MASK);
|
||||
|
||||
@ -152,28 +131,24 @@ center_pointer(Frame * f)
|
||||
static void
|
||||
select_frame(void *obj, char *cmd)
|
||||
{
|
||||
Page *p = (Page *) obj;
|
||||
Frame *f, *old, *old2;
|
||||
if (!p || !cmd)
|
||||
int i;
|
||||
Frame *f, *old;
|
||||
f = old = pages ? SELFRAME(pages[sel]) : 0;
|
||||
if(!f || !cmd)
|
||||
return;
|
||||
old2 = old = f = get_selected(p);
|
||||
if (!f)
|
||||
return;
|
||||
if (is_managed_frame(f))
|
||||
old2 = p->managed[0];
|
||||
else if (is_managed_frame(f))
|
||||
f = p->layout->select(f, cmd);
|
||||
else
|
||||
f = select_floating(p, f, cmd);
|
||||
if (!f)
|
||||
return;
|
||||
focus_frame(f, 1, 1, 1);
|
||||
center_pointer(f);
|
||||
if (old)
|
||||
if (!strncmp(cmd, "prev", 5)) {
|
||||
i = index_prev_item((void **) f->area->frames, f);
|
||||
f = f->area->frames[i];
|
||||
} else if (!strncmp(cmd, "next", 5)) {
|
||||
i = index_next_item((void **) f->area->frames, f);
|
||||
f = f->area->frames[i];
|
||||
}
|
||||
if (old != f) {
|
||||
focus_frame(f, 1, 1, 1);
|
||||
center_pointer(f);
|
||||
draw_frame(old);
|
||||
if (old2 != old)
|
||||
draw_frame(old2); /* on zoom */
|
||||
draw_frame(f);
|
||||
draw_frame(f);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
@ -181,45 +156,16 @@ hide_page(Page * p)
|
||||
{
|
||||
|
||||
int i;
|
||||
for (i = 0; p->floating && p->floating[i]; i++)
|
||||
XUnmapWindow(dpy, p->floating[i]->win);
|
||||
for (i = 0; p->managed && p->managed[i]; i++)
|
||||
XUnmapWindow(dpy, p->managed[i]->win);
|
||||
XSync(dpy, False);
|
||||
for (i = 0; p->areas && p->areas[i]; i++)
|
||||
hide_area(p->areas[i]);
|
||||
}
|
||||
|
||||
void
|
||||
show_page(Page * p)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; p->floating && p->floating[i]; i++)
|
||||
XMapWindow(dpy, p->floating[i]->win);
|
||||
for (i = 0; p->managed && p->managed[i]; i++)
|
||||
XMapWindow(dpy, p->managed[i]->win);
|
||||
XSync(dpy, False);
|
||||
}
|
||||
|
||||
static void
|
||||
handle_before_read_page(IXPServer * s, File * f)
|
||||
{
|
||||
int i;
|
||||
XRectangle *rct = 0;
|
||||
for (i = 0; pages && pages[i]; i++) {
|
||||
if (pages[i]->files[P_MANAGED_SIZE] == f) {
|
||||
rct = &pages[i]->managed_rect;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (rct) {
|
||||
char buf[64];
|
||||
snprintf(buf, 64, "%d,%d,%d,%d", rct->x, rct->y,
|
||||
rct->width, rct->height);
|
||||
if (f->content)
|
||||
free(f->content);
|
||||
f->content = estrdup(buf);
|
||||
f->size = strlen(buf);
|
||||
}
|
||||
for (i = 0; p->areas && p->areas[i]; i++)
|
||||
show_area(p->areas[i]);
|
||||
}
|
||||
|
||||
Layout *
|
||||
@ -247,8 +193,10 @@ handle_after_write_page(IXPServer * s, File * f)
|
||||
if (p->files[P_CTL] == f) {
|
||||
run_action(f, p, page_acttbl);
|
||||
return;
|
||||
} else if (p->files[P_MANAGED_SIZE] == f) {
|
||||
/* resize stuff */
|
||||
}
|
||||
/*
|
||||
else if (p->files[P_MANAGED_SIZE] == f) {
|
||||
/ resize stuff /
|
||||
blitz_strtorect(dpy, &rect, &p->managed_rect,
|
||||
p->files[P_MANAGED_SIZE]->content);
|
||||
if (!p->managed_rect.width)
|
||||
@ -285,7 +233,7 @@ handle_after_write_page(IXPServer * s, File * f)
|
||||
}
|
||||
}
|
||||
if (!p->layout) {
|
||||
/* make all managed clients floating */
|
||||
/ make all managed clients floating /
|
||||
int j;
|
||||
Frame **tmp = 0;
|
||||
while (p->managed) {
|
||||
@ -304,11 +252,13 @@ handle_after_write_page(IXPServer * s, File * f)
|
||||
invoke_core_event(core_files[CORE_EVENT_PAGE_UPDATE]);
|
||||
return;
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
void
|
||||
attach_Frameo_page(Page * p, Frame * f, int managed)
|
||||
attach_frame_to_page(Page * p, Frame * f, int managed)
|
||||
{
|
||||
Frame *old = get_selected(p);
|
||||
XSelectInput(dpy, root, ROOT_MASK & ~StructureNotifyMask);
|
||||
@ -386,4 +336,4 @@ detach_frame_from_page(Frame * f, int ignore_focus_and_destroy)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
|
@ -208,12 +208,13 @@ File *defaults[WM_LAST];
|
||||
unsigned int valid_mask, num_lock_mask;
|
||||
|
||||
/* area.c */
|
||||
void focus_frame(Frame * f, int raise, int up, int down);
|
||||
void destroy_area(Area *a);
|
||||
void free_area(Area *a);
|
||||
void attach_frame_to_area(Area *a, Frame * f);
|
||||
void detach_frame_from_area(Frame * f, int ignore_focus_and_destroy);
|
||||
void draw_area(Area *a);
|
||||
void hide_area(Area *a);
|
||||
void show_area(Area *a);
|
||||
|
||||
/* client.c */
|
||||
Client *alloc_client(Window w);
|
||||
@ -248,6 +249,7 @@ void destroy_page(Page * p);
|
||||
void set_client_state(Client * c, int state);
|
||||
|
||||
/* frame.c */
|
||||
void focus_frame(Frame * f, int raise, int up, int down);
|
||||
Frame *win_to_frame(Window w);
|
||||
Frame *alloc_frame(XRectangle * r, int add_frame_border, int floating);
|
||||
void free_frame(Frame * f);
|
||||
|
Loading…
Reference in New Issue
Block a user