[hackers] [swk] removed useless has_event stuff || anselm

From: <hg_AT_suckless.org>
Date: Thu, 19 Aug 2010 10:18:08 +0000 (UTC)

changeset: 59:d3af7c8893d1
tag: tip
user: anselm_AT_garbe.us
date: Thu Aug 19 11:18:02 2010 +0100
files: gi_sdl.c gi_x11.c swk.c swk.h
description:
removed useless has_event stuff

diff -r 7753c39e5779 -r d3af7c8893d1 gi_sdl.c
--- a/gi_sdl.c Thu Aug 19 10:57:49 2010 +0100
+++ b/gi_sdl.c Thu Aug 19 11:18:02 2010 +0100
@@ -109,13 +109,6 @@
         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 -r 7753c39e5779 -r d3af7c8893d1 gi_x11.c
--- a/gi_x11.c Thu Aug 19 10:57:49 2010 +0100
+++ b/gi_x11.c Thu Aug 19 11:18:02 2010 +0100
@@ -19,8 +19,6 @@
 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 @@
         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 @@
         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 @@
                 ret = NULL;
                 break;
         }
- has_event = 0;
         return ret;
 }
 
diff -r 7753c39e5779 -r d3af7c8893d1 swk.c
--- a/swk.c Thu Aug 19 10:57:49 2010 +0100
+++ b/swk.c Thu Aug 19 11:18:02 2010 +0100
@@ -200,11 +200,6 @@
         }
 }
 
-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 -r 7753c39e5779 -r d3af7c8893d1 swk.h
--- a/swk.h Thu Aug 19 10:57:49 2010 +0100
+++ b/swk.h Thu Aug 19 11:18:02 2010 +0100
@@ -84,7 +84,6 @@
 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 @@
 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? */
Received on Thu Aug 19 2010 - 12:18:08 CEST

This archive was generated by hypermail 2.2.0 : Thu Aug 19 2010 - 12:24:04 CEST