static SegState *state;
static SegmovfeatState *states_head;
static StartupState stastate;
-static Display *d;
+static Display *disp;
static oop_source_sys *sys_events;
-static Window w;
+static Window win;
static int redraw_needed_count, expose_count;
static Pixmap bg_pixmap;
static unsigned long train_pixel, owned_pixel;
}
src= 0;
XCALL( XCopyArea, "redraw",
- (d, bg_pixmap, w, fs->whole.gc,
+ (disp, bg_pixmap, win, fs->whole.gc,
fs->whole.x, fs->whole.y,
fs->whole.width, fs->whole.height,
fs->whole.x, fs->whole.y) );
if (fs->flags.on) {
src= &fs->posns[fs->posn][fs->flags.inv][fs->flags.det];
XCALL( XCopyArea, "redraw",
- (d, src->pm, w, fs->whole.gc,
+ (disp, src->pm, win, fs->whole.gc,
0,0, src->width, src->height,
src->x, src->y) );
}
if (fs->flags.trainown && src && src->edge.x >= 0) {
gcv.foreground= fs->flags.trainown>1 ? train_pixel : owned_pixel;
XCALL( XChangeGC, "train/own",
- (d, src->edge.gc, GCForeground, &gcv) );
+ (disp, src->edge.gc, GCForeground, &gcv) );
XCALL( XFillRectangle, "train/own",
- (d,w, src->edge.gc,
+ (disp, win, src->edge.gc,
src->edge.x, src->edge.y,
src->edge.width, src->edge.height) );
}
Status xst;
for (;;) {
- xst= XCheckIfEvent(d,&ev,evpredicate_always,0);
+ xst= XCheckIfEvent(disp,&ev,evpredicate_always,0);
if (!xst) {
if (!redraw_needed_count || expose_count)
return;
mattribs.colorsymbols= coloursymbols;
mattribs.numsymbols= sizeof(coloursymbols) / sizeof(*coloursymbols);
XPMCALL( XpmCreatePixmapFromData, "mask",
- (d,w, (char**)ppd->d, &pm,0, &mattribs) );
+ (disp,win, (char**)ppd->d, &pm,0, &mattribs) );
out->width= mattribs.width;
out->height= mattribs.height;
gcv->clip_x_origin= out->x;
gcv->clip_y_origin= out->y;
gcv->clip_mask= pm;
- out->gc= XCreateGC(d,w,
+ out->gc= XCreateGC(disp,win,
gcv_mask | GCClipXOrigin | GCClipYOrigin | GCClipMask,
gcv);
- XCALL( XFreePixmap, "mask", (d,pm) );
+ XCALL( XFreePixmap, "mask", (disp,pm) );
}
/*---------- stdin input handling ----------*/
}
}
- d= XOpenDisplay(0); if (!d) die("XOpenDisplay failed");
+ disp= XOpenDisplay(0); if (!disp) die("XOpenDisplay failed");
if (wspec==None) {
- w= XCreateSimpleWindow(d, DefaultRootWindow(d),
- 0,0, ui_plan_data.xsz, ui_plan_data.ysz,
- 0,0, 0);
- if (w == None) diex("XCreateSimpleWindow", "initial");
+ win= XCreateSimpleWindow(disp, DefaultRootWindow(disp),
+ 0,0, ui_plan_data.xsz, ui_plan_data.ysz,
+ 0,0, 0);
+ if (win == None) diex("XCreateSimpleWindow", "initial");
} else {
- w= wspec;
+ win= wspec;
}
- XCALL( XGetWindowAttributes, 0, (d,w,&wattribs) );
+ XCALL( XGetWindowAttributes, 0, (disp,win,&wattribs) );
XPMCALL( XpmCreatePixmapFromData, "background",
- (d,w, (char**)ui_plan_data.background, &bg_pixmap,0,0) );
+ (disp,win, (char**)ui_plan_data.background, &bg_pixmap,0,0) );
- XCALL( XSetWindowBackgroundPixmap, 0, (d,w,bg_pixmap) );
+ XCALL( XSetWindowBackgroundPixmap, 0, (disp,win,bg_pixmap) );
XCALL( XAllocNamedColor, "white",
- (d, wattribs.colormap, "#ffffff",
+ (disp, wattribs.colormap, "#ffffff",
&colour, &colour) );
train_pixel= colour.pixel;
XCALL( XAllocNamedColor, "owned",
- (d, wattribs.colormap, "#a0a0a0",
+ (disp, wattribs.colormap, "#a0a0a0",
&colour, &colour) );
owned_pixel= colour.pixel;
ps->y= ppdr->y;
mattribs.valuemask= 0;
XPMCALL( XpmCreatePixmapFromData, "main",
- (d,w,
+ (disp,win,
(char**)ppdr->d,
&ps->pm,
0, &mattribs) );
input_ifok,0, input_iferr,0);
if (oor) diee("oop_rd_read");
- events->on_fd(events, ConnectionNumber(d), OOP_READ, xlib_readable, 0);
- events->on_fd(events, ConnectionNumber(d), OOP_EXCEPTION, some_exception,
+ int fd= ConnectionNumber(disp);
+ events->on_fd(events, fd, OOP_READ, xlib_readable, 0);
+ events->on_fd(events, fd, OOP_EXCEPTION, some_exception,
(void*)"xserver connection");
- XCALL( XSelectInput, 0, (d,w, ExposureMask) );
+ XCALL( XSelectInput, 0, (disp,win, ExposureMask) );
if (wspec!=None) {
- XCALL( XClearArea, "initial", (d,w, 0,0,0,0, True) );
+ XCALL( XClearArea, "initial", (disp,win, 0,0,0,0, True) );
} else {
- XCALL( XMapWindow, 0, (d,w) );
+ XCALL( XMapWindow, 0, (disp,win) );
}
xlib_process();