home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / altsrcs / 3 / 3469 < prev    next >
Internet Message Format  |  1991-06-07  |  11KB

  1. From: guido@cwi.nl (Guido van Rossum)
  2. Newsgroups: alt.sources
  3. Subject: STDWIN 0.9.6 patches, part 4/5
  4. Message-ID: <3650@charon.cwi.nl>
  5. Date: 7 Jun 91 13:32:07 GMT
  6.  
  7. Archive-name: stdwin0.9.6/patch4
  8.  
  9. *** 0.9.5/Ports/x11/event.c    Thu Oct 18 13:58:41 1990
  10. --- stdwin/Ports/x11/event.c    Tue May 28 23:04:26 1991
  11. ***************
  12. *** 98,106 ****
  13.       for (;;) {
  14.           if (_w_close_this != NULL) {
  15.               /* WM_DELETE_WINDOW detected */
  16. !             ep->type = WE_COMMAND;
  17.               ep->window = _w_close_this;
  18. -             ep->u.command = WC_CLOSE;
  19.               _w_close_this = NULL;
  20.               break;
  21.           }
  22. --- 98,105 ----
  23.       for (;;) {
  24.           if (_w_close_this != NULL) {
  25.               /* WM_DELETE_WINDOW detected */
  26. !             ep->type = WE_CLOSE;
  27.               ep->window = _w_close_this;
  28.               _w_close_this = NULL;
  29.               break;
  30.           }
  31. *** 0.9.5/Ports/x11/general.c    Thu Feb 28 10:42:43 1991
  32. --- stdwin/Ports/x11/general.c    Mon Apr 15 22:36:37 1991
  33. ***************
  34. *** 133,141 ****
  35. --- 133,143 ----
  36.   {"-iconmask",        ".iconMask",        XrmoptionSepArg, NULL},
  37.   
  38.   {"-menubackground",    ".menuBackground",    XrmoptionSepArg, NULL},
  39. + {"-menubg",        ".menuBackground",    XrmoptionSepArg, NULL},
  40.   {"-menufont",        ".menuFont",        XrmoptionSepArg, NULL},
  41.   {"-menufn",        ".menuFont",        XrmoptionSepArg, NULL},
  42.   {"-menuforeground",    ".menuForeground",    XrmoptionSepArg, NULL},
  43. + {"-menufg",        ".menuForeground",    XrmoptionSepArg, NULL},
  44.   
  45.   {"-reversevideo",    ".reverse",        XrmoptionNoArg,  "on"},
  46.   {"-rv",            ".reverse",        XrmoptionNoArg,  "on"},
  47. ***************
  48. *** 214,220 ****
  49. --- 216,224 ----
  50.       
  51.       if ((value= getoption(db, "debugLevel", "DebugLevel")) != NULL) {
  52.           _wtracelevel= _wdebuglevel= atoi(value);
  53. + #ifndef SYSV
  54.           setlinebuf(stderr);
  55. + #endif
  56.           _wwarning("wargs: -debuglevel %d", _wdebuglevel, value);
  57.       }
  58.       
  59. ***************
  60. *** 340,345 ****
  61. --- 344,353 ----
  62.       /* Initialize font list */
  63.       
  64.       _winitfonts();
  65. +     /* Initialize colors */
  66. +     _w_initcolors();
  67.       
  68.   #ifdef PIPEHACK
  69.       /* Create the pipe used to communicate wungetevent calls
  70. ***************
  71. *** 482,488 ****
  72.       int def;
  73.   {
  74.       register char *value;
  75. !     static struct flags {
  76.           char *name;
  77.           int value;
  78.       };
  79. --- 490,496 ----
  80.       int def;
  81.   {
  82.       register char *value;
  83. !     struct flags {
  84.           char *name;
  85.           int value;
  86.       };
  87. *** 0.9.5/Ports/x11/llevent.c    Thu Oct 18 13:58:43 1990
  88. --- stdwin/Ports/x11/llevent.c    Tue May 28 23:03:37 1991
  89. ***************
  90. *** 276,282 ****
  91.               if (!isdclick)
  92.                   _w_bs.clicks= 0;
  93.               ++_w_bs.clicks;
  94. !             _w_bs.mask= e->state / Button1Mask; /* XXX */
  95.               _w_bs.button= e->button;
  96.               _w_bs.time= e->time;
  97.               _w_bs.win= win;
  98. --- 276,282 ----
  99.               if (!isdclick)
  100.                   _w_bs.clicks= 0;
  101.               ++_w_bs.clicks;
  102. !             _w_bs.mask= e->state;
  103.               _w_bs.button= e->button;
  104.               _w_bs.time= e->time;
  105.               _w_bs.win= win;
  106. ***************
  107. *** 312,318 ****
  108.               _w_bs_changed= TRUE;
  109.           }
  110.           else {
  111. !             _w_bs.mask= e->state / Button1Mask; /* XXX */
  112.               _w_bs.x= e->x;
  113.               _w_bs.y= e->y;
  114.               _w_bs.time= e->time;
  115. --- 312,318 ----
  116.               _w_bs_changed= TRUE;
  117.           }
  118.           else {
  119. !             _w_bs.mask= e->state;
  120.               _w_bs.x= e->x;
  121.               _w_bs.y= e->y;
  122.               _w_bs.time= e->time;
  123. *** 0.9.5/Ports/x11/menu.c    Thu Oct 18 13:58:44 1990
  124. --- stdwin/Ports/x11/menu.c    Tue May 28 23:04:00 1991
  125. ***************
  126. *** 224,230 ****
  127.       int i;
  128.       int x;
  129.       int y;
  130. !     
  131.       _wmenusetup();
  132.       x= titledist;
  133.       y= baseline - 1 + (win->mbar.height - lineheight) / 2;
  134. --- 224,232 ----
  135.       int i;
  136.       int x;
  137.       int y;
  138. !     if (win->mbar.wid == None)
  139. !         return;
  140.       _wmenusetup();
  141.       x= titledist;
  142.       y= baseline - 1 + (win->mbar.height - lineheight) / 2;
  143. ***************
  144. *** 440,447 ****
  145.           XFlush(_wd); /* Show it right now */
  146.           if (it >= 0) {
  147.               if (mp->id == 0) {
  148. !                 ep->type= WE_COMMAND;
  149. !                 ep->u.command= WC_CLOSE;
  150.                   ep->window= win;
  151.               }
  152.               else {
  153. --- 442,448 ----
  154.           XFlush(_wd); /* Show it right now */
  155.           if (it >= 0) {
  156.               if (mp->id == 0) {
  157. !                 ep->type= WE_CLOSE;
  158.                   ep->window= win;
  159.               }
  160.               else {
  161. *** 0.9.5/Ports/x11/scroll.c    Thu Oct 18 13:58:44 1990
  162. --- stdwin/Ports/x11/scroll.c    Wed Apr  3 22:13:53 1991
  163. ***************
  164. *** 22,27 ****
  165. --- 22,29 ----
  166.   _wdrawhbar(win)
  167.       WINDOW *win;
  168.   {
  169. +     if (win->hbar.wid == None)
  170. +         return;
  171.       _wdebug(3, "draw hbar");
  172.       XClearWindow(_wd, win->hbar.wid);
  173.       if (win->doc.width > win->wi.width) {
  174. ***************
  175. *** 38,43 ****
  176. --- 40,47 ----
  177.   _wdrawvbar(win)
  178.       WINDOW *win;
  179.   {
  180. +     if (win->vbar.wid == None)
  181. +         return;
  182.       _wdebug(3, "draw vbar");
  183.       XClearWindow(_wd, win->vbar.wid);
  184.       if (win->doc.height > win->wi.height) {
  185. *** 0.9.5/Ports/x11/selection.c    Sun Oct 21 13:02:31 1990
  186. --- stdwin/Ports/x11/selection.c    Wed Apr  3 22:14:11 1991
  187. ***************
  188. *** 22,27 ****
  189. --- 22,31 ----
  190.   #include "x11.h"
  191.   #include "llevent.h" /* For _w_lasttime; */
  192.   
  193. + #ifdef _IBMR2
  194. + #include <sys/select.h>
  195. + #endif
  196.   
  197.   #ifndef AMOEBA
  198.   
  199. *** 0.9.5/Ports/x11/window.c    Thu Feb 28 10:42:44 1991
  200. --- stdwin/Ports/x11/window.c    Tue May 28 23:02:48 1991
  201. ***************
  202. *** 14,22 ****
  203.   #define TMARGIN        18
  204.   #define RMARGIN        0
  205.   #define BMARGIN        16
  206. - #define IMARGIN        2
  207.   
  208.   
  209.   /* Event masks */
  210.   
  211.   /* Mask for 'wo' */
  212. --- 14,32 ----
  213.   #define TMARGIN        18
  214.   #define RMARGIN        0
  215.   #define BMARGIN        16
  216.   
  217. + #define IMARGIN        5    /* Extra left/right margin in inner window */
  218.   
  219. + /* Size of outer window border */
  220. + #define OBORDER        2
  221. + /* XXX IMARGIN and OBORDER should be settable with properties and command
  222. +    line options.  Maybe the other margins as well. */
  223.   /* Event masks */
  224.   
  225.   /* Mask for 'wo' */
  226. ***************
  227. *** 37,47 ****
  228.       
  229.   /* Private globals */
  230.   
  231. ! static int def_h, def_v;
  232. ! static int def_width, def_height;
  233.   
  234. ! #define DEF_WIDTH (def_width > 0 ? def_width : 80*wcharwidth('n'))
  235. ! #define DEF_HEIGHT (def_height > 0 ? def_height : 22*wlineheight())
  236.   
  237.   
  238.   /* WINDOW list.
  239. --- 47,60 ----
  240.       
  241.   /* Private globals */
  242.   
  243. ! static int def_h = 0, def_v = 0;
  244. ! static int def_width = 0, def_height = 0;
  245. ! static int def_hbar = 0;
  246. ! static int def_vbar = 1;
  247. ! static int def_mbar = 1;
  248.   
  249. ! #define DEF_WIDTH (def_width > 0 ? def_width : 40*wtextwidth("in", 2))
  250. ! #define DEF_HEIGHT (def_height > 0 ? def_height : 24*wlineheight())
  251.   
  252.   
  253.   /* WINDOW list.
  254. ***************
  255. *** 48,55 ****
  256.      Each WINDOW must be registered here, so it can be found back
  257.      by _whichwin */
  258.   
  259. ! static WINDOW **winlist;
  260. ! static int nwins;
  261.   
  262.   
  263.   /* Find a WINDOW pointer, given a Window.
  264. --- 61,68 ----
  265.      Each WINDOW must be registered here, so it can be found back
  266.      by _whichwin */
  267.   
  268. ! static WINDOW **winlist = 0;
  269. ! static int nwins = 0;
  270.   
  271.   
  272.   /* Find a WINDOW pointer, given a Window.
  273. ***************
  274. *** 62,71 ****
  275.   {
  276.       register int i;
  277.       
  278. !     for (i= nwins; --i >= 0; ) {
  279. !         register WINDOW *win= winlist[i];
  280.           register int j;
  281. !         for (j= NSUBS; --j >= 0; ) {
  282.               if (w == win->subw[j].wid)
  283.                   return win;
  284.           }
  285. --- 75,84 ----
  286.   {
  287.       register int i;
  288.       
  289. !     for (i = nwins; --i >= 0; ) {
  290. !         register WINDOW *win = winlist[i];
  291.           register int j;
  292. !         for (j = NSUBS; --j >= 0; ) {
  293.               if (w == win->subw[j].wid)
  294.                   return win;
  295.           }
  296. ***************
  297. *** 88,93 ****
  298. --- 101,107 ----
  299.   
  300.   /* Set the max size of windows created later (ignored for now) */
  301.   
  302. + /*ARGSUSED*/
  303.   void
  304.   wsetmaxwinsize(width, height)
  305.       int width, height;
  306. ***************
  307. *** 101,120 ****
  308.   wsetdefwinsize(width, height)
  309.       int width, height;
  310.   {
  311. !     if (width <= 0)
  312. !         def_width= 0;
  313. !     else {
  314. !         CLIPMAX(width, WidthOfScreen(_ws) - 40 - LMARGIN - RMARGIN);
  315. !         CLIPMIN(width, 40);
  316. !         def_width= width;
  317. !     }
  318. !     if (height <= 0)
  319. !         def_height= 0;
  320. !     else {
  321. !         CLIPMAX(height, HeightOfScreen(_ws) - 40 - TMARGIN - BMARGIN);
  322. !         CLIPMIN(height, 40);
  323. !         def_height= height;
  324. !     }
  325.   }
  326.   
  327.   void
  328. --- 115,122 ----
  329.   wsetdefwinsize(width, height)
  330.       int width, height;
  331.   {
  332. !     def_width = width;
  333. !     def_height = height;
  334.   }
  335.   
  336.   void
  337. ***************
  338. *** 132,141 ****
  339.   wsetdefwinpos(h, v)
  340.       int h, v;
  341.   {
  342. !     CLIPMIN(h, 0);
  343. !     CLIPMIN(v, 0);
  344. !     def_h= h;
  345. !     def_v= v;
  346.   }
  347.   
  348.   void
  349. --- 134,141 ----
  350.   wsetdefwinpos(h, v)
  351.       int h, v;
  352.   {
  353. !     def_h = h;
  354. !     def_v = v;
  355.   }
  356.   
  357.   void
  358. ***************
  359. *** 147,152 ****
  360. --- 147,171 ----
  361.   }
  362.   
  363.   
  364. + /* Set the scroll bar options */
  365. + void
  366. + wsetdefscrollbars(need_hbar, need_vbar)
  367. +     int need_hbar, need_vbar;
  368. + {
  369. +     def_hbar = need_hbar;
  370. +     def_vbar = need_vbar;
  371. + }
  372. + void
  373. + wgetdefscrollbars(phbar, pvbar)
  374. +     int *phbar, *pvbar;
  375. + {
  376. +     *phbar = def_hbar;
  377. +     *pvbar = def_vbar;
  378. + }
  379.   /* Read a Bitmap from a file and convert it to a Pixmap.
  380.      XXX Actually I don't convert it to a Pixmap; this may mean that perhaps
  381.      you won't be able to set an icon on a color display, depending
  382. ***************
  383. *** 165,171 ****
  384.       unsigned int width, height;
  385.       int xhot, yhot;
  386.       Pixmap bitmap;
  387. !     int err= XReadBitmapFile(_wd, RootWindowOfScreen(_ws), filename,
  388.           &width, &height, &bitmap, &xhot, &yhot);
  389.       if (err != BitmapSuccess) {
  390.           _wwarning("can't read bitmap file %s, error code %d",
  391. --- 184,190 ----
  392.       unsigned int width, height;
  393.       int xhot, yhot;
  394.       Pixmap bitmap;
  395. !     int err = XReadBitmapFile(_wd, RootWindowOfScreen(_ws), filename,
  396.           &width, &height, &bitmap, &xhot, &yhot);
  397.       if (err != BitmapSuccess) {
  398.           _wwarning("can't read bitmap file %s, error code %d",
  399. ***************
  400. *** 176,181 ****
  401. --- 195,204 ----
  402.   }
  403.   
  404.   
  405. + /* Forward */
  406. + static bool _wmakesubwins _ARGS((WINDOW *win));
  407.   /* Open a WINDOW.
  408.      Some defaults should only be used for the first window opened,
  409.      e.g., window geometry (otherwise all windows would overlay each other!)
  410. ***************
  411. *** 189,206 ****
  412.       static bool used_defaults;
  413.       WINDOW *win;
  414.       XSizeHints sizehints;
  415.       
  416.       /* Allocate zeroed storage for the WINDOW structure
  417.          and fill in the easy non-zero values */
  418. !     win= (WINDOW*) calloc(sizeof(WINDOW), 1);
  419.       if (win == NULL) {
  420.           _werror("wopen: can't alloc storage for window");
  421.           return NULL;
  422.       }
  423. !     win->drawproc= drawproc;
  424. !     win->careth= win->caretv= -1;
  425. !     win->attr= wattr;
  426. !     
  427.       /* Parse user-specified geometry default.
  428.          This overrides what the application specified.
  429.          Note that the x and y stored internally are exclusive or borders,
  430. --- 212,253 ----
  431.       static bool used_defaults;
  432.       WINDOW *win;
  433.       XSizeHints sizehints;
  434. +     char *geom;
  435.       
  436.       /* Allocate zeroed storage for the WINDOW structure
  437.          and fill in the easy non-zero values */
  438. !     win = (WINDOW*) calloc(sizeof(WINDOW), 1);
  439.       if (win == NULL) {
  440.           _werror("wopen: can't alloc storage for window");
  441.           return NULL;
  442.       }
  443. !     win->drawproc = drawproc;
  444. !     win->careth = win->caretv = -1;
  445. !     win->attr = wattr;
  446. !     win->tmargin = def_mbar ? TMARGIN : 0;
  447. !
  448.