[6487] in Athena Bugs

home help back first fref pref prev next nref lref last post

rt 7.2A: Xibm (apa16)

daemon@ATHENA.MIT.EDU (daemon@ATHENA.MIT.EDU)
Wed Nov 28 22:31:51 1990

Date: Wed, 28 Nov 90 22:31:32 -0500
From: "Jonathan I. Kamens" <jik@pit-manager.MIT.EDU>
To: bugs@ATHENA.MIT.EDU

System name:		pit-manager
Type and version:	RTPC-ROMPC 7.2A
Display type:		apa16
			megapel

What were you trying to do?
	Use the XDrawImageString with a GC with the same background
	and foreground color, drawing to a window on an APA16 monitor.
	The problem below should display a line of black-on-white
	text, and then an empty space, and then a line of
	white-on-black text, and then a black bar.

What's wrong:
	The APA16 device-dependent code barfs on a GC with the same
	background and foreground colors.  If I run the program
	included below, the second line displayed is white-on-black
	text instead of blank space, and the fourth line displayed is
	black-on-white text instead of a black bar.  The background
	component of the GC is being misinterpreted, apparently.

What should have happened:
	The program should have behaved as described in the "What were
	you trying to do?" rather than as it actually behaved.

Please describe any relevant documentation references:
	Note that if I run the server with -nohdwr, this problem does
	not manifest itself.  Note, further, that it does not manifest
	itself on the megapel display, the VAXstation 3100 standard
	display, or the DECstation 3100 standard display.

  jik

		      *************************

#include <X11/Xlib.h>
#include <X11/Xos.h>

main()
{
     Display *display;
     GC testGC;
     XGCValues GCvalues;
     Window window;
     int screen;
     unsigned long black, white;
     
     display = XOpenDisplay(0);
     screen = DefaultScreen(display);
     
     black = BlackPixel(display, screen);
     white = WhitePixel(display, screen);
     
     window = XCreateSimpleWindow(display, RootWindow(display, screen),
				  0, 0, (unsigned) 100, (unsigned) 250,
				  (unsigned) 1, black, white);

     XSetWindowBackground(display, window, white);

     XMapWindow(display, window);

     XFlush(display);
     
     sleep(5);
     
     GCvalues.foreground = black;
     GCvalues.background = white;
     GCvalues.font = XLoadFont(display, "fixed");
     
     testGC = XCreateGC(display, window,
			GCForeground|GCBackground|GCFont,
			&GCvalues);

     XDrawImageString(display, window, testGC, 0, 50,
		      "black on white", strlen("black on white"));

     XSetForeground(display, testGC, white);
     
     XDrawImageString(display, window, testGC, 0, 100,
		      "white on white", strlen("white on white"));

     XSetBackground(display, testGC, black);
     
     XDrawImageString(display, window, testGC, 0, 150,
		      "white on black", strlen("white on black"));

     XSetForeground(display, testGC, black);
     
     XDrawImageString(display, window, testGC, 0, 200,
		      "black on black", strlen("black on black"));

     XFlush(display);

     sleep(30);

     exit(0);
}


home help back first fref pref prev next nref lref last post