wmii

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

commit 53387d3637b22968bc57f801e7e95b56b4365c8f
parent 6e8664bdd091d39bab869304db0374899eaad0d4
Author: Kris Maglione <jg@suckless.org>
Date:   Wed, 21 Feb 2007 16:34:12 -0500

Make sure that the framewin's cursor is set to CurNormal whenever the mouse is over the client

Diffstat:
event.c | 168++++++++++++++++++++++++++++++++++++++++---------------------------------------
1 file changed, 85 insertions(+), 83 deletions(-)

diff --git a/event.c b/event.c @@ -173,6 +173,7 @@ enternotify(XEvent *e) { if(c->sel->area->mode == Colmax) c = c->sel->area->sel->client; focus(c, False); + set_cursor(c, cursor[CurNormal]); } else if(ev->window == blz.root) { sel_screen = True; @@ -191,6 +192,86 @@ leavenotify(XEvent *e) { } static void +focusin(XEvent *e) { + Client *c, *old; + XFocusChangeEvent *ev = &e->xfocus; + + /* Yes, we're focusing in on nothing, here. */ + if(ev->detail == NotifyDetailNone) { + XSetInputFocus(blz.dpy, screen->barwin, RevertToParent, CurrentTime); + return; + } + + if(!((ev->detail == NotifyNonlinear) + ||(ev->detail == NotifyNonlinearVirtual) + ||(ev->detail == NotifyInferior) + ||(ev->detail == NotifyAncestor))) + return; + if(ev->mode == NotifyWhileGrabbed) + return; + + c = client_of_win(ev->window); + old = screen->focus; + if(c) { + if(verbose) { + fprintf(stderr, "screen->focus: %p => %p\n", screen->focus, c); + fprintf(stderr, "\t%s => %s\n", (screen->focus ? screen->focus->name : nil), + c->name); + } + if(ev->mode == NotifyGrab) + screen->hasgrab = c; + screen->focus = c; + update_client_grab(c); + if(c->sel) + draw_frame(c->sel); + if(old && old->sel) + draw_frame(old->sel); + }else if(ev->window == screen->barwin) { + if(verbose) { + fprintf(stderr, "screen->focus: %p => %p\n", screen->focus, c); + fprintf(stderr, "\t%s => %s\n", (screen->focus ? screen->focus->name : nil), + "<nil>"); + } + screen->focus = nil; + }else if(ev->mode == NotifyGrab) { + c = screen->focus; + if(c) { + screen->focus = nil; + if(c->sel) + draw_frame(c->sel); + } + } +} + +static void +focusout(XEvent *e) { + Client *c; + XFocusChangeEvent *ev = &e->xfocus; + + if(!((ev->detail == NotifyNonlinear) + ||(ev->detail == NotifyNonlinearVirtual))) + return; + if(ev->mode == NotifyUngrab) + screen->hasgrab = nil; + + c = client_of_win(ev->window); + if(c) { + if(ev->mode == NotifyWhileGrabbed) { + if(screen->focus && screen->hasgrab != screen->focus) + screen->hasgrab = screen->focus; + if(screen->hasgrab == c) + return; + } + if(screen->focus == c) + screen->focus = nil; + update_client_grab(c); + if(c->sel) + draw_frame(c->sel); + } +} + + +static void expose(XEvent *e) { XExposeEvent *ev = &e->xexpose; static Frame *f; @@ -257,7 +338,8 @@ motionnotify(XEvent *e) { Frame *f; if((f = frame_of_win(ev->window))) { - if(!ispointinrect(ev->x, ev->y, &f->titlebar)) { + if(!ispointinrect(ev->x, ev->y, &f->titlebar) + &&!ispointinrect(ev->x, ev->y, &f->crect)) { cur = cursor_of_quad(quadofcoord(&f->rect, ev->x_root, ev->y_root)); set_cursor(f->client, cur); }else @@ -285,86 +367,6 @@ unmapnotify(XEvent *e) { if(!c->unmapped--) destroy_client(c); } - -static void -focusin(XEvent *e) { - Client *c, *old; - XFocusChangeEvent *ev = &e->xfocus; - - /* Yes, we're focusing in on nothing, here. */ - if(ev->detail == NotifyDetailNone) { - XSetInputFocus(blz.dpy, screen->barwin, RevertToParent, CurrentTime); - return; - } - - if(!((ev->detail == NotifyNonlinear) - ||(ev->detail == NotifyNonlinearVirtual) - ||(ev->detail == NotifyInferior) - ||(ev->detail == NotifyAncestor))) - return; - if(ev->mode == NotifyWhileGrabbed) - return; - - c = client_of_win(ev->window); - old = screen->focus; - if(c) { - if(verbose) { - fprintf(stderr, "screen->focus: %p => %p\n", screen->focus, c); - fprintf(stderr, "\t%s => %s\n", (screen->focus ? screen->focus->name : nil), - c->name); - } - if(ev->mode == NotifyGrab) - screen->hasgrab = c; - screen->focus = c; - update_client_grab(c); - if(c->sel) - draw_frame(c->sel); - if(old && old->sel) - draw_frame(old->sel); - }else if(ev->window == screen->barwin) { - if(verbose) { - fprintf(stderr, "screen->focus: %p => %p\n", screen->focus, c); - fprintf(stderr, "\t%s => %s\n", (screen->focus ? screen->focus->name : nil), - "<nil>"); - } - screen->focus = nil; - }else if(ev->mode == NotifyGrab) { - c = screen->focus; - if(c) { - screen->focus = nil; - if(c->sel) - draw_frame(c->sel); - } - } -} - -static void -focusout(XEvent *e) { - Client *c; - XFocusChangeEvent *ev = &e->xfocus; - - if(!((ev->detail == NotifyNonlinear) - ||(ev->detail == NotifyNonlinearVirtual))) - return; - if(ev->mode == NotifyUngrab) - screen->hasgrab = nil; - - c = client_of_win(ev->window); - if(c) { - if(ev->mode == NotifyWhileGrabbed) { - if(screen->focus && screen->hasgrab != screen->focus) - screen->hasgrab = screen->focus; - if(screen->hasgrab == c) - return; - } - if(screen->focus == c) - screen->focus = nil; - update_client_grab(c); - if(c->sel) - draw_frame(c->sel); - } -} - void (*handler[LASTEvent]) (XEvent *) = { [ButtonPress] = buttonpress, [ButtonRelease] = buttonrelease, @@ -387,11 +389,11 @@ void (*handler[LASTEvent]) (XEvent *) = { void check_x_event(IXPConn *c) { XEvent ev; - while(XPending(blz.dpy)) { /* main event loop */ + while(XPending(blz.dpy)) { XNextEvent(blz.dpy, &ev); if(verbose) printevent(&ev); if(handler[ev.type]) - (handler[ev.type]) (&ev); /* call handler */ + handler[ev.type](&ev); } }