wmii

git clone git://oldgit.suckless.org/wmii/
Log | Files | Refs | README | LICENSE

commit 32426641d50f2ded4ee1071ac71e80390d69b426
parent 8fac4081d7a6f9a573e6bd6ac2d56a1e39ae97ba
Author: Anselm R. Garbe <garbeam@wmii.de>
Date:   Wed, 22 Mar 2006 17:08:21 +0100

other cursor fixes


Diffstat:
cmd/wm/event.c | 7+++----
cmd/wm/mouse.c | 7+++++--
cmd/wm/wm.c | 10++++++----
cmd/wm/wm.h | 1+
4 files changed, 15 insertions(+), 10 deletions(-)

diff --git a/cmd/wm/event.c b/cmd/wm/event.c @@ -72,7 +72,7 @@ handle_buttonpress(XEvent *e) } else if((c = win2clientframe(ev->window))) { if(ev->button == Button1) { - Align align = xy2align(&c->frame[c->sel]->rect, ev->x, ev->y); + Align align = xy2align(&c->rect, ev->x, ev->y); if(sel_client() != c) { focus(c); return; @@ -82,7 +82,6 @@ handle_buttonpress(XEvent *e) else mouse_resize(c, align); } - if(c->nframe) { snprintf(buf, sizeof(buf), "ClientClick %d %d\n", frame2index(c->frame[c->sel]) + 1, ev->button); write_event(buf); @@ -91,7 +90,7 @@ handle_buttonpress(XEvent *e) else if((c = win2client(ev->window))) { ev->state &= valid_mask; if(ev->state & Mod1Mask) { - Align align = xy2align(&c->frame[c->sel]->rect, ev->x, ev->y); + Align align = xy2align(&c->rect, ev->x, ev->y); switch (ev->button) { case Button1: focus(c); @@ -247,7 +246,7 @@ handle_motionnotify(XEvent *e) Client *c = win2clientframe(e->xmotion.window); if(c) { Cursor cur = cursor4motion(c, e->xmotion.x, e->xmotion.y); - if(cur == cursor[CurNormal]) + if(cur == cursor[CurUnknown]) XUndefineCursor(dpy, c->framewin); else XDefineCursor(dpy, c->framewin, cur); diff --git a/cmd/wm/mouse.c b/cmd/wm/mouse.c @@ -45,8 +45,10 @@ cursor4motion(Client *c, int x, int y) return cursor[CurN]; else if(s) return cursor[CurS]; - - return cursor[CurNormal]; + + if(tn) + return cursor[CurNormal]; + return cursor[CurUnknown]; } Align @@ -78,6 +80,7 @@ xy2align(XRectangle *rect, int x, int y) return NORTH; else if(s) return SOUTH; + return CENTER; } diff --git a/cmd/wm/wm.c b/cmd/wm/wm.c @@ -139,6 +139,7 @@ init_atoms() static void init_cursors() { + cursor[CurUnknown] = XCreateFontCursor(dpy, XC_cross); cursor[CurNormal] = XCreateFontCursor(dpy, XC_left_ptr); cursor[CurResize] = XCreateFontCursor(dpy, XC_sizing); cursor[CurMove] = XCreateFontCursor(dpy, XC_fleur); @@ -169,8 +170,6 @@ init_screen() rect.x = rect.y = 0; rect.width = DisplayWidth(dpy, screen); rect.height = DisplayHeight(dpy, screen); - - XDefineCursor(dpy, root, cursor[CurNormal]); } /* @@ -331,10 +330,15 @@ main(int argc, char *argv[]) init_lock_modifiers(); init_screen(); + wa.event_mask = ROOT_MASK; + wa.cursor = cursor[CurNormal]; + XChangeWindowAttributes(dpy, root, CWEventMask | CWCursor, &wa); + wa.override_redirect = 1; wa.background_pixmap = ParentRelative; wa.event_mask = ExposureMask | ButtonPressMask | SubstructureRedirectMask | SubstructureNotifyMask; + brect = rect; brect.height = xfont->ascent + xfont->descent + 4; brect.y = rect.height - brect.height; @@ -342,8 +346,6 @@ main(int argc, char *argv[]) brect.width, brect.height, 0, DefaultDepth(dpy, screen), CopyFromParent, DefaultVisual(dpy, screen), CWOverrideRedirect | CWBackPixmap | CWEventMask, &wa); - - XDefineCursor(dpy, barwin, XCreateFontCursor(dpy, XC_left_ptr)); XSync(dpy, False); bargc = XCreateGC(dpy, barwin, 0, 0); diff --git a/cmd/wm/wm.h b/cmd/wm/wm.h @@ -27,6 +27,7 @@ enum { /* Cursor */ enum { + CurUnknown, CurNormal, CurResize, CurMove,