TRANLE@INTELLICORP.COM (Minh Tran-Le) (03/17/90)
I am using the R4 server on the PS2 running AIX and the following code
does not seem to work correctly. Does anybody has a fix or workaround
for it ?
Thanks, Minh Tran-Le
Arpanet: tranle@intellicorp.com
uucp: ..sun!icmv!mtranle
/* ------------------------------------------------------------------------- */
#include <stdio.h>
#include <X11/Xos.h>
#include <X11/Xatom.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
/*
* This small program reproduce a bug in the IBM PS2 X server:
* when you use XDrawImageString to a pixmap the server
* will write directly to the screen.
*
* to compile it:
* cc -o xbug xbug.c -lX11
*/
main()
{
Display *dpy;
int screen;
GC gc;
Pixmap pix;
Window w;
XGCValues xgcv;
XSetWindowAttributes xswa;
char *str = "This is the string to print";
dpy = XOpenDisplay("");
screen = DefaultScreen(dpy);
pix = XCreatePixmap(dpy, RootWindow(dpy, screen),
100, 100, /* width and height */
8); /* depth */
xgcv.foreground = BlackPixel(dpy,screen);
xgcv.background = WhitePixel(dpy,screen);
gc = XCreateGC(dpy, pix,
GCForeground|GCBackground,
&xgcv);
/*
* write the string to the pixmap at 20,20
*/
XDrawImageString(dpy, pix, gc, 20, 20,
str, strlen(str));
/* flush output queue */
XSync(dpy,False);
printf("You should not have seen anything written on your screen\n");
sleep(5);
exit(0);
}
/* ------------------------------------------------------------------------- */
-------