mirror of
https://github.com/0intro/wmii
synced 2024-12-26 05:16:59 +03:00
some more fixes of new interface
This commit is contained in:
parent
4c25ff1ad5
commit
004b0da2cc
@ -98,28 +98,31 @@ Frame *alloc_frame(XRectangle * r)
|
||||
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 *));
|
||||
cext_attach_item(&frames, f);
|
||||
return f;
|
||||
}
|
||||
|
||||
void sel_frame(Frame * f, int raise)
|
||||
{
|
||||
Area *a = f->area;
|
||||
sel_client(f->client[f->sel]);
|
||||
a->sel = index_item((void **) a->frame, f);
|
||||
sel_client(cext_get_top_item(&f->clients));
|
||||
cext_top_item(&a->frames, f);
|
||||
a->file[A_SEL_FRAME]->content = f->file[F_PREFIX]->content;
|
||||
if (raise)
|
||||
XRaiseWindow(dpy, f->win);
|
||||
}
|
||||
|
||||
static int comp_frame_win(void *pattern, void *frame)
|
||||
{
|
||||
Window w = *(Window *)pattern;
|
||||
Frame *f = frame;
|
||||
|
||||
return w == f->win;
|
||||
}
|
||||
|
||||
Frame *win_to_frame(Window w)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; frame && frame[i]; i++)
|
||||
if (frame[i]->win == w)
|
||||
return frame[i];
|
||||
return 0;
|
||||
return cext_find_item(&frames, w, comp_frame_win);
|
||||
}
|
||||
|
||||
void destroy_frame(Frame * f)
|
||||
|
@ -594,7 +594,7 @@ void mouse_resize(Frame * f, Align align)
|
||||
|
||||
void drop_move(Frame *f, XRectangle *new, XPoint *pt)
|
||||
{
|
||||
Frame *fp;
|
||||
Frame *f1, *f2;
|
||||
Area *a = f->area;
|
||||
int cx, cy;
|
||||
unsigned int i, idx = cext_get_item_index(&a->frames, f);
|
||||
@ -604,12 +604,13 @@ void drop_move(Frame *f, XRectangle *new, XPoint *pt)
|
||||
return;
|
||||
cx = (pt ? pt->x : new->x + new->width / 2);
|
||||
cy = (pt ? pt->y : new->y + new->height / 2);
|
||||
f1 = cext_get_item(&a->frames, idx);
|
||||
for (i = 0; i < size; i++) {
|
||||
fp = cext_get_item(&a->frames, idx);
|
||||
if ((i != idx) && blitz_ispointinrect(cx, cy, &fp->rect)) {
|
||||
f2 = cext_get_item(&a->frames, i);
|
||||
if ((i != idx) && blitz_ispointinrect(cx, cy, &f1->rect)) {
|
||||
/* XXXX: implement swap replacement */
|
||||
swap((void **) &a->frame[i], (void **) &a->frame[idx]);
|
||||
a->sel = i;
|
||||
cext_swap_items(&a->frames, f1, f2);
|
||||
cext_top_item(&a->frames, f2);
|
||||
a->layout->arrange(a);
|
||||
return;
|
||||
}
|
||||
|
@ -428,7 +428,7 @@ static void new_page(void *obj, char *cmd)
|
||||
alloc_page();
|
||||
}
|
||||
|
||||
static int comp_win(void *pattern, void *client)
|
||||
static int comp_client_win(void *pattern, void *client)
|
||||
{
|
||||
Window w = *(Window *)pattern;
|
||||
Client *c = client;
|
||||
@ -438,7 +438,7 @@ static int comp_win(void *pattern, void *client)
|
||||
|
||||
Client *win_to_client(Window w)
|
||||
{
|
||||
return cext_find_item(&clients, &w, comp_win);
|
||||
return cext_find_item(&clients, &w, comp_client_win);
|
||||
}
|
||||
|
||||
void scan_wins()
|
||||
|
@ -42,6 +42,7 @@ void *cext_get_up_item(Container *c, void *item);
|
||||
void *cext_get_item(Container *c, size_t index);
|
||||
int cext_get_item_index(Container *c, void *item);
|
||||
size_t cext_sizeof(Container *c);
|
||||
void cext_swap_items(Container *c, void *item1, void *item2);
|
||||
|
||||
void **attach_item_begin(void **old, void *item, size_t size_item);
|
||||
void **attach_item_end(void **old, void *item, size_t size_item);
|
||||
|
@ -149,6 +149,16 @@ size_t cext_sizeof(Container *c)
|
||||
return idx;
|
||||
}
|
||||
|
||||
void cext_swap_items(Container *c, void *item1, void *item2)
|
||||
{
|
||||
CItem *i1 = cext_find_item(c, item1, comp_ptr);
|
||||
CItem *i2 = cext_find_item(c, item2, comp_ptr);
|
||||
|
||||
i1->item = item2;
|
||||
i2->item = item1;
|
||||
}
|
||||
|
||||
|
||||
/* old obsolete stuff follows */
|
||||
|
||||
void **attach_item_begin(void **old, void *item, size_t size_item)
|
||||
|
Loading…
Reference in New Issue
Block a user