gzz-commits
[Top][All Lists]
Advanced

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

[Gzz-commits] libvob/src/os Os-GLX.cxx


From: Tuukka Hastrup
Subject: [Gzz-commits] libvob/src/os Os-GLX.cxx
Date: Mon, 11 Aug 2003 18:26:09 -0400

CVSROOT:        /cvsroot/libvob
Module name:    libvob
Branch:         
Changes by:     Tuukka Hastrup <address@hidden> 03/08/11 18:26:09

Modified files:
        src/os         : Os-GLX.cxx 

Log message:
        tried to set a handler for X errors - can't figure why it isn't called

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/src/os/Os-GLX.cxx.diff?tr1=1.11&tr2=1.12&r1=text&r2=text

Patches:
Index: libvob/src/os/Os-GLX.cxx
diff -u libvob/src/os/Os-GLX.cxx:1.11 libvob/src/os/Os-GLX.cxx:1.12
--- libvob/src/os/Os-GLX.cxx:1.11       Wed Aug  6 04:04:56 2003
+++ libvob/src/os/Os-GLX.cxx    Mon Aug 11 18:26:09 2003
@@ -55,7 +55,16 @@
 
 #define BARF(m) { cerr << m << "\n"; exit(18); }
 
-
+int xerrorhandler(Display *dpy, XErrorEvent *xee) {
+    char buf[1024];
+    XGetErrorText(dpy, xee->error_code, buf, sizeof(buf));
+    std::cerr << "X Error: " << buf << "\n";
+    exit(10);
+}
+int xioerrorhandler(Display *dpy) {
+    std::cerr << "X IO Error on display: " << XDisplayName(NULL) << "\n";
+    exit(10);
+}
 
 namespace Vob {
 namespace Os {
@@ -199,7 +208,10 @@
            fcntl(interruptPipe[0], F_SETFL, O_NONBLOCK);
            fcntl(interruptPipe[1], F_SETFL, O_NONBLOCK);
 
-           if(!(dpy = XOpenDisplay( NULL ))) BARF("Can't start X");
+           if(!(dpy = XOpenDisplay( NULL ))) BARF("Couldn't open display");
+            XSetErrorHandler(xerrorhandler);
+            XSetIOErrorHandler(xioerrorhandler);
+
 
            FD_ZERO(&readFds);
            FD_SET(ConnectionNumber(dpy), &readFds);
@@ -301,7 +313,7 @@
        */
 
     private:
-       
+
     };
 
     // static char eventStringBuf[256];
@@ -380,6 +392,8 @@
        bool setCurrent() {
            DBG(dbg) << "setcurrent pbuf "<<pbuf<<" "<<ws->pbContext<<"\n";
            bool ret = glXMakeContextCurrent(ws->dpy, pbuf, pbuf, 
ws->pbContext);
+            if(!ret)
+                XSync(ws->dpy, False);
            DBG(dbg) << "setcurrent pbuf ret: "<<ret<<"\n";
            if(!ret) throw "Can't draw into pbuf";
            return ret;
@@ -412,6 +426,11 @@
            DBG(dbg) << "Pbuf alloc: "<<w<<" "<<h<<" "<<pbuf<<"\n";
            if(pbuf == 0) 
                return 0;
+            XVisualInfo *visinfo = glXGetVisualFromFBConfig(ws->dpy, 
ws->pbFbConfig[0]);
+            if (!visinfo) {
+                throw "No visinfo in pbuffer!";
+            }
+            XFree(visinfo);
            return new LXPBuffer(ws, pbuf, w, h);
     }
 




reply via email to

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