Stdwin patches for X11R6

Rich Neitzel (thor@ymir.atd.ucar.edu)
26 May 1994 17:38:46 GMT

To get stdwin to build under X11R6 I had to make some fixes. They are
appended as a patch file.
-- 
Richard Neitzel thor@thor.atd.ucar.edu          Torren med sitt skjegg
National Center For Atmospheric Research        lokkar borni under sole-vegg
Box 3000 Boulder, CO 80307-3000	                Gjx'i med sitt shinn
303-497-2057                                    jagar borni inn.
-------------------------------------------------------------------
--- /scr/ymir/stdwin/Ports/x11/font.c   Fri Feb  5 09:39:00 1993
+++ ./Ports/x11/font.c  Tue May 24 10:33:34 1994
@@ -114,7 +114,12 @@
                }
        }
        if (stdfont.name == NULL) {
+#ifndef X11R6
                stdfont.info= XQueryFont(_wd, DefaultGCOfScreen(_ws)->gid);
+#else
+                stdfont.info=
+                    XQueryFont(_wd, XGContextFromGC(DefaultGCOfScreen(_ws)));
+#endif
                if (stdfont.info == NULL)
                        _wfatal("_winitfonts: no server default font");
                stdfont.info->fid= 0;
--- /scr/ymir/stdwin/Ports/x11/general.c        Mon Jun 22 08:05:02 1992
+++ ./Ports/x11/general.c       Tue May 24 11:06:42 1994
@@ -260,6 +260,9 @@
 winit()
 {
        char *value;
+#ifdef X11R6
+        XrmDatabase def_db;
+#endif        
 
        /* Call wargs() with dummy arguments if not already called */
 
@@ -324,8 +327,12 @@
           otherwise XGetDefault doesn't care to load the database.
           I assume that the command line options get higher priority
           than the user defaults in this way. */
-       
+#ifndef X11R6
        XrmMergeDatabases(db, &_wd->db);
+#else
+        def_db = XrmGetDatabase(_wd);
+        XrmMergeDatabases(db, &def_db);
+#endif
        db = NULL;
        
        /* Get the default screen (the only one we use) */
@@ -468,8 +475,12 @@
 {
        char namebuf[256], classnamebuf[256];
        register char *p;
-       
+
+#ifndef X11R6  
        p = getoption(_wd->db, name, classname);
+#else
+        p = getoption(XrmGetDatabase(_wd), name, classname);
+#endif
        if (p != NULL)
                return p;
        
@@ -486,7 +497,11 @@
        }
        _wdebug(1, "_wgetdefault(%s, %s): no luck, trying %s, %s",
                name, classname, namebuf, classnamebuf);
+#ifndef X11R6
        return getoption(_wd->db, namebuf, classnamebuf);
+#else
+        return getoption(XrmGetDatabase(_wd), namebuf, classnamebuf);
+#endif
 }
 
 /* Get a Boolean default.  May be 'on' or 'off', 'true' or 'false',
--- /scr/ymir/stdwin/Ports/x11/selection.c      Wed Apr  3 13:14:11 1991
+++ ./Ports/x11/selection.c     Tue May 24 11:17:04 1994
@@ -202,11 +202,22 @@
                        fd_set readfds;
                        struct timeval timeout;
                        int nfound;
+#ifdef X11R6
+                        int cfd = ConnectionNumber(_wd);
+#endif                        
                        FD_ZERO(&readfds);
+#ifdef X11R6
+                        FD_SET(cfd, &readfds);
+#else                        
                        FD_SET(_wd->fd, &readfds);
+#endif                        
                        timeout.tv_sec = 0;
                        timeout.tv_usec = 100000;
-                       nfound = select(_wd->fd+1, &readfds,
+#ifdef X11R6                        
+                       nfound = select(cfd+1, &readfds,
+#else
+                        nfound = select(_wd->fd+1, &readfds,
+#endif
                                (fd_set *)NULL, (fd_set *)NULL, &timeout);
                        if (nfound < 0)
                                _wwarning("select failed, errno %d", errno);
--- /scr/ymir/stdwin/Ports/x11/timer.c  Thu Oct 18 06:58:45 1990
+++ ./Ports/x11/timer.c Tue May 24 11:18:38 1994
@@ -160,7 +160,11 @@
                                tp->tv_sec == 0 && tp->tv_usec == 0 &&
                                dotimer(ep);
                }
+#ifndef X11R6                
                fd= _wd->fd;
+#else
+                fd= ConnectionNumber(_wd);
+#endif                
                rd= 1 << fd;
                nfd= fd+1;
 #ifdef PIPEHACK