eqemu

changeset 9:fca1f126d23b

fixed message pump
author John Tsiombikas <nuclear@member.fsf.org>
date Fri, 18 Jul 2014 04:47:27 +0300
parents c3b48cb2797f
children 819c7ebb1bec
files src/main.cc
diffstat 1 files changed, 6 insertions(+), 6 deletions(-) [+]
line diff
     1.1 --- a/src/main.cc	Fri Jul 18 04:25:24 2014 +0300
     1.2 +++ b/src/main.cc	Fri Jul 18 04:47:27 2014 +0300
     1.3 @@ -92,9 +92,9 @@
     1.4  
     1.5  		struct timeval noblock = {0, 0};
     1.6  		int maxfd = xfd > fakefd ? xfd : fakefd;
     1.7 -		while(select(maxfd + 1, &rd, 0, 0, draw_pending ? &noblock : 0) == -1 && errno == EINTR);
     1.8 +		while(!XPending(dpy) && select(maxfd + 1, &rd, 0, 0, draw_pending ? &noblock : 0) == -1 && errno == EINTR);
     1.9  
    1.10 -		if(FD_ISSET(xfd, &rd)) {
    1.11 +		if(XPending(dpy) || FD_ISSET(xfd, &rd)) {
    1.12  			process_events();
    1.13  		}
    1.14  		if(FD_ISSET(fakefd, &rd)) {
    1.15 @@ -235,22 +235,22 @@
    1.16  		}
    1.17  	}
    1.18  
    1.19 -	//if(get_led_state(0)) {
    1.20 +	if(get_led_state(0)) {
    1.21  		// continuously redraw until the left LED times out
    1.22  		draw_pending = true;
    1.23 -	//}
    1.24 +	}
    1.25  
    1.26  	glXSwapBuffers(dpy, win);
    1.27  	assert(glGetError() == GL_NO_ERROR);
    1.28  
    1.29 -	/*static long prev_msec;
    1.30 +	static long prev_msec;
    1.31  	long msec = get_msec();
    1.32  	long dt = msec - prev_msec;
    1.33  
    1.34  	if(dt < MIN_REDRAW_INTERVAL) {
    1.35  		wait_for(MIN_REDRAW_INTERVAL - dt);
    1.36  	}
    1.37 -	prev_msec = get_msec();*/
    1.38 +	prev_msec = get_msec();
    1.39  }
    1.40  
    1.41  static void draw_scene(int pass)