home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / altsrcs / 2 / 2856 < prev    next >
Encoding:
Internet Message Format  |  1991-02-26  |  4.9 KB

  1. From: guido@cwi.nl (Guido van Rossum)
  2. Newsgroups: alt.sources
  3. Subject: stdwin temporary patch, and note
  4. Message-ID: <3020@charon.cwi.nl>
  5. Date: 25 Feb 91 16:02:28 GMT
  6.  
  7. There is a small problem with the stdwin 0.9.4 that I put on wuarchive
  8. (see announcement in alt.sources.d).  Programs called without any X
  9. options would not find resources specified in your .Xresources file.
  10. The diff below fixes this.
  11.  
  12. There is another problem with the distribution that is easier
  13. explained than fixed by patches: all calls to winitnew() in the test
  14. applications should really be calls to winitargs() with the same
  15. arguments.  (This shows how much I test before putting out a
  16. distribution. :-)
  17.  
  18. Finally, there is a section of code in window.c which doesn't compile
  19. on X11R3: it references PWinGravity and win_gravity which aren't
  20. defined in R3.  If this bites you, you can comment out this section
  21. with no bad conseqences.
  22.  
  23. --
  24. Guido van Rossum, CWI, Amsterdam <guido@cwi.nl>
  25. Honary Member, Royal Society for Putting Things on Top of Other Things
  26.  
  27. Here is the patch (use patch -p!):
  28.  
  29. *** .../stdwin-dist/stdwin/Ports/x11/general.c    Tue Feb 19 10:47:59 1991
  30. --- Ports/x11/general.c    Mon Feb 25 14:26:35 1991
  31. ***************
  32. *** 173,179 ****
  33.      You can also set the environment variable RESOURCE_NAME. */
  34.   
  35.   
  36. ! XrmDatabase db = NULL; /* Passed between wargs() and winit() */
  37.   
  38.   /* Part one of the initialization -- process command line arguments */
  39.   
  40. --- 173,180 ----
  41.      You can also set the environment variable RESOURCE_NAME. */
  42.   
  43.   
  44. ! static XrmDatabase db = NULL; /* Passed between wargs() and winit() */
  45. ! static int wargs_called; /* Set when wargs is called */
  46.   
  47.   /* Part one of the initialization -- process command line arguments */
  48.   
  49. ***************
  50. *** 185,190 ****
  51. --- 186,195 ----
  52.       char **argv= *pargv;
  53.       char *value;
  54.       
  55. +     if (wargs_called)
  56. +         _wfatal("wargs: called more than once");
  57. +     wargs_called = 1;
  58. +     
  59.       /* Get the program name (similar to basename(argv[0])) */
  60.       
  61.       if (*pargc > 0 && argv[0] != NULL && argv[0][0] != EOS) {
  62. ***************
  63. *** 254,273 ****
  64.   
  65.       /* Call wargs() with dummy arguments if not already called */
  66.   
  67. !     if (db == NULL) {
  68.           static char* def_args[]= {"stdwin", (char*)NULL};
  69.           int argc= 1;
  70.           char **argv= def_args;
  71.           wargs(&argc, &argv);
  72. !     }
  73.       
  74.       /* Open the display, die if we can't */
  75.       
  76.       _wd= XOpenDisplay(_wdisplayname);
  77.       if (_wd == NULL) {
  78. !         _wfatal("winit: can't open display (%s)",
  79. !             _wdisplayname ? _wdisplayname :
  80. !             getenv("DISPLAY") ? getenv("DISPLAY") : "<none>");
  81.       }
  82.       
  83.   #ifdef AMOEBA
  84. --- 259,279 ----
  85.   
  86.       /* Call wargs() with dummy arguments if not already called */
  87.   
  88. !     if (!wargs_called) {
  89.           static char* def_args[]= {"stdwin", (char*)NULL};
  90.           int argc= 1;
  91.           char **argv= def_args;
  92. +         _wdebug(0, "winit: wargs not called, faking argv[0]=stdwin");
  93.           wargs(&argc, &argv);
  94. !           }
  95.       
  96.       /* Open the display, die if we can't */
  97.       
  98.       _wd= XOpenDisplay(_wdisplayname);
  99.       if (_wd == NULL) {
  100. !       _wfatal("winit: can't open display (%s)",
  101. !           _wdisplayname ? _wdisplayname :
  102. !           getenv("DISPLAY") ? getenv("DISPLAY") : "<none>");
  103.       }
  104.       
  105.   #ifdef AMOEBA
  106. ***************
  107. *** 274,280 ****
  108.       /* Set the semaphore.  This must be done before doing anything
  109.          else with the connection. */
  110.       if (_wsema != NULL)
  111. !         XamSetSema(_wd, _wsema);
  112.   #endif
  113.       
  114.       /* Turn on synchronous mode if required.
  115. --- 280,286 ----
  116.       /* Set the semaphore.  This must be done before doing anything
  117.          else with the connection. */
  118.       if (_wsema != NULL)
  119. !       XamSetSema(_wd, _wsema);
  120.   #endif
  121.       
  122.       /* Turn on synchronous mode if required.
  123. ***************
  124. *** 282,288 ****
  125.          since some bugs disappear in synchronous mode! */
  126.       
  127.       if (getoption(db, "synchronous", "Synchronous") != NULL)
  128. !         XSynchronize(_wd, True);
  129.       
  130.       /* Call XGetDefault() once.  We don't use it to get our
  131.          defaults, since it doesn't let the caller specify the class
  132. --- 288,294 ----
  133.          since some bugs disappear in synchronous mode! */
  134.       
  135.       if (getoption(db, "synchronous", "Synchronous") != NULL)
  136. !       XSynchronize(_wd, True);
  137.       
  138.       /* Call XGetDefault() once.  We don't use it to get our
  139.          defaults, since it doesn't let the caller specify the class
  140. ***************
  141. *** 301,313 ****
  142.       
  143.       value= _wgetdefault("debugLevel", "DebugLevel");
  144.       if (value != 0) {
  145. !         int k= atoi(value);
  146. !         if (k > _wdebuglevel) {
  147. !             _wtracelevel= _wdebuglevel= k;
  148. !             _wdebug(1, "winit: new debuglevel %d (%s)",
  149. !                 _wdebuglevel, value);
  150. !             XSynchronize(_wd, True);
  151. !         }
  152.       }
  153.       
  154.       /* Merge the command line options with the defaults database.
  155. --- 307,319 ----
  156.       
  157.       value= _wgetdefault("debugLevel", "DebugLevel");
  158.       if (value != 0) {
  159. !       int k= atoi(value);
  160. !       if (k > _wdebuglevel) {
  161. !         _wtracelevel= _wdebuglevel= k;
  162. !         _wdebug(1, "winit: new debuglevel %d (%s)",
  163. !             _wdebuglevel, value);
  164. !         XSynchronize(_wd, True);
  165. !       }
  166.       }
  167.       
  168.       /* Merge the command line options with the defaults database.
  169.