117
112
exh = expose->height;
121
XCopyArea(dpy, pix, win, gc, expose->x - g.repeat, expose->y,
123
expose->x,expose->y);
127
XCopyArea(dpy,pix,win,gc,expose->x,expose->y,
129
expose->x,expose->y);
114
XCopyArea(dpy,pix,win,gc,expose->x,expose->y,
116
expose->x,expose->y);
134
120
fprintf(stderr,"xmountains: unrecognized event %d\n",event.type);
135
121
/* XCloseDisplay(dpy);
185
171
XFreeColormap(dpy, map );
187
if((count = XPending(dpy)))
173
if( count = XPending(dpy) )
189
175
fprintf(stderr,"WARNING: %d events still pending\n",count);
223
209
/*{{{void init_graphics( ... )*/
224
void init_graphics( want_use_root, use_window, use_background, want_clear,gptr,red,green,blue )
210
void init_graphics( want_use_root, use_window, use_background, want_clear, s_graph_width,s_graph_height,ncol,red,green,blue )
226
211
int want_use_root; /* display on the root window */
227
212
Window use_window; /* display on external window */
228
213
int use_background; /* install the pixmap as the background-pixmap */
260
246
do_clear = want_clear;
261
247
use_root = want_use_root;
262
248
pixmap_installed = use_background;
263
graph_width = gptr->graph_width;
264
graph_height = gptr->graph_height;
249
graph_width = *s_graph_width;
250
graph_height = *s_graph_height;
265
251
/*{{{open display*/
267
253
dpy = XOpenDisplay(display);
282
268
depth = DefaultDepth(dpy,screen);
284
270
/*{{{set colormap*/
285
table = (XColor *)malloc(gptr->n_col * sizeof(XColor));
271
table=(XColor *)malloc(ncol * sizeof(XColor));
286
272
if( NULL == table )
288
274
fprintf(stderr,"malloc failed for colour table\n");
291
for(i = 0; i < gptr->n_col; i++)
277
for(i=0; i<ncol ; i++)
293
279
table[i].red = red[i];
294
280
table[i].green = green[i];
392
378
/* graph_width = DisplayWidth(dpy,screen); */
393
379
/* graph_height = DisplayHeight(dpy,screen); */
400
gptr->pixmap_width = graph_width - gptr->repeat;
401
bg_pix = XCreatePixmap(dpy, win, graph_width, graph_height, depth);
405
if(gptr->repeat == 0)
407
gptr->repeat = graph_width;
409
gptr->pixmap_width = graph_width + gptr->repeat;
414
gptr->pixmap_width = graph_width;
416
pix = XCreatePixmap(dpy, win, gptr->pixmap_width, graph_height, depth);
381
pix = XCreatePixmap(dpy,win,graph_width,graph_height,depth);
419
blank_region(0, 0, gptr->pixmap_width, graph_height);
384
blank_region(0,0,graph_width,graph_height);
421
386
if( use_background )
448
413
/* scroll the pixmap */
449
if( dist > g.pixmap_width )
414
if( dist > graph_width )
451
dist = g.pixmap_width;
455
420
/* copy the data */
456
XCopyArea(dpy, pix, pix, gc, 0, 0, g.pixmap_width - dist, graph_height, dist, 0);
421
XCopyArea(dpy,pix,pix,gc,0,0,graph_width-dist,graph_height,dist,0);
457
422
/* blank new region */
458
423
blank_region(0,0,dist,graph_height);
460
425
/* copy the data */
461
XCopyArea(dpy, pix, pix, gc, dist, 0, g.pixmap_width - dist, graph_height, 0, 0);
426
XCopyArea(dpy,pix,pix,gc,dist,0,graph_width-dist,graph_height,0,0);
462
427
/* blank new region */
463
blank_region(g.pixmap_width - dist, 0, dist, graph_height);
428
blank_region(graph_width-dist,0,dist,graph_height);
465
430
/* update the window to match */
466
431
if( pixmap_installed )
471
436
* so in principle we should re-install.
473
438
XSetWindowBackgroundPixmap(dpy,win,None);
477
XCopyArea(dpy, pix, bg_pix, gc, dist, 0, graph_width, graph_height, 0, 0);
478
XSetWindowBackgroundPixmap(dpy, win, bg_pix);
482
XSetWindowBackgroundPixmap(dpy,win,pix);
439
XSetWindowBackgroundPixmap(dpy,win,pix);
484
440
XClearWindow(dpy,win);
488
XCopyArea(dpy, pix, win, gc, dist, 0, graph_width, graph_height, 0, 0);
492
XCopyArea(dpy, pix, win, gc, 0, 0, graph_width, graph_height, 0, 0);
442
XCopyArea(dpy,pix,win,gc,0,0,graph_width,graph_height,0,0);
563
512
/* flush outstanding plots */
564
513
plot_pixel(-1,0,0);
567
XCopyArea(dpy,pix,win,gc,x,y,w,h,x,y);
514
XCopyArea(dpy,pix,win,gc,x,y,w,h,x,y);