commit e8913c2afe120c0efd49378442cd003ef5de820e
parent 944a0526edfb181753fbd6ed7881d81a21f91e79
Author: Kris Maglione <jg@suckless.org>
Date: Thu, 8 Feb 2007 21:26:45 -0500
Fixed bug where v->sel could be set to a removed frame
Diffstat:
| area.c | | | 2 | +- |
| event.c | | | 64 | +++++++++++++++++++++++++--------------------------------------- |
2 files changed, 26 insertions(+), 40 deletions(-)
diff --git a/area.c b/area.c
@@ -267,7 +267,7 @@ detach_from_area(Area *a, Frame *f) {
c = f->client;
for(pr = a->frame; pr; pr = pr->anext)
- if(pr == f) break;
+ if(pr->next == f) break;
remove_frame(f);
if(a->sel == f) {
a->sel = pr;
diff --git a/event.c b/event.c
@@ -7,45 +7,6 @@
#include <string.h>
#include <X11/keysym.h>
-/* local functions */
-static void buttonpress(XEvent *e);
-static void buttonrelease(XEvent *e);
-static void configurerequest(XEvent *e);
-static void destroynotify(XEvent *e);
-static void enternotify(XEvent *e);
-static void leavenotify(XEvent *e);
-static void expose(XEvent *e);
-static void keypress(XEvent *e);
-static void mappingnotify(XEvent *e);
-static void maprequest(XEvent *e);
-static void propertynotify(XEvent *e);
-static void unmapnotify(XEvent *e);
-
-void (*handler[LASTEvent]) (XEvent *) = {
- [ButtonPress] = buttonpress,
- [ButtonRelease] = buttonrelease,
- [ConfigureRequest]= configurerequest,
- [DestroyNotify] = destroynotify,
- [EnterNotify] = enternotify,
- [LeaveNotify] = leavenotify,
- [Expose] = expose,
- [KeyPress] = keypress,
- [MappingNotify] = mappingnotify,
- [MapRequest] = maprequest,
- [PropertyNotify]= propertynotify,
- [UnmapNotify] = unmapnotify
-};
-
-void
-check_x_event(IXPConn *c) {
- XEvent ev;
- while(XPending(blz.dpy)) { /* main event loop */
- XNextEvent(blz.dpy, &ev);
- if(handler[ev.type])
- (handler[ev.type]) (&ev); /* call handler */
- }
-}
-
unsigned int
flush_masked_events(long even_mask) {
XEvent ev;
@@ -298,3 +259,28 @@ unmapnotify(XEvent *e) {
if((c = client_of_win(ev->window)))
destroy_client(c);
}
+
+void (*handler[LASTEvent]) (XEvent *) = {
+ [ButtonPress] = buttonpress,
+ [ButtonRelease] = buttonrelease,
+ [ConfigureRequest]= configurerequest,
+ [DestroyNotify] = destroynotify,
+ [EnterNotify] = enternotify,
+ [LeaveNotify] = leavenotify,
+ [Expose] = expose,
+ [KeyPress] = keypress,
+ [MappingNotify] = mappingnotify,
+ [MapRequest] = maprequest,
+ [PropertyNotify]= propertynotify,
+ [UnmapNotify] = unmapnotify
+};
+
+void
+check_x_event(IXPConn *c) {
+ XEvent ev;
+ while(XPending(blz.dpy)) { /* main event loop */
+ XNextEvent(blz.dpy, &ev);
+ if(handler[ev.type])
+ (handler[ev.type]) (&ev); /* call handler */
+ }
+}