swk

static widget kit
git clone git://git.suckless.org/swk
Log | Files | Refs | README | LICENSE

commit f28565e74c46df6dd482e6beb835fc09992d3542
parent fb44a42f301fa8a0c5a24e01c5f160fefb872371
Author: anselm@garbe.us <unknown>
Date:   Thu, 19 Aug 2010 11:18:02 +0100

removed useless has_event stuff
Diffstat:
gi_sdl.c | 7-------
gi_x11.c | 14++------------
swk.c | 5-----
swk.h | 2--
4 files changed, 2 insertions(+), 26 deletions(-)

diff --git a/gi_sdl.c b/gi_sdl.c @@ -109,13 +109,6 @@ swk_gi_exit() { SDL_Quit(); } -int -swk_gi_has_event(SwkWindow *w) { - if(!has_event) - has_event = SDL_PollEvent(&lastev); - return has_event; -} - SwkEvent * swk_gi_event(SwkWindow *w, int dowait) { static int mousedowny, mousedownx, mousedown = 0; diff --git a/gi_x11.c b/gi_x11.c @@ -19,8 +19,6 @@ static int fs = FONTSIZE; // TODO: we need fsW and fsH static Window window; static int screen; static Display *display = NULL; -static int has_event = 0; -static XEvent lastev; static int first = 1; #define EVENTMASK PointerMotionMask | ExposureMask | KeyPressMask | ButtonPressMask | ButtonReleaseMask @@ -67,11 +65,6 @@ swk_gi_exit() { XCloseDisplay(display); } -int -swk_gi_has_event(SwkWindow *w) { - return (has_event = XCheckMaskEvent(display, AnyEvent, &lastev)); -} - SwkEvent * swk_gi_event(SwkWindow *w, int dowait) { static int mousedowny, mousedownx, mousedown = 0; @@ -80,10 +73,8 @@ swk_gi_event(SwkWindow *w, int dowait) { XEvent event; SwkEvent *ret = &w->_e; - if(has_event) event = lastev; - else has_event = !XNextEvent(display, &event); - - if(has_event); + if(!XCheckMaskEvent(display, AnyEvent, &event)) + return NULL; switch(event.type) { case Expose: ret->type = EExpose; @@ -171,7 +162,6 @@ swk_gi_event(SwkWindow *w, int dowait) { ret = NULL; break; } - has_event = 0; return ret; } diff --git a/swk.c b/swk.c @@ -200,11 +200,6 @@ swk_fit() { } } -int -swk_has_event() { // XXX: remove this useless wrap - return swk_gi_has_event(w); -} - void swk_focus_activate() { w->_e.box = w->box; diff --git a/swk.h b/swk.h @@ -84,7 +84,6 @@ void swk_exit(); void swk_fit(); void swk_loop(); SwkEvent *swk_next_event(); -int swk_has_event(); void swk_handle_event(SwkEvent *e); void swk_focus_first(); @@ -116,7 +115,6 @@ int swk_gi_init(SwkWindow *w); void swk_gi_exit(); SwkEvent *swk_gi_event(SwkWindow *w, int dowait); int swk_gi_update(SwkWindow *w); -int swk_gi_has_event(SwkWindow *w); int swk_gi_fontsize(int sz); /* FIXME: don't these need SwkWindow *w state, to avoid static'ness? */