gzz-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gzz-commits] gzz/gfx libos/Os-GLX.cxx util/disp.py


From: Tuomas J. Lukka
Subject: [Gzz-commits] gzz/gfx libos/Os-GLX.cxx util/disp.py
Date: Tue, 04 Mar 2003 08:49:06 -0500

CVSROOT:        /cvsroot/gzz
Module name:    gzz
Changes by:     Tuomas J. Lukka <address@hidden>        03/03/04 08:49:06

Modified files:
        gfx/libos      : Os-GLX.cxx 
        gfx/util       : disp.py 

Log message:
        Fix timeouts

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/libos/Os-GLX.cxx.diff?tr1=1.27&tr2=1.28&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/util/disp.py.diff?tr1=1.7&tr2=1.8&r1=text&r2=text

Patches:
Index: gzz/gfx/libos/Os-GLX.cxx
diff -u gzz/gfx/libos/Os-GLX.cxx:1.27 gzz/gfx/libos/Os-GLX.cxx:1.28
--- gzz/gfx/libos/Os-GLX.cxx:1.27       Tue Mar  4 08:15:01 2003
+++ gzz/gfx/libos/Os-GLX.cxx    Tue Mar  4 08:49:06 2003
@@ -719,8 +719,11 @@
                // If we're waiting for a timeout, sleep less.
                if(timeouts.size() && !eventsWaiting) {
                    long t = curTime();
+                   DBG(dbg) << "Have timeouts: curtime="<<t<<"\n";
                    for(unsigned i=0; i<timeouts.size(); i++) {
+                       DBG(dbg) << "Timeout "<<i<<": "<<timeouts[i].time<<" 
"<<timeouts[i].id<<"\n";
                        if(timeouts[i].time < t) {
+                           DBG(dbg) << "Did timeout!\n";
                            int id = timeouts[i].id;
                            LXWindow *w = windowsByX[timeouts[i].window];
                            timeouts.erase(timeouts.begin()+i);
@@ -730,11 +733,13 @@
                            int ms = timeouts[i].time - t;
                            if(ms < timeout.tv_usec / 1000)
                                timeout.tv_usec = 1000 * ms;
+                           DBG(dbg) << "No timeout: "<<ms<<" 
"<<timeout.tv_usec<<"\n";
                        }
                    }
                }
                // Call select to wait for something to happen.
                tmpReadFds = readFds;
+               DBG(dbg) << "Select: "<<timeout.tv_sec<<" 
"<<timeout.tv_usec<<"\n";
                select(fdsMax, &tmpReadFds, 0, 0, &timeout);
                char b[4];
                DBG(dbg) << "Emptying interrupt pipe\n";
@@ -744,17 +749,19 @@
                DBG(dbg) << "Empty\n";
            }
 
-
-           XEvent e;
-           XNextEvent(dpy, &e);
-           //cout << "getWindow\n";
-           LXWindow *w = windowsByX[e.xkey.window];
-           if(!w) {
-               DBG(dbg) << "Event for unknown window\n";
-               continue;
+           eventsWaiting = XEventsQueued(dpy, QueuedAfterFlush);
+           if(eventsWaiting) {
+               XEvent e;
+               XNextEvent(dpy, &e);
+               //cout << "getWindow\n";
+               LXWindow *w = windowsByX[e.xkey.window];
+               if(!w) {
+                   DBG(dbg) << "Event for unknown window\n";
+                   continue;
+               }
+               //cout << "deliver\n";
+               w->deliverEvent(&e);
            }
-           //cout << "deliver\n";
-           w->deliverEvent(&e);
        }
     }
 
Index: gzz/gfx/util/disp.py
diff -u gzz/gfx/util/disp.py:1.7 gzz/gfx/util/disp.py:1.8
--- gzz/gfx/util/disp.py:1.7    Tue Mar  4 08:13:00 2003
+++ gzz/gfx/util/disp.py        Tue Mar  4 08:49:06 2003
@@ -37,6 +37,8 @@
 import sys
 import random
 from java.lang import Runnable, System
+import getopt
+import traceback
 
 import gzz
 from gzz.gfx.gl import MipzipLoader
@@ -51,7 +53,16 @@
 
 from gfx.util import misc
 
-import traceback
+
+print "ARGV:",sys.argv
+print "DBG:",gzz.util.dbg.short,gzz.util.dbg.long,gzz.util.dbg.all
+opts, args = getopt.getopt(sys.argv[1:], 
+       gzz.util.dbg.short, 
+       gzz.util.dbg.long)
+for o,a in opts:
+    print "Opt: ",o,a
+    if o in gzz.util.dbg.all:
+       gzz.util.dbg.option(o,a)
 
 xs,ys = 1280, 960
 
@@ -186,14 +197,14 @@
         w.setLocation(0,0,xs,ys)
         w.registerBinder(Bindings())
 
-        if len(sys.argv) >= 3 and sys.argv[2] != "":
+        if len(args) >= 2 and args[1] != "":
             global logfile
-            logfile = sys.argv[2]
+            logfile = args[2]
 
         print "Reading trials"
         global trials
         trials = []
-        f = open(sys.argv[1], "r")
+        f = open(args[0], "r")
         while 1:
             line = f.readline()
             if line == "": break




reply via email to

[Prev in Thread] Current Thread [Next in Thread]