mirror of
https://github.com/0intro/wmii
synced 2024-12-26 05:16:59 +03:00
some more fixes/simplifications
This commit is contained in:
parent
fefbab01e2
commit
4c25ff1ad5
@ -78,8 +78,7 @@ static void handle_buttonpress(XEvent * e)
|
||||
ev->state &= valid_mask;
|
||||
if (ev->state & Mod1Mask) {
|
||||
Align align;
|
||||
if (!c->frame->area->page->sel)
|
||||
XRaiseWindow(dpy, c->frame->win);
|
||||
XRaiseWindow(dpy, c->frame->win);
|
||||
switch (ev->button) {
|
||||
case Button1:
|
||||
mouse_move(c->frame);
|
||||
@ -247,7 +246,7 @@ static void handle_enternotify(XEvent * e)
|
||||
|
||||
c = win_to_client(ev->window);
|
||||
if (c && c->frame && (ev->serial != ignore_enternotify_crap)) {
|
||||
Frame *old = SELFRAME(page[sel]);
|
||||
Frame *old = get_sel_frame();
|
||||
if (old != c->frame) {
|
||||
sel_frame(c->frame, 1);
|
||||
draw_frame(old);
|
||||
|
@ -326,7 +326,7 @@ void mouse_move(Frame * f)
|
||||
draw_pseudo_border(&frect);
|
||||
resize_frame(f, &frect, &pt);
|
||||
}
|
||||
draw_page(page[sel]);
|
||||
draw_page(get_sel_page());
|
||||
free(rects);
|
||||
XUngrabPointer(dpy, CurrentTime /* ev.xbutton.time */ );
|
||||
XUngrabServer(dpy);
|
||||
@ -592,19 +592,22 @@ void mouse_resize(Frame * f, Align align)
|
||||
}
|
||||
|
||||
|
||||
void drop_move(Frame * f, XRectangle * new, XPoint * pt)
|
||||
void drop_move(Frame *f, XRectangle *new, XPoint *pt)
|
||||
{
|
||||
Frame *fp;
|
||||
Area *a = f->area;
|
||||
int cx, cy;
|
||||
unsigned int i, idx = index_item((void **) a->frame, f);
|
||||
unsigned int i, idx = cext_get_item_index(&a->frames, f);
|
||||
size_t size = cext_sizeof(&a->frames);
|
||||
|
||||
if ((f->rect.x == new->x) && (f->rect.y == new->y))
|
||||
return;
|
||||
cx = (pt ? pt->x : new->x + new->width / 2);
|
||||
cy = (pt ? pt->y : new->y + new->height / 2);
|
||||
for (i = 0; a->frame[i]; i++) {
|
||||
if ((a->frame[i] != f)
|
||||
&& blitz_ispointinrect(cx, cy, &a->frame[i]->rect)) {
|
||||
for (i = 0; i < size; i++) {
|
||||
fp = cext_get_item(&a->frames, idx);
|
||||
if ((i != idx) && blitz_ispointinrect(cx, cy, &fp->rect)) {
|
||||
/* XXXX: implement swap replacement */
|
||||
swap((void **) &a->frame[i], (void **) &a->frame[idx]);
|
||||
a->sel = i;
|
||||
a->layout->arrange(a);
|
||||
|
@ -708,8 +708,6 @@ static void run()
|
||||
}
|
||||
def[WM_CTL]->after_write = handle_after_write;
|
||||
|
||||
clients = frames = detached = pages = layouts = zero_container;
|
||||
|
||||
init_atoms();
|
||||
init_cursors();
|
||||
init_default();
|
||||
|
11
cmd/wm/wm.h
11
cmd/wm/wm.h
@ -165,12 +165,11 @@ int screen_num;
|
||||
Window root;
|
||||
Window transient;
|
||||
XRectangle rect;
|
||||
Container detached;
|
||||
Container pages;
|
||||
Container frames;
|
||||
Container clients;
|
||||
Container layouts;
|
||||
static Container zero_container = { 0 };
|
||||
Container detached = {0};
|
||||
Container pages = {0};
|
||||
Container frames = {0};
|
||||
Container clients = {0};
|
||||
Container layouts = {0};
|
||||
XFontStruct *font;
|
||||
XColor xorcolor;
|
||||
GC xorgc;
|
||||
|
Loading…
Reference in New Issue
Block a user