wmii

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

commit 0a823da46156b543c8bbd4f6882e41ea49c16a62
parent a5790f64893478e3758345bd7d69acebb7e5965b
Author: Anselm R. Garbe <garbeam@wmii.de>
Date:   Tue, 25 Apr 2006 18:51:25 +0200

Click events are written on release now, not on Press


Diffstat:
cmd/wm/client.c | 2+-
cmd/wm/event.c | 24+++++++++++++++++-------
cmd/wm/wm.c | 2+-
3 files changed, 19 insertions(+), 9 deletions(-)

diff --git a/cmd/wm/client.c b/cmd/wm/client.c @@ -75,7 +75,7 @@ create_client(Window w, XWindowAttributes *wa) fwa.override_redirect = 1; fwa.background_pixmap = ParentRelative; fwa.event_mask = SubstructureRedirectMask | SubstructureNotifyMask - | EnterWindowMask | ExposureMask | ButtonPressMask; + | EnterWindowMask | ExposureMask | ButtonPressMask | ButtonReleaseMask; c->framewin = XCreateWindow(dpy, root, c->rect.x, c->rect.y, c->rect.width + 2 * def.border, diff --git a/cmd/wm/event.c b/cmd/wm/event.c @@ -12,6 +12,7 @@ /* local functions */ static void handle_buttonpress(XEvent * e); +static void handle_buttonrelease(XEvent * e); static void handle_configurerequest(XEvent * e); static void handle_destroynotify(XEvent * e); static void handle_enternotify(XEvent * e); @@ -32,6 +33,7 @@ init_x_event_handler() for(i = 0; i < LASTEvent; i++) handler[i] = nil; handler[ButtonPress] = handle_buttonpress; + handler[ButtonRelease] = handle_buttonrelease; handler[ConfigureRequest] = handle_configurerequest; handler[DestroyNotify] = handle_destroynotify; handler[EnterNotify] = handle_enternotify; @@ -62,7 +64,7 @@ flush_enter_events() } static void -handle_buttonpress(XEvent *e) +handle_buttonrelease(XEvent *e) { Client *c; XButtonPressedEvent *ev = &e->xbutton; @@ -77,7 +79,20 @@ handle_buttonpress(XEvent *e) return; } } - else if((c = frame_of_win(ev->window))) { + else if((c = frame_of_win(ev->window)) && c->frame.size) { + snprintf(buf, sizeof(buf), "ClientClick %d %d\n", + idx_of_client_id(c->id), ev->button); + write_event(buf); + } +} + +static void +handle_buttonpress(XEvent *e) +{ + Client *c; + XButtonPressedEvent *ev = &e->xbutton; + + if((c = frame_of_win(ev->window))) { ev->state &= valid_mask; if(ev->state & def.mod) { if((ev->button == Button1 || ev->button == Button3) @@ -97,11 +112,6 @@ handle_buttonpress(XEvent *e) if(sel_client() != c) focus(c); } - if(c->frame.size) { - snprintf(buf, sizeof(buf), "ClientClick %d %d\n", - idx_of_client_id(c->id), ev->button); - write_event(buf); - } } } diff --git a/cmd/wm/wm.c b/cmd/wm/wm.c @@ -313,7 +313,7 @@ main(int argc, char *argv[]) wa.override_redirect = 1; wa.background_pixmap = ParentRelative; - wa.event_mask = ExposureMask | ButtonPressMask + wa.event_mask = ExposureMask | ButtonReleaseMask | SubstructureRedirectMask | SubstructureNotifyMask; brect = rect;