Date: Tue, 25 Mar 1997 20:17:50 -0600 From: Zach Heilig <zach@blizzard.gaffaneys.com> To: questions@freebsd.org Subject: X11 programming... Message-ID: <19970325201750.16289@gaffaneys.com>
next in thread | raw e-mail | index | archive | help
I know I should get a book, but I haven't figured out which of the available
books are good. Any hints here would be appreciated (cost isn't really a
very big issue; <= US$500 would be great).
So, I thought I would see how far I could go just reading the man pages.
Basically, I am just trying to get a window (white... or actually _any_
background) up on the screen. This is as far as I have gotten, but I just
can't seem to get the window to display. I don't get any compile errors or
run-time errors (anymore :-), but still I get nothing. I wonder what I am
missing?
/*
* xtest.c: testing X functions...
*/
#include <stdio.h>
#include <stdlib.h>
#include <sysexits.h>
#include <X11/Xlib.h>
int
main(void)
{
Display *disp;
Window root;
Window mainwin;
int scrn;
unsigned long black;
unsigned long white;
char *display;
display = getenv("DISPLAY");
if (!display)
display = ":0.0";
if (!(disp = XOpenDisplay(display))) {
fprintf(stderr, "Error: Could not open the '%s' display.\n", display);
exit(EX_UNAVAILABLE);
}
scrn = DefaultScreen(disp);
root = RootWindow(disp, scrn);
white = WhitePixel(disp, scrn);
black = BlackPixel(disp, scrn);
mainwin = XCreateSimpleWindow(disp, root, 10, 10, 150, 50, 2, white,
white);
XMapWindow(disp, mainwin);
sleep(5);
XCloseDisplay(disp);
return 0;
}
--
Zach Heilig (zach@blizzard.gaffaneys.com) | ALL unsolicited commercial email
/var/spool/news is 110% full, | is unwelcome. I avoid dealing
please delete all the spam you can. | with companies that email ads.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19970325201750.16289>
