* RIP image expose callback. */ ARGSUSED*/
| 512 | */ |
| 513 | /*ARGSUSED*/ |
| 514 | static void |
| 515 | rip_exposed(Widget w, XtPointer client_data UNUSED, |
| 516 | XtPointer widget_data) /* expose event from Window widget */ |
| 517 | { |
| 518 | XExposeEvent *event = (XExposeEvent *) widget_data; |
| 519 | Display *dpy = XtDisplay(w); |
| 520 | Arg args[8]; |
| 521 | XGCValues values; |
| 522 | XtGCMask mask; |
| 523 | GC ggc; |
| 524 | static Pixmap rip_pixmap = None; |
| 525 | int i, x, y; |
| 526 | |
| 527 | if (!XtIsRealized(w) || event->count > 0) |
| 528 | return; |
| 529 | |
| 530 | if (rip_pixmap == None && rip_image) { |
| 531 | rip_pixmap = XCreatePixmap(dpy, XtWindow(w), rip_image->width, |
| 532 | rip_image->height, |
| 533 | DefaultDepth(dpy, DefaultScreen(dpy))); |
| 534 | XPutImage(dpy, rip_pixmap, DefaultGC(dpy, DefaultScreen(dpy)), |
| 535 | rip_image, 0, 0, 0, 0, /* src, dest top left */ |
| 536 | rip_image->width, rip_image->height); |
| 537 | XDestroyImage(rip_image); /* data bytes free'd also */ |
| 538 | } |
| 539 | |
| 540 | mask = GCFunction | GCForeground | GCGraphicsExposures | GCFont; |
| 541 | values.graphics_exposures = False; |
| 542 | XtSetArg(args[0], XtNforeground, &values.foreground); |
| 543 | XtGetValues(w, args, 1); |
| 544 | values.function = GXcopy; |
| 545 | values.font = WindowFont(w); |
| 546 | ggc = XtGetGC(w, mask, &values); |
| 547 | |
| 548 | if (rip_pixmap != None) { |
| 549 | XCopyArea(dpy, rip_pixmap, XtWindow(w), ggc, event->x, event->y, |
| 550 | event->width, event->height, event->x, event->y); |
| 551 | } |
| 552 | |
| 553 | x = appResources.tombtext_x; |
| 554 | y = appResources.tombtext_y; |
| 555 | for (i = 0; i <= YEAR_LINE; i++) { |
| 556 | int len = strlen(rip_line[i]); |
| 557 | XFontStruct *font = WindowFontStruct(w); |
| 558 | int width = XTextWidth(font, rip_line[i], len); |
| 559 | |
| 560 | XDrawString(dpy, XtWindow(w), ggc, x - width / 2, y, rip_line[i], len); |
| 561 | x += appResources.tombtext_dx; |
| 562 | y += appResources.tombtext_dy; |
| 563 | } |
| 564 | |
| 565 | XtReleaseGC(w, ggc); |
| 566 | } |
| 567 | |
| 568 | /* |
| 569 | * The ripout window creation routine. |
nothing calls this directly
no test coverage detected