home *** CD-ROM | disk | FTP | other *** search
- From: guido@cwi.nl (Guido van Rossum)
- Newsgroups: alt.sources
- Subject: STDWIN 0.9.6 patches, part 4/5
- Message-ID: <3650@charon.cwi.nl>
- Date: 7 Jun 91 13:32:07 GMT
-
- Archive-name: stdwin0.9.6/patch4
-
- *** 0.9.5/Ports/x11/event.c Thu Oct 18 13:58:41 1990
- --- stdwin/Ports/x11/event.c Tue May 28 23:04:26 1991
- ***************
- *** 98,106 ****
- for (;;) {
- if (_w_close_this != NULL) {
- /* WM_DELETE_WINDOW detected */
- ! ep->type = WE_COMMAND;
- ep->window = _w_close_this;
- - ep->u.command = WC_CLOSE;
- _w_close_this = NULL;
- break;
- }
- --- 98,105 ----
- for (;;) {
- if (_w_close_this != NULL) {
- /* WM_DELETE_WINDOW detected */
- ! ep->type = WE_CLOSE;
- ep->window = _w_close_this;
- _w_close_this = NULL;
- break;
- }
- *** 0.9.5/Ports/x11/general.c Thu Feb 28 10:42:43 1991
- --- stdwin/Ports/x11/general.c Mon Apr 15 22:36:37 1991
- ***************
- *** 133,141 ****
- --- 133,143 ----
- {"-iconmask", ".iconMask", XrmoptionSepArg, NULL},
-
- {"-menubackground", ".menuBackground", XrmoptionSepArg, NULL},
- + {"-menubg", ".menuBackground", XrmoptionSepArg, NULL},
- {"-menufont", ".menuFont", XrmoptionSepArg, NULL},
- {"-menufn", ".menuFont", XrmoptionSepArg, NULL},
- {"-menuforeground", ".menuForeground", XrmoptionSepArg, NULL},
- + {"-menufg", ".menuForeground", XrmoptionSepArg, NULL},
-
- {"-reversevideo", ".reverse", XrmoptionNoArg, "on"},
- {"-rv", ".reverse", XrmoptionNoArg, "on"},
- ***************
- *** 214,220 ****
- --- 216,224 ----
-
- if ((value= getoption(db, "debugLevel", "DebugLevel")) != NULL) {
- _wtracelevel= _wdebuglevel= atoi(value);
- + #ifndef SYSV
- setlinebuf(stderr);
- + #endif
- _wwarning("wargs: -debuglevel %d", _wdebuglevel, value);
- }
-
- ***************
- *** 340,345 ****
- --- 344,353 ----
- /* Initialize font list */
-
- _winitfonts();
- +
- + /* Initialize colors */
- +
- + _w_initcolors();
-
- #ifdef PIPEHACK
- /* Create the pipe used to communicate wungetevent calls
- ***************
- *** 482,488 ****
- int def;
- {
- register char *value;
- ! static struct flags {
- char *name;
- int value;
- };
- --- 490,496 ----
- int def;
- {
- register char *value;
- ! struct flags {
- char *name;
- int value;
- };
- *** 0.9.5/Ports/x11/llevent.c Thu Oct 18 13:58:43 1990
- --- stdwin/Ports/x11/llevent.c Tue May 28 23:03:37 1991
- ***************
- *** 276,282 ****
- if (!isdclick)
- _w_bs.clicks= 0;
- ++_w_bs.clicks;
- ! _w_bs.mask= e->state / Button1Mask; /* XXX */
- _w_bs.button= e->button;
- _w_bs.time= e->time;
- _w_bs.win= win;
- --- 276,282 ----
- if (!isdclick)
- _w_bs.clicks= 0;
- ++_w_bs.clicks;
- ! _w_bs.mask= e->state;
- _w_bs.button= e->button;
- _w_bs.time= e->time;
- _w_bs.win= win;
- ***************
- *** 312,318 ****
- _w_bs_changed= TRUE;
- }
- else {
- ! _w_bs.mask= e->state / Button1Mask; /* XXX */
- _w_bs.x= e->x;
- _w_bs.y= e->y;
- _w_bs.time= e->time;
- --- 312,318 ----
- _w_bs_changed= TRUE;
- }
- else {
- ! _w_bs.mask= e->state;
- _w_bs.x= e->x;
- _w_bs.y= e->y;
- _w_bs.time= e->time;
- *** 0.9.5/Ports/x11/menu.c Thu Oct 18 13:58:44 1990
- --- stdwin/Ports/x11/menu.c Tue May 28 23:04:00 1991
- ***************
- *** 224,230 ****
- int i;
- int x;
- int y;
- !
- _wmenusetup();
- x= titledist;
- y= baseline - 1 + (win->mbar.height - lineheight) / 2;
- --- 224,232 ----
- int i;
- int x;
- int y;
- !
- ! if (win->mbar.wid == None)
- ! return;
- _wmenusetup();
- x= titledist;
- y= baseline - 1 + (win->mbar.height - lineheight) / 2;
- ***************
- *** 440,447 ****
- XFlush(_wd); /* Show it right now */
- if (it >= 0) {
- if (mp->id == 0) {
- ! ep->type= WE_COMMAND;
- ! ep->u.command= WC_CLOSE;
- ep->window= win;
- }
- else {
- --- 442,448 ----
- XFlush(_wd); /* Show it right now */
- if (it >= 0) {
- if (mp->id == 0) {
- ! ep->type= WE_CLOSE;
- ep->window= win;
- }
- else {
- *** 0.9.5/Ports/x11/scroll.c Thu Oct 18 13:58:44 1990
- --- stdwin/Ports/x11/scroll.c Wed Apr 3 22:13:53 1991
- ***************
- *** 22,27 ****
- --- 22,29 ----
- _wdrawhbar(win)
- WINDOW *win;
- {
- + if (win->hbar.wid == None)
- + return;
- _wdebug(3, "draw hbar");
- XClearWindow(_wd, win->hbar.wid);
- if (win->doc.width > win->wi.width) {
- ***************
- *** 38,43 ****
- --- 40,47 ----
- _wdrawvbar(win)
- WINDOW *win;
- {
- + if (win->vbar.wid == None)
- + return;
- _wdebug(3, "draw vbar");
- XClearWindow(_wd, win->vbar.wid);
- if (win->doc.height > win->wi.height) {
- *** 0.9.5/Ports/x11/selection.c Sun Oct 21 13:02:31 1990
- --- stdwin/Ports/x11/selection.c Wed Apr 3 22:14:11 1991
- ***************
- *** 22,27 ****
- --- 22,31 ----
- #include "x11.h"
- #include "llevent.h" /* For _w_lasttime; */
-
- + #ifdef _IBMR2
- + #include <sys/select.h>
- + #endif
- +
-
- #ifndef AMOEBA
-
- *** 0.9.5/Ports/x11/window.c Thu Feb 28 10:42:44 1991
- --- stdwin/Ports/x11/window.c Tue May 28 23:02:48 1991
- ***************
- *** 14,22 ****
- #define TMARGIN 18
- #define RMARGIN 0
- #define BMARGIN 16
- - #define IMARGIN 2
-
-
- /* Event masks */
-
- /* Mask for 'wo' */
- --- 14,32 ----
- #define TMARGIN 18
- #define RMARGIN 0
- #define BMARGIN 16
-
- + #define IMARGIN 5 /* Extra left/right margin in inner window */
-
- +
- + /* Size of outer window border */
- +
- + #define OBORDER 2
- +
- +
- + /* XXX IMARGIN and OBORDER should be settable with properties and command
- + line options. Maybe the other margins as well. */
- +
- +
- /* Event masks */
-
- /* Mask for 'wo' */
- ***************
- *** 37,47 ****
-
- /* Private globals */
-
- ! static int def_h, def_v;
- ! static int def_width, def_height;
-
- ! #define DEF_WIDTH (def_width > 0 ? def_width : 80*wcharwidth('n'))
- ! #define DEF_HEIGHT (def_height > 0 ? def_height : 22*wlineheight())
-
-
- /* WINDOW list.
- --- 47,60 ----
-
- /* Private globals */
-
- ! static int def_h = 0, def_v = 0;
- ! static int def_width = 0, def_height = 0;
- ! static int def_hbar = 0;
- ! static int def_vbar = 1;
- ! static int def_mbar = 1;
-
- ! #define DEF_WIDTH (def_width > 0 ? def_width : 40*wtextwidth("in", 2))
- ! #define DEF_HEIGHT (def_height > 0 ? def_height : 24*wlineheight())
-
-
- /* WINDOW list.
- ***************
- *** 48,55 ****
- Each WINDOW must be registered here, so it can be found back
- by _whichwin */
-
- ! static WINDOW **winlist;
- ! static int nwins;
-
-
- /* Find a WINDOW pointer, given a Window.
- --- 61,68 ----
- Each WINDOW must be registered here, so it can be found back
- by _whichwin */
-
- ! static WINDOW **winlist = 0;
- ! static int nwins = 0;
-
-
- /* Find a WINDOW pointer, given a Window.
- ***************
- *** 62,71 ****
- {
- register int i;
-
- ! for (i= nwins; --i >= 0; ) {
- ! register WINDOW *win= winlist[i];
- register int j;
- ! for (j= NSUBS; --j >= 0; ) {
- if (w == win->subw[j].wid)
- return win;
- }
- --- 75,84 ----
- {
- register int i;
-
- ! for (i = nwins; --i >= 0; ) {
- ! register WINDOW *win = winlist[i];
- register int j;
- ! for (j = NSUBS; --j >= 0; ) {
- if (w == win->subw[j].wid)
- return win;
- }
- ***************
- *** 88,93 ****
- --- 101,107 ----
-
- /* Set the max size of windows created later (ignored for now) */
-
- + /*ARGSUSED*/
- void
- wsetmaxwinsize(width, height)
- int width, height;
- ***************
- *** 101,120 ****
- wsetdefwinsize(width, height)
- int width, height;
- {
- ! if (width <= 0)
- ! def_width= 0;
- ! else {
- ! CLIPMAX(width, WidthOfScreen(_ws) - 40 - LMARGIN - RMARGIN);
- ! CLIPMIN(width, 40);
- ! def_width= width;
- ! }
- ! if (height <= 0)
- ! def_height= 0;
- ! else {
- ! CLIPMAX(height, HeightOfScreen(_ws) - 40 - TMARGIN - BMARGIN);
- ! CLIPMIN(height, 40);
- ! def_height= height;
- ! }
- }
-
- void
- --- 115,122 ----
- wsetdefwinsize(width, height)
- int width, height;
- {
- ! def_width = width;
- ! def_height = height;
- }
-
- void
- ***************
- *** 132,141 ****
- wsetdefwinpos(h, v)
- int h, v;
- {
- ! CLIPMIN(h, 0);
- ! CLIPMIN(v, 0);
- ! def_h= h;
- ! def_v= v;
- }
-
- void
- --- 134,141 ----
- wsetdefwinpos(h, v)
- int h, v;
- {
- ! def_h = h;
- ! def_v = v;
- }
-
- void
- ***************
- *** 147,152 ****
- --- 147,171 ----
- }
-
-
- + /* Set the scroll bar options */
- +
- + void
- + wsetdefscrollbars(need_hbar, need_vbar)
- + int need_hbar, need_vbar;
- + {
- + def_hbar = need_hbar;
- + def_vbar = need_vbar;
- + }
- +
- + void
- + wgetdefscrollbars(phbar, pvbar)
- + int *phbar, *pvbar;
- + {
- + *phbar = def_hbar;
- + *pvbar = def_vbar;
- + }
- +
- +
- /* Read a Bitmap from a file and convert it to a Pixmap.
- XXX Actually I don't convert it to a Pixmap; this may mean that perhaps
- you won't be able to set an icon on a color display, depending
- ***************
- *** 165,171 ****
- unsigned int width, height;
- int xhot, yhot;
- Pixmap bitmap;
- ! int err= XReadBitmapFile(_wd, RootWindowOfScreen(_ws), filename,
- &width, &height, &bitmap, &xhot, &yhot);
- if (err != BitmapSuccess) {
- _wwarning("can't read bitmap file %s, error code %d",
- --- 184,190 ----
- unsigned int width, height;
- int xhot, yhot;
- Pixmap bitmap;
- ! int err = XReadBitmapFile(_wd, RootWindowOfScreen(_ws), filename,
- &width, &height, &bitmap, &xhot, &yhot);
- if (err != BitmapSuccess) {
- _wwarning("can't read bitmap file %s, error code %d",
- ***************
- *** 176,181 ****
- --- 195,204 ----
- }
-
-
- + /* Forward */
- + static bool _wmakesubwins _ARGS((WINDOW *win));
- +
- +
- /* Open a WINDOW.
- Some defaults should only be used for the first window opened,
- e.g., window geometry (otherwise all windows would overlay each other!)
- ***************
- *** 189,206 ****
- static bool used_defaults;
- WINDOW *win;
- XSizeHints sizehints;
-
- /* Allocate zeroed storage for the WINDOW structure
- and fill in the easy non-zero values */
- ! win= (WINDOW*) calloc(sizeof(WINDOW), 1);
- if (win == NULL) {
- _werror("wopen: can't alloc storage for window");
- return NULL;
- }
- ! win->drawproc= drawproc;
- ! win->careth= win->caretv= -1;
- ! win->attr= wattr;
- !
- /* Parse user-specified geometry default.
- This overrides what the application specified.
- Note that the x and y stored internally are exclusive or borders,
- --- 212,253 ----
- static bool used_defaults;
- WINDOW *win;
- XSizeHints sizehints;
- + char *geom;
-
- /* Allocate zeroed storage for the WINDOW structure
- and fill in the easy non-zero values */
- ! win = (WINDOW*) calloc(sizeof(WINDOW), 1);
- if (win == NULL) {
- _werror("wopen: can't alloc storage for window");
- return NULL;
- }
- ! win->drawproc = drawproc;
- ! win->careth = win->caretv = -1;
- ! win->attr = wattr;
- ! win->tmargin = def_mbar ? TMARGIN : 0;
- !
-