wmii

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

commit 3b8f3334d0ec657122bb162e5d623ec740b83d29
parent 7d74df656fa2350cd1085a0cd787667884b125a7
Author: Kris Maglione <bsdaemon@wmii.de>
Date:   Thu, 22 Jun 2006 03:47:54 -0400

Replaced init_x_event_handlers() with an initializer


Diffstat:
cmd/wm/event.c | 34++++++++++++++--------------------
cmd/wm/wm.c | 1-
cmd/wm/wm.h | 1-
3 files changed, 14 insertions(+), 22 deletions(-)

diff --git a/cmd/wm/event.c b/cmd/wm/event.c @@ -24,26 +24,20 @@ static void handle_maprequest(XEvent * e); static void handle_propertynotify(XEvent * e); static void handle_unmapnotify(XEvent * e); -void -init_x_event_handler() -{ - int i; - /* init 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; - handler[LeaveNotify] = handle_leavenotify; - handler[Expose] = handle_expose; - handler[KeyPress] = handle_keypress; - handler[KeymapNotify] = handle_keymapnotify; - handler[MapRequest] = handle_maprequest; - handler[PropertyNotify] = handle_propertynotify; - handler[UnmapNotify] = handle_unmapnotify; -} +void (*handler[LASTEvent]) (XEvent *) = { + [ButtonPress] = handle_buttonpress, + [ButtonRelease] = handle_buttonrelease, + [ConfigureRequest]= handle_configurerequest, + [DestroyNotify] = handle_destroynotify, + [EnterNotify] = handle_enternotify, + [LeaveNotify] = handle_leavenotify, + [Expose] = handle_expose, + [KeyPress] = handle_keypress, + [KeymapNotify] = handle_keymapnotify, + [MapRequest] = handle_maprequest, + [PropertyNotify]= handle_propertynotify, + [UnmapNotify] = handle_unmapnotify +}; void check_x_event(IXPConn *c) diff --git a/cmd/wm/wm.c b/cmd/wm/wm.c @@ -284,7 +284,6 @@ main(int argc, char *argv[]) /* X server */ ixp_server_open_conn(&srv, ConnectionNumber(dpy), nil, check_x_event, nil); - init_x_event_handler(); blitz_x11_init(dpy); view = nil; diff --git a/cmd/wm/wm.h b/cmd/wm/wm.h @@ -253,7 +253,6 @@ char *str_of_column_mode(int mode); Area *new_column(View *v, Area *pos, unsigned int w); /* event.c */ -void init_x_event_handler(); void check_x_event(IXPConn *c); unsigned int flush_masked_events(long even_mask);