mirror of
https://github.com/0intro/wmii
synced 2024-12-22 11:33:23 +03:00
attaching works
This commit is contained in:
parent
a8b11805ad
commit
d1a962ea23
@ -13,36 +13,33 @@
|
||||
|
||||
static Area zero_area = {0};
|
||||
|
||||
Area *alloc_area(Page *p, XRectangle * r)
|
||||
Area *alloc_area(Page *p, XRectangle * r, char *layout)
|
||||
{
|
||||
char buf[MAX_BUF];
|
||||
Area *a = (Area *) emalloc(sizeof(Area));
|
||||
int id = count_items((void **) p->area) + 1;
|
||||
|
||||
*a = zero_area;
|
||||
a->rect = *r;
|
||||
a->page = p;
|
||||
snprintf(buf, MAX_BUF, "/%s/area/%d", p->files[P_PREFIX]->name, count_items((void **) p->area));
|
||||
a->files[A_PREFIX] = ixp_create(ixps, buf);
|
||||
snprintf(buf, MAX_BUF, "/%s/area/%d/frame/sel", p->files[P_PREFIX]->name, count_items((void **) p->area));
|
||||
a->files[A_SEL_FRAME] = ixp_create(ixps, buf);
|
||||
snprintf(buf, MAX_BUF, "/%s/area/%d/ctl", p->files[P_PREFIX]->name, count_items((void **) p->area));
|
||||
a->files[A_CTL] = ixp_create(ixps, buf);
|
||||
snprintf(buf, MAX_BUF, "/%s/area/%d/geometry", p->files[P_PREFIX]->name, count_items((void **) p->area));
|
||||
a->files[A_GEOMETRY] = ixp_create(ixps, buf);
|
||||
snprintf(buf, MAX_BUF, "/%s/area/%d/layout", p->files[P_PREFIX]->name, count_items((void **) p->area));
|
||||
a->files[A_LAYOUT] = ixp_create(ixps, buf);
|
||||
p->area =
|
||||
(Area **) attach_item_end((void **) p->area, a, sizeof(Area *));
|
||||
snprintf(buf, MAX_BUF, "/p/%s/a/%d", p->file[P_PREFIX]->name, id);
|
||||
a->file[A_PREFIX] = ixp_create(ixps, buf);
|
||||
snprintf(buf, MAX_BUF, "/p/%s/a/%d/f", p->file[P_PREFIX]->name, id);
|
||||
a->file[A_FRAME_PREFIX] = ixp_create(ixps, buf);
|
||||
snprintf(buf, MAX_BUF, "/p/%s/a/%d/f/sel", p->file[P_PREFIX]->name, id);
|
||||
a->file[A_SEL_FRAME] = ixp_create(ixps, buf);
|
||||
snprintf(buf, MAX_BUF, "/p/%s/a/%d/ctl", p->file[P_PREFIX]->name, id);
|
||||
a->file[A_CTL] = ixp_create(ixps, buf);
|
||||
snprintf(buf, MAX_BUF, "/p/%s/a/%d/geometry", p->file[P_PREFIX]->name, id);
|
||||
a->file[A_GEOMETRY] = ixp_create(ixps, buf);
|
||||
snprintf(buf, MAX_BUF, "/p/%s/a/%d/layout", p->file[P_PREFIX]->name, id);
|
||||
a->file[A_LAYOUT] = wmii_create_ixpfile(ixps, buf, layout);
|
||||
a->layout = get_layout(layout);
|
||||
p->area = (Area **) attach_item_end((void **) p->area, a, sizeof(Area *));
|
||||
p->sel = index_item((void **) p->area, a);
|
||||
return a;
|
||||
}
|
||||
|
||||
void free_area(Area * a)
|
||||
{
|
||||
ixp_remove_file(ixps, a->files[A_PREFIX]);
|
||||
free(a);
|
||||
}
|
||||
|
||||
void destroy_area(Area * a)
|
||||
{
|
||||
unsigned int i;
|
||||
@ -50,29 +47,34 @@ void destroy_area(Area * a)
|
||||
for (i = 0; a->frame && a->frame[i]; i++);
|
||||
destroy_frame(a->frame[i]);
|
||||
free(a->frame);
|
||||
free_area(a);
|
||||
ixp_remove_file(ixps, a->file[A_PREFIX]);
|
||||
free(a);
|
||||
}
|
||||
|
||||
void focus_area(Area * a, int raise, int up, int down)
|
||||
void sel_area(Area * a, int raise, int up, int down)
|
||||
{
|
||||
Page *p = a->page;
|
||||
if (!p)
|
||||
return;
|
||||
|
||||
if (down && a->frame)
|
||||
focus_frame(a->frame[a->sel], raise, 0, down);
|
||||
sel_frame(a->frame[a->sel], raise, 0, down);
|
||||
p->sel = index_item((void **) p->area, a);
|
||||
p->files[P_SEL_AREA]->content = a->files[A_PREFIX]->content;
|
||||
p->file[P_SEL_AREA]->content = a->file[A_PREFIX]->content;
|
||||
if (up)
|
||||
focus_page(p, raise, 0);
|
||||
sel_page(p, raise, 0);
|
||||
}
|
||||
|
||||
void attach_frame_to_area(Area * a, Frame * f)
|
||||
{
|
||||
|
||||
wmii_move_ixpfile(f->file[F_PREFIX], a->file[A_FRAME_PREFIX]);
|
||||
a->file[A_SEL_FRAME]->content = f->file[F_PREFIX]->content;
|
||||
a->frame = (Frame **) attach_item_end((void **) a->frame, f, sizeof(Frame *));
|
||||
a->sel = index_item((void **) a->frame, f);
|
||||
f->area = a;
|
||||
}
|
||||
|
||||
void detach_frame_from_area(Frame * f, int ignore_focus_and_destroy)
|
||||
void detach_frame_from_area(Frame * f, int ignore_sel_and_destroy)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -19,43 +19,29 @@ Client *alloc_client(Window w)
|
||||
static int id = 0;
|
||||
char buf[MAX_BUF];
|
||||
char buf2[MAX_BUF];
|
||||
XClassHint ch;
|
||||
Client *c = (Client *) emalloc(sizeof(Client));
|
||||
|
||||
*c = zero_client;
|
||||
c->win = w;
|
||||
snprintf(buf, MAX_BUF, "/detached/client/%d", id);
|
||||
c->files[C_PREFIX] = ixp_create(ixps, buf);
|
||||
snprintf(buf, MAX_BUF, "/detached/c/%d", id);
|
||||
c->file[C_PREFIX] = ixp_create(ixps, buf);
|
||||
win_prop(dpy, c->win, XA_WM_NAME, buf2, MAX_BUF);
|
||||
snprintf(buf, MAX_BUF, "/detached/client/%d/name", id);
|
||||
c->files[C_NAME] = wmii_create_ixpfile(ixps, buf, buf2);
|
||||
if (XGetClassHint(dpy, c->win, &ch)) {
|
||||
snprintf(buf, MAX_BUF, "/detached/client/%d/class", id);
|
||||
c->files[C_CLASS] = wmii_create_ixpfile(ixps, buf, ch.res_class);
|
||||
snprintf(buf, MAX_BUF, "/detached/client/%d/instance", id);
|
||||
c->files[C_INSTANCE] = wmii_create_ixpfile(ixps, buf, ch.res_name);
|
||||
} else {
|
||||
snprintf(buf, MAX_BUF, "/detached/client/%d/class", id);
|
||||
c->files[C_CLASS] = ixp_create(ixps, buf);
|
||||
snprintf(buf, MAX_BUF, "/detached/client/%d/instance", id);
|
||||
c->files[C_INSTANCE] = ixp_create(ixps, buf);
|
||||
}
|
||||
snprintf(buf, MAX_BUF, "/detached/c/%d/name", id);
|
||||
c->file[C_NAME] = wmii_create_ixpfile(ixps, buf, buf2);
|
||||
id++;
|
||||
client =
|
||||
(Client **) attach_item_end((void **) client, c,
|
||||
sizeof(Client *));
|
||||
client = (Client **) attach_item_end((void **) client, c, sizeof(Client *));
|
||||
XSelectInput(dpy, c->win, CLIENT_MASK);
|
||||
return c;
|
||||
}
|
||||
|
||||
void focus_client(Client * c, int raise, int up)
|
||||
void sel_client(Client * c, int raise, int up)
|
||||
{
|
||||
Frame *f = 0;
|
||||
/* focus client */
|
||||
/* sel client */
|
||||
if (c) {
|
||||
f = c->frame;
|
||||
for (f->sel = 0; f->client && f->client[f->sel] != c; f->sel++);
|
||||
f->files[F_SEL_CLIENT]->content = c->files[C_PREFIX]->content;
|
||||
f->file[F_SEL_CLIENT]->content = c->file[C_PREFIX]->content;
|
||||
if (raise)
|
||||
XRaiseWindow(dpy, c->win);
|
||||
XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime);
|
||||
@ -63,7 +49,7 @@ void focus_client(Client * c, int raise, int up)
|
||||
XSetInputFocus(dpy, PointerRoot, RevertToPointerRoot, CurrentTime);
|
||||
invoke_wm_event(def[WM_EVENT_CLIENT_UPDATE]);
|
||||
if (up && f)
|
||||
focus_frame(f, raise, up, 0);
|
||||
sel_frame(f, raise, up, 0);
|
||||
}
|
||||
|
||||
void set_client_state(Client * c, int state)
|
||||
@ -163,7 +149,7 @@ void close_client(Client * c)
|
||||
XKillClient(dpy, c->win);
|
||||
}
|
||||
|
||||
void _init_client(Client * c, XWindowAttributes * wa)
|
||||
void init_client(Client * c, XWindowAttributes * wa)
|
||||
{
|
||||
long msize;
|
||||
c->rect.x = wa->x;
|
||||
@ -200,10 +186,10 @@ void handle_client_property(Client * c, XPropertyEvent * e)
|
||||
case XA_WM_NAME:
|
||||
win_prop(dpy, c->win, XA_WM_NAME, buf, sizeof(buf));
|
||||
if (strlen(buf)) {
|
||||
if (c->files[C_NAME]->content)
|
||||
free(c->files[C_NAME]->content);
|
||||
c->files[C_NAME]->content = estrdup(buf);
|
||||
c->files[C_NAME]->size = strlen(buf);
|
||||
if (c->file[C_NAME]->content)
|
||||
free(c->file[C_NAME]->content);
|
||||
c->file[C_NAME]->content = estrdup(buf);
|
||||
c->file[C_NAME]->size = strlen(buf);
|
||||
}
|
||||
if (c->frame)
|
||||
draw_client(c);
|
||||
@ -221,13 +207,12 @@ void handle_client_property(Client * c, XPropertyEvent * e)
|
||||
}
|
||||
}
|
||||
|
||||
void free_client(Client * c)
|
||||
void destroy_client(Client * c)
|
||||
{
|
||||
client =
|
||||
(Client **) detach_item((void **) client, c, sizeof(Client *));
|
||||
ixp_remove_file(ixps, c->files[C_PREFIX]);
|
||||
client = (Client **) detach_item((void **) client, c, sizeof(Client *));
|
||||
ixp_remove_file(ixps, c->file[C_PREFIX]);
|
||||
if (ixps->errstr)
|
||||
fprintf(stderr, "wmiiwm: free_client(): %s\n", ixps->errstr);
|
||||
fprintf(stderr, "wmiiwm: destroy_client(): %s\n", ixps->errstr);
|
||||
free(c);
|
||||
}
|
||||
|
||||
@ -248,11 +233,11 @@ void draw_client(Client * c)
|
||||
for (i = 0; f->client[i] && f->client[i] != c; i++);
|
||||
|
||||
if (!f->client[i + 1])
|
||||
draw_tab(f, c->files[C_NAME]->content, i * tw, 0,
|
||||
draw_tab(f, c->file[C_NAME]->content, i * tw, 0,
|
||||
f->rect.width - (i * tw), tabh, ISSELFRAME(f)
|
||||
&& f->client[f->sel] == c);
|
||||
else
|
||||
draw_tab(f, c->files[C_NAME]->content, i * tw, 0, tw, tabh,
|
||||
draw_tab(f, c->file[C_NAME]->content, i * tw, 0, tw, tabh,
|
||||
ISSELFRAME(f) && f->client[f->sel] == c);
|
||||
}
|
||||
|
||||
@ -269,41 +254,18 @@ void draw_clients(Frame * f)
|
||||
for (i = 0; f->client[i]; i++) {
|
||||
if (!f->client[i + 1]) {
|
||||
int xoff = i * tw;
|
||||
draw_tab(f, f->client[i]->files[C_NAME]->content,
|
||||
draw_tab(f, f->client[i]->file[C_NAME]->content,
|
||||
xoff, 0, f->rect.width - xoff, tabh, ISSELFRAME(f)
|
||||
&& f->client[f->sel] == f->client[i]);
|
||||
break;
|
||||
} else
|
||||
draw_tab(f, f->client[i]->files[C_NAME]->content,
|
||||
draw_tab(f, f->client[i]->file[C_NAME]->content,
|
||||
i * tw, 0, tw, tabh, ISSELFRAME(f)
|
||||
&& f->client[f->sel] == f->client[i]);
|
||||
}
|
||||
XSync(dpy, False);
|
||||
}
|
||||
|
||||
int manage_class_instance(Client * c)
|
||||
{
|
||||
char buf[MAX_BUF];
|
||||
File *f;
|
||||
char *class = (char *) c->files[C_CLASS]->content;
|
||||
char *inst = (char *) c->files[C_INSTANCE]->content;
|
||||
|
||||
if (!c->files[C_CLASS]->content || !c->files[C_INSTANCE]->content)
|
||||
return 1;
|
||||
|
||||
snprintf(buf, sizeof(buf), "/default/client/%s:%s/manage",
|
||||
class ? class : "", inst ? inst : "");
|
||||
f = ixp_walk(ixps, buf);
|
||||
if (!f) {
|
||||
snprintf(buf, sizeof(buf), "/default/client/%s:%s/manage",
|
||||
class ? class : "", "*");
|
||||
f = ixp_walk(ixps, buf);
|
||||
}
|
||||
if (f && f->content)
|
||||
return _strtonum(f->content, 0, 1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
void gravitate(Client * c, unsigned int tabh, unsigned int bw, int invert)
|
||||
{
|
||||
int dx = 0, dy = 0;
|
||||
@ -363,3 +325,20 @@ void gravitate(Client * c, unsigned int tabh, unsigned int bw, int invert)
|
||||
c->rect.x += dx;
|
||||
c->rect.y += dy;
|
||||
}
|
||||
|
||||
void attach_client(Client * c)
|
||||
{
|
||||
Area *a = 0;
|
||||
if (!page)
|
||||
alloc_page();
|
||||
/* transient stuff */
|
||||
a = SELAREA;
|
||||
if (c && c->trans) {
|
||||
Client *t = win_to_client(c->trans);
|
||||
if (t && t->frame)
|
||||
a = t->frame->area;
|
||||
}
|
||||
|
||||
a->layout->attach(a, c);
|
||||
invoke_wm_event(def[WM_EVENT_PAGE_UPDATE]);
|
||||
}
|
||||
|
@ -191,7 +191,7 @@ static void handle_destroynotify(XEvent * e)
|
||||
else if (detached && (index_item((void **) detached, c) >= 0))
|
||||
detached = (Client **) detach_item((void **) detached, c,
|
||||
sizeof(Client *));
|
||||
free_client(c);
|
||||
destroy_client(c);
|
||||
}
|
||||
|
||||
static void handle_expose(XEvent * e)
|
||||
@ -220,7 +220,7 @@ static void handle_maprequest(XEvent * e)
|
||||
if (!c)
|
||||
c = alloc_client(ev->window);
|
||||
if (!c->frame) {
|
||||
_init_client(c, &wa);
|
||||
init_client(c, &wa);
|
||||
attach_client(c);
|
||||
}
|
||||
}
|
||||
@ -232,7 +232,7 @@ static void handle_motionnotify(XEvent * e)
|
||||
if (f) {
|
||||
Frame *old = SELFRAME(page[sel]);
|
||||
if (old != f) {
|
||||
focus_frame(f, 0, 0, 1);
|
||||
sel_frame(f, 0, 0, 1);
|
||||
draw_frame(old);
|
||||
draw_frame(f);
|
||||
} else if (f->client) {
|
||||
@ -273,10 +273,10 @@ static void handle_unmapnotify(XEvent * e)
|
||||
detach_client_from_frame(c, 1, 0);
|
||||
if (page)
|
||||
draw_page(page[sel]);
|
||||
free_client(c);
|
||||
destroy_client(c);
|
||||
} else if (detached) {
|
||||
if (index_item((void **) detached, c) == -1)
|
||||
free_client(c);
|
||||
destroy_client(c);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -289,7 +289,7 @@ static void handle_enternotify(XEvent * e)
|
||||
if (ev->mode != NotifyNormal)
|
||||
return;
|
||||
|
||||
/* mouse is not in the focus window */
|
||||
/* mouse is not in the sel window */
|
||||
if (ev->detail == NotifyInferior)
|
||||
return;
|
||||
|
||||
@ -298,7 +298,7 @@ static void handle_enternotify(XEvent * e)
|
||||
Frame *old = SELFRAME(page[sel]);
|
||||
XUndefineCursor(dpy, c->frame->win);
|
||||
if (old != c->frame) {
|
||||
focus_frame(c->frame, 0, 0, 1);
|
||||
sel_frame(c->frame, 0, 0, 1);
|
||||
draw_frame(old);
|
||||
draw_frame(c->frame);
|
||||
} else {
|
||||
|
256
cmd/wm/frame.c
256
cmd/wm/frame.c
@ -25,62 +25,63 @@ Action frame_acttbl[] = {
|
||||
{0, 0}
|
||||
};
|
||||
|
||||
Frame *alloc_frame(XRectangle * r, int add_frame_border, int floating)
|
||||
Frame *alloc_frame(XRectangle * r)
|
||||
{
|
||||
XSetWindowAttributes wa;
|
||||
static int id = 0;
|
||||
char buf[MAX_BUF];
|
||||
Frame *f = (Frame *) emalloc(sizeof(Frame));
|
||||
int bw, th;
|
||||
|
||||
*f = zero_frame;
|
||||
f->rect = *r;
|
||||
f->cursor = normal_cursor;
|
||||
|
||||
snprintf(buf, MAX_BUF, "/detached/frame/%d", id);
|
||||
f->files[F_PREFIX] = ixp_create(ixps, buf);
|
||||
snprintf(buf, MAX_BUF, "/detached/frame/%d/client", id);
|
||||
f->files[F_CLIENT_PREFIX] = ixp_create(ixps, buf);
|
||||
snprintf(buf, MAX_BUF, "/detached/frame/%d/client/sel", id);
|
||||
f->files[F_SEL_CLIENT] = ixp_create(ixps, buf);
|
||||
f->files[F_SEL_CLIENT]->bind = 1;
|
||||
snprintf(buf, MAX_BUF, "/detached/frame/%d/ctl", id);
|
||||
f->files[F_CTL] = ixp_create(ixps, buf);
|
||||
f->files[F_CTL]->after_write = handle_after_write_frame;
|
||||
snprintf(buf, MAX_BUF, "/detached/frame/%d/size", id);
|
||||
f->files[F_SIZE] = ixp_create(ixps, buf);
|
||||
f->files[F_SIZE]->before_read = handle_before_read_frame;
|
||||
f->files[F_SIZE]->after_write = handle_after_write_frame;
|
||||
snprintf(buf, MAX_BUF, "/detached/frame/%d/border", id);
|
||||
f->files[F_BORDER] = wmii_create_ixpfile(ixps, buf, def[WM_BORDER]->content);
|
||||
f->files[F_BORDER]->after_write = handle_after_write_frame;
|
||||
snprintf(buf, MAX_BUF, "/detached/frame/%d/tab", id);
|
||||
f->files[F_TAB] = wmii_create_ixpfile(ixps, buf, def[WM_TAB]->content);
|
||||
f->files[F_TAB]->after_write = handle_after_write_frame;
|
||||
snprintf(buf, MAX_BUF, "/detached/frame/%d/handleinc", id);
|
||||
f->files[F_HANDLE_INC] = wmii_create_ixpfile(ixps, buf, def[WM_HANDLE_INC]->content);
|
||||
f->files[F_HANDLE_INC]->after_write = handle_after_write_frame;
|
||||
snprintf(buf, MAX_BUF, "/detached/frame/%d/locked", id);
|
||||
f->files[F_LOCKED] = wmii_create_ixpfile(ixps, buf, def[WM_LOCKED]->content);
|
||||
snprintf(buf, MAX_BUF, "/detached/frame/%d/selstyle/bgcolor", id);
|
||||
f->files[F_SEL_BG_COLOR] = wmii_create_ixpfile(ixps, buf, def[WM_SEL_BG_COLOR]->content);
|
||||
snprintf(buf, MAX_BUF, "/detached/frame/%d/selstyle/fgcolor", id);
|
||||
f->files[F_SEL_FG_COLOR] = wmii_create_ixpfile(ixps, buf, def[WM_SEL_FG_COLOR]->content);
|
||||
snprintf(buf, MAX_BUF, "/detached/frame/%d/selstyle/bordercolor", id);
|
||||
f->files[F_SEL_BORDER_COLOR] = wmii_create_ixpfile(ixps, buf, def[WM_SEL_BORDER_COLOR]->content);
|
||||
snprintf(buf, MAX_BUF, "/detached/frame/%d/normstyle/bgcolor", id);
|
||||
f->files[F_NORM_BG_COLOR] = wmii_create_ixpfile(ixps, buf, def[WM_NORM_BG_COLOR]->content);
|
||||
snprintf(buf, MAX_BUF, "/detached/frame/%d/normstyle/fgcolor", id);
|
||||
f->files[F_NORM_FG_COLOR] = wmii_create_ixpfile(ixps, buf, def[WM_NORM_FG_COLOR]->content);
|
||||
snprintf(buf, MAX_BUF, "/detached/frame/%d/normstyle/bordercolor", id);
|
||||
f->files[F_NORM_BORDER_COLOR] = wmii_create_ixpfile(ixps, buf, def[WM_NORM_BORDER_COLOR]->content);
|
||||
snprintf(buf, MAX_BUF, "/detached/frame/%d/event/b2press", id);
|
||||
f->files[F_EVENT_B2PRESS] = wmii_create_ixpfile(ixps, buf, def[WM_EVENT_B2PRESS]->content);
|
||||
snprintf(buf, MAX_BUF, "/detached/frame/%d/event/b3press", id);
|
||||
f->files[F_EVENT_B3PRESS] = wmii_create_ixpfile(ixps, buf, def[WM_EVENT_B3PRESS]->content);
|
||||
snprintf(buf, MAX_BUF, "/detached/frame/%d/event/b4press", id);
|
||||
f->files[F_EVENT_B4PRESS] = wmii_create_ixpfile(ixps, buf, def[WM_EVENT_B4PRESS]->content);
|
||||
snprintf(buf, MAX_BUF, "/detached/frame/%d/event/b5press", id);
|
||||
f->files[F_EVENT_B5PRESS] = wmii_create_ixpfile(ixps, buf, def[WM_EVENT_B5PRESS]->content);
|
||||
snprintf(buf, MAX_BUF, "/detached/f/%d", id);
|
||||
f->file[F_PREFIX] = ixp_create(ixps, buf);
|
||||
snprintf(buf, MAX_BUF, "/detached/f/%d/c", id);
|
||||
f->file[F_CLIENT_PREFIX] = ixp_create(ixps, buf);
|
||||
snprintf(buf, MAX_BUF, "/detached/f/%d/c/sel", id);
|
||||
f->file[F_SEL_CLIENT] = ixp_create(ixps, buf);
|
||||
f->file[F_SEL_CLIENT]->bind = 1;
|
||||
snprintf(buf, MAX_BUF, "/detached/f/%d/ctl", id);
|
||||
f->file[F_CTL] = ixp_create(ixps, buf);
|
||||
f->file[F_CTL]->after_write = handle_after_write_frame;
|
||||
snprintf(buf, MAX_BUF, "/detached/f/%d/size", id);
|
||||
f->file[F_SIZE] = ixp_create(ixps, buf);
|
||||
f->file[F_SIZE]->before_read = handle_before_read_frame;
|
||||
f->file[F_SIZE]->after_write = handle_after_write_frame;
|
||||
snprintf(buf, MAX_BUF, "/detached/f/%d/border", id);
|
||||
f->file[F_BORDER] = wmii_create_ixpfile(ixps, buf, def[WM_BORDER]->content);
|
||||
f->file[F_BORDER]->after_write = handle_after_write_frame;
|
||||
snprintf(buf, MAX_BUF, "/detached/f/%d/tab", id);
|
||||
f->file[F_TAB] = wmii_create_ixpfile(ixps, buf, def[WM_TAB]->content);
|
||||
f->file[F_TAB]->after_write = handle_after_write_frame;
|
||||
snprintf(buf, MAX_BUF, "/detached/f/%d/handleinc", id);
|
||||
f->file[F_HANDLE_INC] = wmii_create_ixpfile(ixps, buf, def[WM_HANDLE_INC]->content);
|
||||
f->file[F_HANDLE_INC]->after_write = handle_after_write_frame;
|
||||
snprintf(buf, MAX_BUF, "/detached/f/%d/locked", id);
|
||||
f->file[F_LOCKED] = wmii_create_ixpfile(ixps, buf, def[WM_LOCKED]->content);
|
||||
snprintf(buf, MAX_BUF, "/detached/f/%d/sstyle/bgcolor", id);
|
||||
f->file[F_SEL_BG_COLOR] = wmii_create_ixpfile(ixps, buf, def[WM_SEL_BG_COLOR]->content);
|
||||
snprintf(buf, MAX_BUF, "/detached/f/%d/sstyle/fgcolor", id);
|
||||
f->file[F_SEL_FG_COLOR] = wmii_create_ixpfile(ixps, buf, def[WM_SEL_FG_COLOR]->content);
|
||||
snprintf(buf, MAX_BUF, "/detached/f/%d/sstyle/bordercolor", id);
|
||||
f->file[F_SEL_BORDER_COLOR] = wmii_create_ixpfile(ixps, buf, def[WM_SEL_BORDER_COLOR]->content);
|
||||
snprintf(buf, MAX_BUF, "/detached/f/%d/nstyle/bgcolor", id);
|
||||
f->file[F_NORM_BG_COLOR] = wmii_create_ixpfile(ixps, buf, def[WM_NORM_BG_COLOR]->content);
|
||||
snprintf(buf, MAX_BUF, "/detached/f/%d/nstyle/fgcolor", id);
|
||||
f->file[F_NORM_FG_COLOR] = wmii_create_ixpfile(ixps, buf, def[WM_NORM_FG_COLOR]->content);
|
||||
snprintf(buf, MAX_BUF, "/detached/f/%d/nstyle/bordercolor", id);
|
||||
f->file[F_NORM_BORDER_COLOR] = wmii_create_ixpfile(ixps, buf, def[WM_NORM_BORDER_COLOR]->content);
|
||||
snprintf(buf, MAX_BUF, "/detached/f/%d/event/b2press", id);
|
||||
f->file[F_EVENT_B2PRESS] = wmii_create_ixpfile(ixps, buf, def[WM_EVENT_B2PRESS]->content);
|
||||
snprintf(buf, MAX_BUF, "/detached/f/%d/event/b3press", id);
|
||||
f->file[F_EVENT_B3PRESS] = wmii_create_ixpfile(ixps, buf, def[WM_EVENT_B3PRESS]->content);
|
||||
snprintf(buf, MAX_BUF, "/detached/f/%d/event/b4press", id);
|
||||
f->file[F_EVENT_B4PRESS] = wmii_create_ixpfile(ixps, buf, def[WM_EVENT_B4PRESS]->content);
|
||||
snprintf(buf, MAX_BUF, "/detached/f/%d/event/b5press", id);
|
||||
f->file[F_EVENT_B5PRESS] = wmii_create_ixpfile(ixps, buf, def[WM_EVENT_B5PRESS]->content);
|
||||
id++;
|
||||
|
||||
wa.override_redirect = 1;
|
||||
@ -89,38 +90,32 @@ Frame *alloc_frame(XRectangle * r, int add_frame_border, int floating)
|
||||
| PointerMotionMask | SubstructureRedirectMask
|
||||
| SubstructureNotifyMask;
|
||||
|
||||
if (add_frame_border) {
|
||||
int bw = border_width(f);
|
||||
int th = tab_height(f);
|
||||
f->rect.width += 2 * bw;
|
||||
f->rect.height += bw + (th ? th : bw);
|
||||
}
|
||||
f->win =
|
||||
XCreateWindow(dpy, root, f->rect.x, f->rect.y, f->rect.width,
|
||||
f->rect.height, 0, DefaultDepth(dpy, screen_num),
|
||||
CopyFromParent, DefaultVisual(dpy, screen_num),
|
||||
CWOverrideRedirect | CWBackPixmap | CWEventMask,
|
||||
&wa);
|
||||
|
||||
bw = border_width(f);
|
||||
th = tab_height(f);
|
||||
f->rect.width += 2 * bw;
|
||||
f->rect.height += bw + (th ? th : bw);
|
||||
f->win = XCreateWindow(dpy, root, f->rect.x, f->rect.y, f->rect.width,
|
||||
f->rect.height, 0, DefaultDepth(dpy, screen_num),
|
||||
CopyFromParent, DefaultVisual(dpy, screen_num),
|
||||
CWOverrideRedirect | CWBackPixmap | CWEventMask, &wa);
|
||||
XDefineCursor(dpy, f->win, f->cursor);
|
||||
f->gc = XCreateGC(dpy, f->win, 0, 0);
|
||||
XSync(dpy, False);
|
||||
frame =
|
||||
(Frame **) attach_item_end((void **) frame, f, sizeof(Frame *));
|
||||
frame = (Frame **) attach_item_end((void **) frame, f, sizeof(Frame *));
|
||||
return f;
|
||||
}
|
||||
|
||||
void focus_frame(Frame * f, int raise, int up, int down)
|
||||
void sel_frame(Frame * f, int raise, int up, int down)
|
||||
{
|
||||
Area *a = f->area;
|
||||
if (down && f->client)
|
||||
focus_client(f->client[f->sel], raise, 0);
|
||||
sel_client(f->client[f->sel], raise, 0);
|
||||
a->sel = index_item((void **) a->frame, f);
|
||||
a->files[A_SEL_FRAME]->content = f->files[F_PREFIX]->content;
|
||||
a->file[A_SEL_FRAME]->content = f->file[F_PREFIX]->content;
|
||||
if (raise && a->page->sel == 0) /* only floating windows are raised */
|
||||
XRaiseWindow(dpy, f->win);
|
||||
if (up)
|
||||
focus_area(a, raise, up, 0);
|
||||
sel_area(a, raise, up, 0);
|
||||
}
|
||||
|
||||
Frame *win_to_frame(Window w)
|
||||
@ -138,7 +133,7 @@ void destroy_frame(Frame * f)
|
||||
frame = (Frame **) detach_item((void **) frame, f, sizeof(Frame *));
|
||||
XFreeGC(dpy, f->gc);
|
||||
XDestroyWindow(dpy, f->win);
|
||||
ixp_remove_file(ixps, f->files[F_PREFIX]);
|
||||
ixp_remove_file(ixps, f->file[F_PREFIX]);
|
||||
if (ixps->errstr)
|
||||
fprintf(stderr, "wmiiwm: destroy_frame(): %s\n", ixps->errstr);
|
||||
free(f);
|
||||
@ -146,14 +141,14 @@ void destroy_frame(Frame * f)
|
||||
|
||||
unsigned int tab_height(Frame * f)
|
||||
{
|
||||
if (_strtonum(f->files[F_TAB]->content, 0, 1))
|
||||
if (_strtonum(f->file[F_TAB]->content, 0, 1))
|
||||
return font->ascent + font->descent + 4;
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned int border_width(Frame * f)
|
||||
{
|
||||
if (_strtonum(f->files[F_BORDER]->content, 0, 1))
|
||||
if (_strtonum(f->file[F_BORDER]->content, 0, 1))
|
||||
return BORDER_WIDTH;
|
||||
return 0;
|
||||
}
|
||||
@ -242,8 +237,8 @@ resize_frame(Frame * f, XRectangle * r, XPoint * pt, int ignore_layout)
|
||||
/* resize if client requests special size */
|
||||
check_dimensions(f, tabh, bw);
|
||||
|
||||
if (f->files[F_HANDLE_INC]->content
|
||||
&& ((char *) f->files[F_HANDLE_INC]->content)[0] == '1')
|
||||
if (f->file[F_HANDLE_INC]->content
|
||||
&& ((char *) f->file[F_HANDLE_INC]->content)[0] == '1')
|
||||
resize_incremental(f, tabh, bw);
|
||||
|
||||
XMoveResizeWindow(dpy, f->win, f->rect.x, f->rect.y, f->rect.width,
|
||||
@ -262,37 +257,23 @@ void draw_tab(Frame * f, char *text, int x, int y, int w, int h, int sel)
|
||||
d.rect.width = w;
|
||||
d.rect.height = h;
|
||||
d.data = text;
|
||||
d.font = font;
|
||||
if (sel) {
|
||||
d.bg =
|
||||
blitz_loadcolor(dpy, screen_num,
|
||||
f->files[F_SEL_BG_COLOR]->content);
|
||||
d.fg =
|
||||
blitz_loadcolor(dpy, screen_num,
|
||||
f->files[F_SEL_FG_COLOR]->content);
|
||||
d.border =
|
||||
blitz_loadcolor(dpy, screen_num,
|
||||
f->files[F_SEL_BORDER_COLOR]->content);
|
||||
d.font = font;
|
||||
d.bg = blitz_loadcolor(dpy, screen_num, f->file[F_SEL_BG_COLOR]->content);
|
||||
d.fg = blitz_loadcolor(dpy, screen_num, f->file[F_SEL_FG_COLOR]->content);
|
||||
d.border = blitz_loadcolor(dpy, screen_num, f->file[F_SEL_BORDER_COLOR]->content);
|
||||
} else {
|
||||
d.bg =
|
||||
blitz_loadcolor(dpy, screen_num,
|
||||
f->files[F_NORM_BG_COLOR]->content);
|
||||
d.fg =
|
||||
blitz_loadcolor(dpy, screen_num,
|
||||
f->files[F_NORM_FG_COLOR]->content);
|
||||
d.border =
|
||||
blitz_loadcolor(dpy, screen_num,
|
||||
f->files[F_NORM_BORDER_COLOR]->content);
|
||||
d.font = font;
|
||||
d.bg = blitz_loadcolor(dpy, screen_num, f->file[F_NORM_BG_COLOR]->content);
|
||||
d.fg = blitz_loadcolor(dpy, screen_num, f->file[F_NORM_FG_COLOR]->content);
|
||||
d.border = blitz_loadcolor(dpy, screen_num, f->file[F_NORM_BORDER_COLOR]->content);
|
||||
}
|
||||
blitz_drawlabel(dpy, &d);
|
||||
XSync(dpy, False);
|
||||
XFreeFont(dpy, font);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Assumes following files:
|
||||
* Assumes following file:
|
||||
*
|
||||
* ./sel-style/text-font "<value>"
|
||||
* ./sel-style/text-size "<int>"
|
||||
@ -316,17 +297,18 @@ void draw_frame(Frame * f)
|
||||
notch.width = f->rect.width - 2 * bw;
|
||||
notch.height = f->rect.height - 2 * bw;
|
||||
d.drawable = f->win;
|
||||
d.font = font;
|
||||
d.gc = f->gc;
|
||||
|
||||
/* define ground plate (i = 0) */
|
||||
if (ISSELFRAME(f)) {
|
||||
d.bg = blitz_loadcolor(dpy, screen_num, f->files[F_SEL_BG_COLOR]->content);
|
||||
d.fg = blitz_loadcolor(dpy, screen_num, f->files[F_SEL_FG_COLOR]->content);
|
||||
d.border = blitz_loadcolor(dpy, screen_num, f->files[F_SEL_BORDER_COLOR]->content);
|
||||
d.bg = blitz_loadcolor(dpy, screen_num, f->file[F_SEL_BG_COLOR]->content);
|
||||
d.fg = blitz_loadcolor(dpy, screen_num, f->file[F_SEL_FG_COLOR]->content);
|
||||
d.border = blitz_loadcolor(dpy, screen_num, f->file[F_SEL_BORDER_COLOR]->content);
|
||||
} else {
|
||||
d.bg = blitz_loadcolor(dpy, screen_num, f->files[F_NORM_BG_COLOR]->content);
|
||||
d.fg = blitz_loadcolor(dpy, screen_num, f->files[F_NORM_FG_COLOR]->content);
|
||||
d.border = blitz_loadcolor(dpy, screen_num, f->files[F_NORM_BORDER_COLOR]->content);
|
||||
d.bg = blitz_loadcolor(dpy, screen_num, f->file[F_NORM_BG_COLOR]->content);
|
||||
d.fg = blitz_loadcolor(dpy, screen_num, f->file[F_NORM_FG_COLOR]->content);
|
||||
d.border = blitz_loadcolor(dpy, screen_num, f->file[F_NORM_BORDER_COLOR]->content);
|
||||
}
|
||||
d.rect = f->rect;
|
||||
d.rect.x = d.rect.y = 0;
|
||||
@ -346,7 +328,7 @@ void handle_frame_buttonpress(XButtonEvent * e, Frame * f)
|
||||
if (!f->area->page->sel)
|
||||
XRaiseWindow(dpy, f->win);
|
||||
if (cindex != f->sel) {
|
||||
focus_client(f->client[cindex], 1, 0);
|
||||
sel_client(f->client[cindex], 1, 0);
|
||||
draw_frame(f);
|
||||
return;
|
||||
}
|
||||
@ -356,68 +338,28 @@ void handle_frame_buttonpress(XButtonEvent * e, Frame * f)
|
||||
}
|
||||
bindex = F_EVENT_B2PRESS - 2 + e->button;
|
||||
/* frame mouse handling */
|
||||
if (f->files[bindex]->content)
|
||||
spawn(dpy, f->files[bindex]->content);
|
||||
if (f->file[bindex]->content)
|
||||
spawn(dpy, f->file[bindex]->content);
|
||||
draw_frame(f);
|
||||
}
|
||||
|
||||
void attach_client_to_frame(Frame * f, Client * c)
|
||||
{
|
||||
int size = count_items((void **) f->client);
|
||||
wmii_move_ixpfile(c->files[C_PREFIX], f->files[F_CLIENT_PREFIX]);
|
||||
f->files[F_SEL_CLIENT]->content = c->files[C_PREFIX]->content;
|
||||
f->client =
|
||||
(Client **) attach_item_end((void **) f->client, c,
|
||||
sizeof(Client *));
|
||||
f->sel = size;
|
||||
wmii_move_ixpfile(c->file[C_PREFIX], f->file[F_CLIENT_PREFIX]);
|
||||
f->file[F_SEL_CLIENT]->content = c->file[C_PREFIX]->content;
|
||||
f->client = (Client **) attach_item_end((void **) f->client, c, sizeof(Client *));
|
||||
f->sel = index_item((void **) f->client, c);
|
||||
c->frame = f;
|
||||
reparent_client(c, f->win, border_width(f), tab_height(f));
|
||||
resize_frame(f, &f->rect, 0, 1);
|
||||
show_client(c);
|
||||
focus_client(c, 1, 1);
|
||||
}
|
||||
|
||||
void attach_client(Client * c)
|
||||
{
|
||||
Page *p = 0;
|
||||
Frame *f = 0;
|
||||
if (!page)
|
||||
alloc_page("0");
|
||||
/* transient stuff */
|
||||
if (c && c->trans && !f) {
|
||||
Client *t = win_to_client(c->trans);
|
||||
if (t && t->frame) {
|
||||
focus_client(t, 1, 1);
|
||||
f = alloc_frame(&c->rect, 1, 1);
|
||||
}
|
||||
}
|
||||
p = page[sel];
|
||||
|
||||
if (!f) {
|
||||
/* check if we shall manage it */
|
||||
if (!manage_class_instance(c))
|
||||
f = alloc_frame(&c->rect, 1, 1);
|
||||
}
|
||||
if (!f) {
|
||||
/* check for tabbing? */
|
||||
f = SELFRAME(p);
|
||||
if (f && (((char *) f->files[F_LOCKED]->content)[0] == '1'))
|
||||
f = 0;
|
||||
}
|
||||
if (!f)
|
||||
f = alloc_frame(&c->rect, 1, 0);
|
||||
|
||||
if (!f->area)
|
||||
attach_frame_to_area(p->area[p->sel], f);
|
||||
attach_client_to_frame(f, c);
|
||||
draw_frame(f);
|
||||
invoke_wm_event(def[WM_EVENT_PAGE_UPDATE]);
|
||||
sel_client(c, 1, 1);
|
||||
}
|
||||
|
||||
void detach_client_from_frame(Client * c, int unmapped, int destroyed)
|
||||
{
|
||||
Frame *f = c->frame;
|
||||
wmii_move_ixpfile(c->files[C_PREFIX], def[WM_DETACHED_CLIENT]);
|
||||
wmii_move_ixpfile(c->file[C_PREFIX], def[WM_DETACHED_CLIENT]);
|
||||
c->frame = 0;
|
||||
f->client =
|
||||
(Client **) detach_item((void **) f->client, c, sizeof(Client *));
|
||||
@ -435,13 +377,13 @@ void detach_client_from_frame(Client * c, int unmapped, int destroyed)
|
||||
reparent_client(c, root, border_width(f), tab_height(f));
|
||||
}
|
||||
if (f->client) {
|
||||
focus_client(f->client[f->sel], 1, 1);
|
||||
sel_client(f->client[f->sel], 1, 1);
|
||||
draw_frame(f);
|
||||
} else {
|
||||
detach_frame_from_area(f, 0);
|
||||
destroy_frame(f);
|
||||
if (page)
|
||||
focus_page(page[sel], 0, 1);
|
||||
sel_page(page[sel], 0, 1);
|
||||
}
|
||||
invoke_wm_event(def[WM_EVENT_PAGE_UPDATE]);
|
||||
}
|
||||
@ -479,7 +421,7 @@ static void select_client(void *obj, char *cmd)
|
||||
else
|
||||
f->sel++;
|
||||
}
|
||||
focus_client(f->client[f->sel], 1, 0);
|
||||
sel_client(f->client[f->sel], 1, 0);
|
||||
draw_frame(f);
|
||||
}
|
||||
|
||||
@ -488,7 +430,7 @@ static void handle_before_read_frame(IXPServer * s, File * f)
|
||||
int i = 0;
|
||||
|
||||
for (i = 0; frame && frame[i]; i++) {
|
||||
if (f == frame[i]->files[F_SIZE]) {
|
||||
if (f == frame[i]->file[F_SIZE]) {
|
||||
char buf[64];
|
||||
snprintf(buf, 64, "%d,%d,%d,%d", frame[i]->rect.x,
|
||||
frame[i]->rect.y, frame[i]->rect.width,
|
||||
@ -507,20 +449,20 @@ static void handle_after_write_frame(IXPServer * s, File * f)
|
||||
int i;
|
||||
|
||||
for (i = 0; frame && frame[i]; i++) {
|
||||
if (f == frame[i]->files[F_CTL]) {
|
||||
if (f == frame[i]->file[F_CTL]) {
|
||||
run_action(f, frame[i], frame_acttbl);
|
||||
return;
|
||||
}
|
||||
if (f == frame[i]->files[F_TAB]
|
||||
|| f == frame[i]->files[F_BORDER]
|
||||
|| f == frame[i]->files[F_HANDLE_INC]) {
|
||||
if (f == frame[i]->file[F_TAB]
|
||||
|| f == frame[i]->file[F_BORDER]
|
||||
|| f == frame[i]->file[F_HANDLE_INC]) {
|
||||
if (frame[i]->area) {
|
||||
frame[i]->area->layout->arrange(frame[i]->area);
|
||||
draw_page(frame[i]->area->page);
|
||||
}
|
||||
return;
|
||||
} else if (f == frame[i]->files[F_SIZE]) {
|
||||
char *size = frame[i]->files[F_SIZE]->content;
|
||||
} else if (f == frame[i]->file[F_SIZE]) {
|
||||
char *size = frame[i]->file[F_SIZE]->content;
|
||||
if (size && strrchr(size, ',')) {
|
||||
XRectangle frect;
|
||||
blitz_strtorect(&rect, &frect, size);
|
||||
|
@ -121,7 +121,7 @@ static void init_col(Area * a)
|
||||
j = 0;
|
||||
for (i = 0; i < (cols - 1); i++) {
|
||||
col = acme->column[i];
|
||||
col->frame = (Frame **) attach_item_end((void **) col->frame, alloc_frame(&client[i]->rect, 1, 1), sizeof(Frame *));
|
||||
col->frame = (Frame **) attach_item_end((void **) col->frame, alloc_frame(&client[i]->rect), sizeof(Frame *));
|
||||
col->frame[0]->aux = col;
|
||||
attach_frame_to_area(a, col->frame[0]);
|
||||
attach_client_to_frame(col->frame[0], client[j]);
|
||||
@ -130,7 +130,7 @@ static void init_col(Area * a)
|
||||
col = acme->column[cols - 1];
|
||||
col->frame = emalloc((n - j + 1) * sizeof(Frame *));
|
||||
for (i = 0; i + j < n; i++) {
|
||||
col->frame[i] = alloc_frame(&client[j + i]->rect, 1, 1);
|
||||
col->frame[i] = alloc_frame(&client[j + i]->rect);
|
||||
col->frame[i]->aux = col;
|
||||
attach_frame_to_area(a, col->frame[i]);
|
||||
attach_client_to_frame(col->frame[i], client[j + i]);
|
||||
@ -141,7 +141,7 @@ static void init_col(Area * a)
|
||||
j = 0;
|
||||
for (i = cols - 1; j < n; i--) {
|
||||
col = acme->column[i];
|
||||
col->frame = (Frame **) attach_item_end((void **) col->frame, alloc_frame(&client[i]->rect, 1, 1), sizeof(Frame *));
|
||||
col->frame = (Frame **) attach_item_end((void **) col->frame, alloc_frame(&client[i]->rect), sizeof(Frame *));
|
||||
col->frame[0]->aux = col;
|
||||
attach_frame_to_area(a, col->frame[0]);
|
||||
attach_client_to_frame(col->frame[0], client[j]);
|
||||
@ -180,7 +180,7 @@ static void attach_col(Area * a, Client * c)
|
||||
Frame *f;
|
||||
|
||||
col = acme->column[acme->sel];
|
||||
f = alloc_frame(&c->rect, 1, 1);
|
||||
f = alloc_frame(&c->rect);
|
||||
col->frame = (Frame **) attach_item_end((void **) col->frame, f, sizeof(Frame *));
|
||||
f->aux = col;
|
||||
col->refresh = 1;
|
||||
|
@ -41,6 +41,18 @@ static void deinit_float(Area * a)
|
||||
|
||||
static void attach_float(Area * a, Client * c)
|
||||
{
|
||||
Frame *f = a->frame ? a->frame[a->sel] : 0;
|
||||
/* check for tabbing? */
|
||||
if (f && (((char *) f->file[F_LOCKED]->content)[0] == '1'))
|
||||
f = 0;
|
||||
if (!f) {
|
||||
f = alloc_frame(&c->rect);
|
||||
attach_frame_to_area(a, f);
|
||||
}
|
||||
attach_client_to_frame(f, c);
|
||||
if (a->page == page[sel])
|
||||
XMapRaised(dpy, f->win);
|
||||
draw_frame(f);
|
||||
}
|
||||
|
||||
static void detach_float(Area * a, Client * c, int unmapped, int destroyed)
|
||||
|
100
cmd/wm/page.c
100
cmd/wm/page.c
@ -22,29 +22,27 @@ Action page_acttbl[] = {
|
||||
{0, 0}
|
||||
};
|
||||
|
||||
Page *alloc_page(char *autodestroy)
|
||||
Page *alloc_page()
|
||||
{
|
||||
Page *p = emalloc(sizeof(Page));
|
||||
char buf[MAX_BUF];
|
||||
int id = count_items((void **) page) + 1;
|
||||
|
||||
*p = zero_page;
|
||||
snprintf(buf, sizeof(buf), "/page/%d", id);
|
||||
p->files[P_PREFIX] = ixp_create(ixps, buf);
|
||||
snprintf(buf, sizeof(buf), "/page/%d/area", id);
|
||||
p->files[P_AREA_PREFIX] = ixp_create(ixps, buf);
|
||||
snprintf(buf, sizeof(buf), "/page/%d/area/sel", id);
|
||||
p->files[P_SEL_AREA] = ixp_create(ixps, buf);
|
||||
p->files[P_SEL_AREA]->bind = 1; /* mount point */
|
||||
snprintf(buf, sizeof(buf), "/page/%d/ctl", id);
|
||||
p->files[P_CTL] = ixp_create(ixps, buf);
|
||||
p->files[P_CTL]->after_write = handle_after_write_page;
|
||||
snprintf(buf, sizeof(buf), "/page/%d/auto-destroy", id);
|
||||
p->files[P_AUTO_DESTROY] = wmii_create_ixpfile(ixps, buf, autodestroy);
|
||||
snprintf(buf, sizeof(buf), "/p/%d", id);
|
||||
p->file[P_PREFIX] = ixp_create(ixps, buf);
|
||||
snprintf(buf, sizeof(buf), "/p/%d/a", id);
|
||||
p->file[P_AREA_PREFIX] = ixp_create(ixps, buf);
|
||||
snprintf(buf, sizeof(buf), "/p/%d/a/sel", id);
|
||||
p->file[P_SEL_AREA] = ixp_create(ixps, buf);
|
||||
p->file[P_SEL_AREA]->bind = 1; /* mount point */
|
||||
snprintf(buf, sizeof(buf), "/p/%d/ctl", id);
|
||||
p->file[P_CTL] = ixp_create(ixps, buf);
|
||||
p->file[P_CTL]->after_write = handle_after_write_page;
|
||||
alloc_area(p, &rect, "float");
|
||||
page = (Page **) attach_item_end((void **) page, p, sizeof(Page *));
|
||||
sel = index_item((void **) page, p);
|
||||
def[WM_SEL_PAGE]->content = p->files[P_PREFIX]->content;
|
||||
invoke_wm_event(def[WM_EVENT_PAGE_UPDATE]);
|
||||
def[WM_SEL_PAGE]->content = p->file[P_PREFIX]->content;
|
||||
return p;
|
||||
}
|
||||
|
||||
@ -56,8 +54,8 @@ void destroy_page(Page * p)
|
||||
free_page(p);
|
||||
if (page) {
|
||||
show_page(page[sel]);
|
||||
def[WM_SEL_PAGE]->content = page[sel]->files[P_PREFIX]->content;
|
||||
focus_page(page[sel], 0, 1);
|
||||
def[WM_SEL_PAGE]->content = page[sel]->file[P_PREFIX]->content;
|
||||
sel_page(page[sel], 0, 1);
|
||||
invoke_wm_event(def[WM_EVENT_PAGE_UPDATE]);
|
||||
}
|
||||
}
|
||||
@ -72,13 +70,13 @@ void free_page(Page * p)
|
||||
sel = 0;
|
||||
}
|
||||
def[WM_SEL_PAGE]->content = 0;
|
||||
ixp_remove_file(ixps, p->files[P_PREFIX]);
|
||||
ixp_remove_file(ixps, p->file[P_PREFIX]);
|
||||
if (ixps->errstr)
|
||||
fprintf(stderr, "wmiiwm: free_page(): %s\n", ixps->errstr);
|
||||
free(p);
|
||||
}
|
||||
|
||||
void focus_page(Page * p, int raise, int down)
|
||||
void sel_page(Page * p, int raise, int down)
|
||||
{
|
||||
if (!page)
|
||||
return;
|
||||
@ -86,11 +84,11 @@ void focus_page(Page * p, int raise, int down)
|
||||
hide_page(page[sel]);
|
||||
sel = index_item((void **) page, p);
|
||||
show_page(page[sel]);
|
||||
def[WM_SEL_PAGE]->content = p->files[P_PREFIX]->content;
|
||||
invoke_wm_event(def[WM_EVENT_PAGE_UPDATE]);
|
||||
def[WM_SEL_PAGE]->content = p->file[P_PREFIX]->content;
|
||||
}
|
||||
invoke_wm_event(def[WM_EVENT_PAGE_UPDATE]);
|
||||
if (down)
|
||||
focus_area(p->area[p->sel], raise, 0, down);
|
||||
sel_area(p->area[p->sel], raise, 0, down);
|
||||
}
|
||||
|
||||
void draw_page(Page * p)
|
||||
@ -168,7 +166,7 @@ static void select_frame(void *obj, char *cmd)
|
||||
f = f->area->frame[i];
|
||||
}
|
||||
if (old != f) {
|
||||
focus_frame(f, 1, 1, 1);
|
||||
sel_frame(f, 1, 1, 1);
|
||||
center_pointer(f);
|
||||
draw_frame(old);
|
||||
draw_frame(f);
|
||||
@ -190,35 +188,21 @@ void show_page(Page * p)
|
||||
show_area(p->area[i]);
|
||||
}
|
||||
|
||||
Layout *get_layout(char *name)
|
||||
{
|
||||
int i = 0;
|
||||
size_t len;
|
||||
if (!name)
|
||||
return 0;
|
||||
len = strlen(name);
|
||||
for (i = 0; layouts[i]; i++) {
|
||||
if (!strncmp(name, layouts[i]->name, len))
|
||||
return layouts[i];
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void handle_after_write_page(IXPServer * s, File * f)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; page && page[i]; i++) {
|
||||
Page *p = page[i];
|
||||
if (p->files[P_CTL] == f) {
|
||||
if (p->file[P_CTL] == f) {
|
||||
run_action(f, p, page_acttbl);
|
||||
return;
|
||||
}
|
||||
/*
|
||||
else if (p->files[P_MANAGED_SIZE] == f) {
|
||||
else if (p->file[P_MANAGED_SIZE] == f) {
|
||||
/ resize stuff /
|
||||
blitz_strtorect(dpy, &rect, &p->managed_rect,
|
||||
p->files[P_MANAGED_SIZE]->content);
|
||||
p->file[P_MANAGED_SIZE]->content);
|
||||
if (!p->managed_rect.width)
|
||||
p->managed_rect.width = 10;
|
||||
if (!p->managed_rect.height)
|
||||
@ -227,11 +211,11 @@ static void handle_after_write_page(IXPServer * s, File * f)
|
||||
p->layout->arrange(p);
|
||||
draw_page(p);
|
||||
return;
|
||||
} else if (p->files[P_MANAGED_LAYOUT] == f) {
|
||||
} else if (p->file[P_MANAGED_LAYOUT] == f) {
|
||||
int had_valid_layout = p->layout ? 1 : 0;
|
||||
if (p->layout)
|
||||
p->layout->deinit(p);
|
||||
p->layout = get_layout(p->files[P_MANAGED_LAYOUT]->content);
|
||||
p->layout = get_layout(p->file[P_MANAGED_LAYOUT]->content);
|
||||
if (p->layout) {
|
||||
p->layout->init(p);
|
||||
p->layout->arrange(p);
|
||||
@ -269,7 +253,7 @@ static void handle_after_write_page(IXPServer * s, File * f)
|
||||
free(tmp);
|
||||
}
|
||||
draw_page(p);
|
||||
invoke_wm_event(wm_files[CORE_EVENT_PAGE_UPDATE]);
|
||||
invoke_wm_event(wm_file[CORE_EVENT_PAGE_UPDATE]);
|
||||
return;
|
||||
}
|
||||
*/
|
||||
@ -290,9 +274,9 @@ attach_frame_to_page(Page * p, Frame * f, int managed)
|
||||
p->managed_stack =
|
||||
(Frame **) attach_item_begin((void **) p->managed_stack, f,
|
||||
sizeof(Frame *));
|
||||
wmii_move_ixpfile(f->files[F_PREFIX], p->files[P_MANAGED_PREFIX]);
|
||||
p->files[P_MANAGED_SELECTED]->content =
|
||||
f->files[F_PREFIX]->content;
|
||||
wmii_move_ixpfile(f->file[F_PREFIX], p->file[P_MANAGED_PREFIX]);
|
||||
p->file[P_MANAGED_SELECTED]->content =
|
||||
f->file[F_PREFIX]->content;
|
||||
if (p == page[sel_page])
|
||||
for (i = 0; p->floating && p->floating[i]; i++)
|
||||
XRaiseWindow(dpy, p->floating[i]->win);
|
||||
@ -302,13 +286,13 @@ attach_frame_to_page(Page * p, Frame * f, int managed)
|
||||
p->floating_stack =
|
||||
(Frame **) attach_item_begin((void **) p->floating_stack, f,
|
||||
sizeof(Frame *));
|
||||
wmii_move_ixpfile(f->files[F_PREFIX], p->files[P_FLOATING_PREFIX]);
|
||||
p->files[P_FLOATING_SELECTED]->content =
|
||||
f->files[F_PREFIX]->content;
|
||||
p->files[P_MODE]->content = p->files[P_FLOATING_PREFIX]->content;
|
||||
wmii_move_ixpfile(f->file[F_PREFIX], p->file[P_FLOATING_PREFIX]);
|
||||
p->file[P_FLOATING_SELECTED]->content =
|
||||
f->file[F_PREFIX]->content;
|
||||
p->file[P_MODE]->content = p->file[P_FLOATING_PREFIX]->content;
|
||||
}
|
||||
f->page = p;
|
||||
focus_frame(f, 1, 0, 1);
|
||||
sel_frame(f, 1, 0, 1);
|
||||
if (is_managed_frame(f) && p->layout)
|
||||
p->layout->manage(f);
|
||||
center_pointer(f);
|
||||
@ -318,37 +302,37 @@ attach_frame_to_page(Page * p, Frame * f, int managed)
|
||||
}
|
||||
|
||||
void
|
||||
detach_frame_from_page(Frame * f, int ignore_focus_and_destroy)
|
||||
detach_frame_from_page(Frame * f, int ignore_sel_and_destroy)
|
||||
{
|
||||
Page *p = f->page;
|
||||
wmii_move_ixpfile(f->files[F_PREFIX], wm_files[CORE_DETACHED_FRAME]);
|
||||
wmii_move_ixpfile(f->file[F_PREFIX], wm_file[CORE_DETACHED_FRAME]);
|
||||
if (is_managed_frame(f)) {
|
||||
p->managed = (Frame **) detach_item((void **) p->managed, f,
|
||||
sizeof(Frame *));
|
||||
p->managed_stack =
|
||||
(Frame **) detach_item((void **) p->managed_stack, f,
|
||||
sizeof(Frame *));
|
||||
p->files[P_MANAGED_SELECTED]->content = 0;
|
||||
p->file[P_MANAGED_SELECTED]->content = 0;
|
||||
} else {
|
||||
p->floating = (Frame **) detach_item((void **) p->floating, f,
|
||||
sizeof(Frame *));
|
||||
p->floating_stack =
|
||||
(Frame **) detach_item((void **) p->floating_stack, f,
|
||||
sizeof(Frame *));
|
||||
p->files[P_FLOATING_SELECTED]->content = 0;
|
||||
p->file[P_FLOATING_SELECTED]->content = 0;
|
||||
}
|
||||
XUnmapWindow(dpy, f->win);
|
||||
if (is_managed_mode(p) && p->layout)
|
||||
p->layout->unmanage(f);
|
||||
f->page = 0;
|
||||
if (!ignore_focus_and_destroy) {
|
||||
if (!ignore_sel_and_destroy) {
|
||||
Frame *fr;
|
||||
if (!p->managed && !p->floating
|
||||
&& _strtonum(p->files[P_AUTO_DESTROY]->content, 0, 1)) {
|
||||
&& _strtonum(p->file[P_AUTO_DESTROY]->content, 0, 1)) {
|
||||
destroy_page(p);
|
||||
return;
|
||||
}
|
||||
focus_page(p, 0, 1);
|
||||
sel_page(p, 0, 1);
|
||||
fr = get_selected(p);
|
||||
if (fr) {
|
||||
center_pointer(fr);
|
||||
|
61
cmd/wm/wm.c
61
cmd/wm/wm.c
@ -119,12 +119,10 @@ static void draw_pager_page(Page * p, Draw * d)
|
||||
d->bg = blitz_loadcolor(dpy, screen_num, def[WM_SEL_BG_COLOR]->content);
|
||||
d->fg = blitz_loadcolor(dpy, screen_num, def[WM_SEL_FG_COLOR]->content);
|
||||
d->border = blitz_loadcolor(dpy, screen_num, def[WM_SEL_BORDER_COLOR]->content);
|
||||
d->font = font;
|
||||
} else {
|
||||
d->bg = blitz_loadcolor(dpy, screen_num, def[WM_NORM_BG_COLOR]->content);
|
||||
d->fg = blitz_loadcolor(dpy, screen_num, def[WM_NORM_FG_COLOR]->content);
|
||||
d->border = blitz_loadcolor(dpy, screen_num, def[WM_NORM_BORDER_COLOR]->content);
|
||||
d->font = font;
|
||||
}
|
||||
snprintf(name, sizeof(name), "%d", index_item((void **) page, p));
|
||||
d->data = name;
|
||||
@ -137,14 +135,12 @@ static void draw_pager_page(Page * p, Draw * d)
|
||||
d->bg = blitz_loadcolor(dpy, screen_num, def[WM_SEL_BG_COLOR]->content);
|
||||
d->fg = blitz_loadcolor(dpy, screen_num, def[WM_SEL_FG_COLOR]->content);
|
||||
d->border = blitz_loadcolor(dpy, screen_num, def[WM_SEL_BORDER_COLOR]->content);
|
||||
d->font = font;
|
||||
} else {
|
||||
d->bg = blitz_loadcolor(dpy, screen_num, def[WM_NORM_BG_COLOR]->content);
|
||||
d->fg = blitz_loadcolor(dpy, screen_num, def[WM_NORM_FG_COLOR]->content);
|
||||
d->border = blitz_loadcolor(dpy, screen_num, def[WM_NORM_BORDER_COLOR]->content);
|
||||
d->font = font;
|
||||
}
|
||||
d->data = p->area[i]->frame[j]->client[p->area[i]->frame[j]->sel]->files[C_NAME]->content;
|
||||
d->data = p->area[i]->frame[j]->client[p->area[i]->frame[j]->sel]->file[C_NAME]->content;
|
||||
scale_rect(&rect, &r, &p->area[i]->rect, &d->rect);
|
||||
blitz_drawlabel(dpy, d);
|
||||
XSync(dpy, False); /* do not clear upwards */
|
||||
@ -165,6 +161,7 @@ static void draw_pager()
|
||||
th = ((double) tw / rect.width) * rect.height;
|
||||
d.drawable = transient;
|
||||
d.gc = transient_gc;
|
||||
d.font = font;
|
||||
for (ir = 0; ir < rows; ir++) {
|
||||
for (ic = 0; ic < cols; ic++) {
|
||||
d.rect.x = ic * tw + (ic * GAP);
|
||||
@ -257,7 +254,7 @@ static void pager(void *obj, char *cmd)
|
||||
XUnmapWindow(dpy, transient);
|
||||
if ((i = handle_kpress(&ev.xkey)) != -1)
|
||||
if (i < count_items((void **) page))
|
||||
focus_page(page[i], 0, 1);
|
||||
sel_page(page[i], 0, 1);
|
||||
XUngrabKeyboard(dpy, CurrentTime);
|
||||
return;
|
||||
break;
|
||||
@ -266,7 +263,7 @@ static void pager(void *obj, char *cmd)
|
||||
if (ev.xbutton.button == Button1) {
|
||||
Page *p = xy_to_pager_page(ev.xbutton.x, ev.xbutton.y);
|
||||
if (p)
|
||||
focus_page(p, 0, 1);
|
||||
sel_page(p, 0, 1);
|
||||
}
|
||||
return;
|
||||
break;
|
||||
@ -342,9 +339,7 @@ static void icons(void *obj, char *cmd)
|
||||
hide_client(detached[i]);
|
||||
if (n - 1 < i) {
|
||||
c = detached[n];
|
||||
detached =
|
||||
(Client **) detach_item((void **) detached, c,
|
||||
sizeof(Client *));
|
||||
detached = (Client **) detach_item((void **) detached, c, sizeof(Client *));
|
||||
attach_client(c);
|
||||
}
|
||||
} else {
|
||||
@ -360,9 +355,7 @@ static void icons(void *obj, char *cmd)
|
||||
for (i = 0; detached && detached[i]; i++)
|
||||
hide_client(detached[i]);
|
||||
if ((c = win_to_client(ev.xbutton.window))) {
|
||||
detached =
|
||||
(Client **) detach_item((void **) detached, c,
|
||||
sizeof(Client *));
|
||||
detached = (Client **) detach_item((void **) detached, c, sizeof(Client *));
|
||||
attach_client(c);
|
||||
}
|
||||
XUngrabKeyboard(dpy, CurrentTime);
|
||||
@ -384,9 +377,7 @@ static void _attach_client(void *obj, char *cmd)
|
||||
{
|
||||
if (detached) {
|
||||
Client *c = detached[0];
|
||||
detached =
|
||||
(Client **) detach_item((void **) detached, c,
|
||||
sizeof(Client *));
|
||||
detached = (Client **) detach_item((void **) detached, c, sizeof(Client *));
|
||||
attach_client(c);
|
||||
}
|
||||
}
|
||||
@ -412,7 +403,7 @@ static void _select_page(void *obj, char *cmd)
|
||||
sel = index_next_item((void **) page, page[sel]);
|
||||
else
|
||||
sel = _strtonum(cmd, 0, count_items((void **) page));
|
||||
focus_page(page[sel], 0, 1);
|
||||
sel_page(page[sel], 0, 1);
|
||||
}
|
||||
|
||||
static void _destroy_page(void *obj, char *cmd)
|
||||
@ -457,7 +448,7 @@ void scan_wins()
|
||||
continue;
|
||||
if (wa.map_state == IsViewable) {
|
||||
c = alloc_client(wins[i]);
|
||||
_init_client(c, &wa);
|
||||
init_client(c, &wa);
|
||||
attach_client(c);
|
||||
}
|
||||
}
|
||||
@ -532,9 +523,28 @@ void handle_after_write(IXPServer * s, File * f)
|
||||
&xorcolor, &xorcolor);
|
||||
XSetForeground(dpy, xorgc, xorcolor.pixel);
|
||||
}
|
||||
else if (f == def[WM_FONT]) {
|
||||
XFreeFont(dpy, font);
|
||||
font = blitz_getfont(dpy, def[WM_FONT]->content);
|
||||
}
|
||||
|
||||
check_event(0);
|
||||
}
|
||||
|
||||
Layout *get_layout(char *name)
|
||||
{
|
||||
int i = 0;
|
||||
size_t len;
|
||||
if (!name)
|
||||
return 0;
|
||||
len = strlen(name);
|
||||
for (i = 0; layouts[i]; i++) {
|
||||
if (!strncmp(name, layouts[i]->name, len))
|
||||
return layouts[i];
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void init_atoms()
|
||||
{
|
||||
wm_state = XInternAtom(dpy, "WM_STATE", False);
|
||||
@ -563,8 +573,8 @@ static void init_cursors()
|
||||
|
||||
static void init_default()
|
||||
{
|
||||
def[WM_DETACHED_FRAME] = ixp_create(ixps, "/detached/frame");
|
||||
def[WM_DETACHED_CLIENT] = ixp_create(ixps, "/detached/client");
|
||||
def[WM_DETACHED_FRAME] = ixp_create(ixps, "/detached/f");
|
||||
def[WM_DETACHED_CLIENT] = ixp_create(ixps, "/detached/c");
|
||||
def[WM_TRANS_COLOR] = wmii_create_ixpfile(ixps, "/default/transcolor", BLITZ_SEL_FG_COLOR);
|
||||
def[WM_TRANS_COLOR]->after_write = handle_after_write;
|
||||
def[WM_SEL_BG_COLOR] = wmii_create_ixpfile(ixps, "/default/selstyle/bgcolor", BLITZ_SEL_BG_COLOR);
|
||||
@ -582,7 +592,7 @@ static void init_default()
|
||||
def[WM_HANDLE_INC] = wmii_create_ixpfile(ixps, "/default/handleinc", "1");
|
||||
def[WM_LOCKED] = wmii_create_ixpfile(ixps, "/default/locked", "1");
|
||||
def[WM_LAYOUT] = wmii_create_ixpfile(ixps, "/default/layout", LAYOUT);
|
||||
def[WM_SEL_PAGE] = ixp_create(ixps, "/page/sel");
|
||||
def[WM_SEL_PAGE] = ixp_create(ixps, "/p/sel");
|
||||
def[WM_EVENT_PAGE_UPDATE] = ixp_create(ixps, "/default/event/pageupdate");
|
||||
def[WM_EVENT_CLIENT_UPDATE] = ixp_create(ixps, "/default/event/clientupdate");
|
||||
def[WM_EVENT_B1PRESS] = ixp_create(ixps, "/default/event/b1press");
|
||||
@ -617,12 +627,9 @@ static void init_screen()
|
||||
wa.background_pixmap = ParentRelative;
|
||||
wa.event_mask = ExposureMask | ButtonPressMask | PointerMotionMask
|
||||
| SubstructureRedirectMask | SubstructureNotifyMask;
|
||||
transient = XCreateWindow(dpy, root, 0, 0, rect.width, rect.height,
|
||||
0, DefaultDepth(dpy, screen_num),
|
||||
CopyFromParent, DefaultVisual(dpy,
|
||||
screen_num),
|
||||
CWOverrideRedirect | CWBackPixmap |
|
||||
CWEventMask, &wa);
|
||||
transient = XCreateWindow(dpy, root, 0, 0, rect.width, rect.height, 0, DefaultDepth(dpy, screen_num),
|
||||
CopyFromParent, DefaultVisual(dpy, screen_num),
|
||||
CWOverrideRedirect | CWBackPixmap | CWEventMask, &wa);
|
||||
|
||||
XSync(dpy, False);
|
||||
transient_gc = XCreateGC(dpy, transient, 0, 0);
|
||||
|
39
cmd/wm/wm.h
39
cmd/wm/wm.h
@ -15,13 +15,13 @@ enum {
|
||||
P_AREA_PREFIX,
|
||||
P_SEL_AREA,
|
||||
P_CTL,
|
||||
P_AUTO_DESTROY,
|
||||
P_LAST
|
||||
};
|
||||
|
||||
/* array indexes of area file pointers */
|
||||
enum {
|
||||
A_PREFIX,
|
||||
A_FRAME_PREFIX,
|
||||
A_SEL_FRAME,
|
||||
A_CTL,
|
||||
A_GEOMETRY,
|
||||
@ -57,8 +57,6 @@ enum {
|
||||
enum {
|
||||
C_PREFIX,
|
||||
C_NAME,
|
||||
C_CLASS,
|
||||
C_INSTANCE,
|
||||
C_LAST
|
||||
};
|
||||
|
||||
@ -115,7 +113,7 @@ typedef struct Client Client;
|
||||
struct Page {
|
||||
Area **area;
|
||||
unsigned int sel;
|
||||
File *files[P_LAST];
|
||||
File *file[P_LAST];
|
||||
};
|
||||
|
||||
struct Layout {
|
||||
@ -135,7 +133,7 @@ struct Area {
|
||||
unsigned int sel;
|
||||
XRectangle rect;
|
||||
void *aux; /* free pointer */
|
||||
File *files[A_LAST];
|
||||
File *file[A_LAST];
|
||||
};
|
||||
|
||||
struct Frame {
|
||||
@ -147,7 +145,7 @@ struct Frame {
|
||||
Client **client;
|
||||
int sel;
|
||||
void *aux; /* free pointer */
|
||||
File *files[F_LAST];
|
||||
File *file[F_LAST];
|
||||
};
|
||||
|
||||
struct Client {
|
||||
@ -158,9 +156,10 @@ struct Client {
|
||||
XRectangle rect;
|
||||
XSizeHints size;
|
||||
Frame *frame;
|
||||
File *files[C_LAST];
|
||||
File *file[C_LAST];
|
||||
};
|
||||
|
||||
#define SELAREA (page ? page[sel]->area[page[sel]->sel] : 0)
|
||||
#define SELFRAME(x) (x && x->area[x->sel]->frame ? x->area[x->sel]->frame[x->area[x->sel]->sel] : 0)
|
||||
#define ISSELFRAME(x) (page && SELFRAME(page[sel]) == x)
|
||||
|
||||
@ -208,43 +207,41 @@ File *def[WM_LAST];
|
||||
unsigned int valid_mask, num_lock_mask;
|
||||
|
||||
/* area.c */
|
||||
Area *alloc_area(Page *p, XRectangle * r);
|
||||
Area *alloc_area(Page *p, XRectangle * r, char *layout);
|
||||
void destroy_area(Area * a);
|
||||
void free_area(Area * a);
|
||||
void focus_area(Area * a, int raise, int up, int down);
|
||||
void sel_area(Area * a, int raise, int up, int down);
|
||||
void attach_frame_to_area(Area * a, Frame * f);
|
||||
void detach_frame_from_area(Frame * f, int ignore_focus_and_destroy);
|
||||
void detach_frame_from_area(Frame * f, int ignore_sel_and_destroy);
|
||||
void draw_area(Area * a);
|
||||
void hide_area(Area * a);
|
||||
void show_area(Area * a);
|
||||
|
||||
/* client.c */
|
||||
Client *alloc_client(Window w);
|
||||
void _init_client(Client * c, XWindowAttributes * wa);
|
||||
void free_client(Client * c);
|
||||
void init_client(Client * c, XWindowAttributes * wa);
|
||||
void destroy_client(Client * c);
|
||||
void configure_client(Client * c);
|
||||
void handle_client_property(Client * c, XPropertyEvent * e);
|
||||
void close_client(Client * c);
|
||||
void draw_client(Client * c);
|
||||
void draw_clients(Frame * f);
|
||||
void gravitate(Client * c, unsigned int tabh, unsigned int bw, int invert);
|
||||
int manage_class_instance(Client * c);
|
||||
void grab_client(Client * c, unsigned long mod, unsigned int button);
|
||||
void ungrab_client(Client * c, unsigned long mod, unsigned int button);
|
||||
void hide_client(Client * c);
|
||||
void show_client(Client * c);
|
||||
void reparent_client(Client * c, Window w, int x, int y);
|
||||
void focus_client(Client * c, int raise, int up);
|
||||
void sel_client(Client * c, int raise, int up);
|
||||
void attach_client(Client * c);
|
||||
|
||||
/* frame.c */
|
||||
void focus_frame(Frame * f, int raise, int up, int down);
|
||||
void sel_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);
|
||||
Frame *alloc_frame(XRectangle * r);
|
||||
void destroy_frame(Frame * f);
|
||||
void resize_frame(Frame * f, XRectangle * r, XPoint * pt, int ignore_layout);
|
||||
void draw_frame(Frame * f);
|
||||
void handle_frame_buttonpress(XButtonEvent * e, Frame * f);
|
||||
void attach_client(Client * c);
|
||||
void attach_client_to_frame(Frame * f, Client * c);
|
||||
void detach_client_from_frame(Client * c, int unmapped, int destroyed);
|
||||
void draw_tab(Frame * f, char *text, int x, int y, int w, int h, int sel);
|
||||
@ -264,15 +261,14 @@ Align xy_to_align(XRectangle * rect, int x, int y);
|
||||
void drop_move(Frame * f, XRectangle * new, XPoint * pt);
|
||||
|
||||
/* page.c */
|
||||
Page *alloc_page(char *autodestroy);
|
||||
Page *alloc_page();
|
||||
void free_page(Page * p);
|
||||
void destroy_page(Page * p);
|
||||
void focus_page(Page * p, int raise, int down);
|
||||
void sel_page(Page * p, int raise, int down);
|
||||
XRectangle *rectangles(unsigned int *num);
|
||||
void hide_page(Page * p);
|
||||
void show_page(Page * p);
|
||||
void draw_page(Page * p);
|
||||
Layout *get_layout(char *name);
|
||||
|
||||
/* layout.c */
|
||||
void init_layouts();
|
||||
@ -287,3 +283,4 @@ int win_state(Window w);
|
||||
void handle_after_write(IXPServer * s, File * f);
|
||||
void detach(Frame * f, int client_destroyed);
|
||||
void set_client_state(Client * c, int state);
|
||||
Layout *get_layout(char *name);
|
||||
|
@ -140,7 +140,7 @@ static void bind(void *obj, char *arg)
|
||||
b = emalloc(sizeof(Bind));
|
||||
*b = zero_bind;
|
||||
|
||||
b->client = init_client(sfile);
|
||||
b->client = init_ixp_client(sfile);
|
||||
|
||||
if (!b->client) {
|
||||
fprintf(stderr,
|
||||
|
@ -161,7 +161,7 @@ int main(int argc, char *argv[])
|
||||
usage();
|
||||
}
|
||||
/* open socket */
|
||||
if (!(c = init_client(sockfile))) {
|
||||
if (!(c = init_ixp_client(sockfile))) {
|
||||
fprintf(stderr, "wmir: cannot connect to server '%s'\n", sockfile);
|
||||
exit(1);
|
||||
}
|
||||
|
@ -250,7 +250,7 @@ static void cixp_remove(IXPClient * c, char *path)
|
||||
free(result);
|
||||
}
|
||||
|
||||
IXPClient *init_client(char *sockfile)
|
||||
IXPClient *init_ixp_client(char *sockfile)
|
||||
{
|
||||
struct sockaddr_un addr = { 0 };
|
||||
socklen_t su_len;
|
||||
|
@ -133,7 +133,7 @@ struct IXPServer {
|
||||
};
|
||||
|
||||
/* client.c, implements client stub functions for fs access */
|
||||
IXPClient *init_client(char *sockfile);
|
||||
IXPClient *init_ixp_client(char *sockfile);
|
||||
void deinit_client(IXPClient * c);
|
||||
size_t
|
||||
seek_read(IXPClient * c, int fd, size_t offset, void *out_buf,
|
||||
|
Loading…
Reference in New Issue
Block a user