wmii

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

commit d3fbdfac1be4926927c4caab7b4cb2fb63828b7e
parent 9708b26a9ab0cecfe4372f2719d01771376e70b3
Author: Anselm R. Garbe <garbeam@wmii.de>
Date:   Wed, 22 Mar 2006 17:26:39 +0100

removed border cursor displaying on motion event, we got Alt-Button{1,3}, we don't want redundant behavior


Diffstat:
cmd/wm/client.c | 2+-
cmd/wm/event.c | 37+++++++++----------------------------
cmd/wm/mouse.c | 42------------------------------------------
cmd/wm/wm.c | 9---------
cmd/wm/wm.h | 10----------
5 files changed, 10 insertions(+), 90 deletions(-)

diff --git a/cmd/wm/client.c b/cmd/wm/client.c @@ -45,7 +45,7 @@ alloc_client(Window w, XWindowAttributes *wa) } fwa.override_redirect = 1; fwa.background_pixmap = ParentRelative; - fwa.event_mask = SubstructureRedirectMask | SubstructureNotifyMask | ExposureMask | ButtonPressMask | PointerMotionMask; + fwa.event_mask = SubstructureRedirectMask | SubstructureNotifyMask | ExposureMask | ButtonPressMask; c->framewin = XCreateWindow(dpy, root, c->rect.x, c->rect.y, c->rect.width + 2 * def.border, c->rect.height + def.border + bar_height(), 0, diff --git a/cmd/wm/event.c b/cmd/wm/event.c @@ -18,7 +18,6 @@ static void handle_expose(XEvent * e); static void handle_keypress(XEvent * e); static void handle_keymapnotify(XEvent * e); static void handle_maprequest(XEvent * e); -static void handle_motionnotify(XEvent * e); static void handle_propertynotify(XEvent * e); static void handle_unmapnotify(XEvent * e); @@ -39,7 +38,6 @@ init_x_event_handler() handler[KeyPress] = handle_keypress; handler[KeymapNotify] = handle_keymapnotify; handler[MapRequest] = handle_maprequest; - handler[MotionNotify] = handle_motionnotify; handler[PropertyNotify] = handle_propertynotify; handler[UnmapNotify] = handle_unmapnotify; } @@ -72,15 +70,10 @@ handle_buttonpress(XEvent *e) } else if((c = win2clientframe(ev->window))) { if(ev->button == Button1) { - Align align = xy2align(&c->rect, ev->x, ev->y); if(sel_client() != c) { focus(c); return; } - if(align == CENTER) - mouse_move(c); - else - mouse_resize(c, align); } if(c->nframe) { snprintf(buf, sizeof(buf), "ClientClick %d %d\n", frame2index(c->frame[c->sel]) + 1, ev->button); @@ -90,19 +83,20 @@ handle_buttonpress(XEvent *e) else if((c = win2client(ev->window))) { ev->state &= valid_mask; if(ev->state & Mod1Mask) { - Align align = xy2align(&c->rect, ev->x, ev->y); + focus(c); switch (ev->button) { - case Button1: - focus(c); - mouse_move(c); - break; - case Button3: - focus(c); + case Button1: + mouse_move(c); + break; + case Button3: + { + Align align = xy2align(&c->rect, ev->x, ev->y); if(align == CENTER) mouse_move(c); else mouse_resize(c, align); - break; + } + break; } } else if(ev->button == Button1) @@ -241,19 +235,6 @@ handle_maprequest(XEvent *e) } static void -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[CurUnknown]) - XUndefineCursor(dpy, c->framewin); - else - XDefineCursor(dpy, c->framewin, cur); - } -} - -static void handle_propertynotify(XEvent *e) { XPropertyEvent *ev = &e->xproperty; diff --git a/cmd/wm/mouse.c b/cmd/wm/mouse.c @@ -9,48 +9,6 @@ #include "wm.h" -Cursor -cursor4motion(Client *c, int x, int y) -{ - Frame *f = c->frame[c->sel]; - int n, e, w, s, tn, te, tw, ts; - - if(!def.border < 2) - return cursor[CurNormal]; - - /* rectangle attributes of client are used */ - w = x < def.border - 1; - e = x >= f->rect.width - (def.border - 1); - n = y < def.border; - s = y >= f->rect.height - (def.border - 1); - - tw = x < bar_height(); - te = x > f->rect.width - bar_height(); - tn = y < bar_height(); - ts = s > f->rect.height - bar_height(); - - if((w && n) || (w && tn) || (n && tw)) - return cursor[CurNW]; - else if((e && n) || (e && tn) || (n && te)) - return cursor[CurNE]; - else if((w && s) || (w && ts) || (s && tw)) - return cursor[CurSW]; - else if((e && s) || (e && ts) || (s && te)) - return cursor[CurSE]; - else if(w) - return cursor[CurW]; - else if(e) - return cursor[CurE]; - else if(n) - return cursor[CurN]; - else if(s) - return cursor[CurS]; - - if(tn) - return cursor[CurNormal]; - return cursor[CurUnknown]; -} - Align xy2align(XRectangle *rect, int x, int y) { diff --git a/cmd/wm/wm.c b/cmd/wm/wm.c @@ -139,18 +139,9 @@ 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); - cursor[CurW] = XCreateFontCursor(dpy, XC_left_side); - cursor[CurE] = XCreateFontCursor(dpy, XC_right_side); - cursor[CurN] = XCreateFontCursor(dpy, XC_top_side); - cursor[CurS] = XCreateFontCursor(dpy, XC_bottom_side); - cursor[CurNW] = XCreateFontCursor(dpy, XC_top_left_corner); - cursor[CurNE] = XCreateFontCursor(dpy, XC_top_right_corner); - cursor[CurSW] = XCreateFontCursor(dpy, XC_bottom_left_corner); - cursor[CurSE] = XCreateFontCursor(dpy, XC_bottom_right_corner); } static void diff --git a/cmd/wm/wm.h b/cmd/wm/wm.h @@ -27,18 +27,9 @@ enum { /* Cursor */ enum { - CurUnknown, CurNormal, CurResize, CurMove, - CurW, - CurE, - CurN, - CurS, - CurNW, - CurNE, - CurSW, - CurSE, CurLast }; @@ -284,7 +275,6 @@ void init_lock_modifiers(); /* mouse.c */ void mouse_resize(Client *c, Align align); void mouse_move(Client *c); -Cursor cursor4motion(Client *c, int x, int y); Align xy2align(XRectangle *rect, int x, int y); void drop_move(Client *c, XRectangle *new, XPoint *pt); void grab_mouse(Window w, unsigned long mod, unsigned int button);