tinycc/examples/ex4.c

27 lines
615 B
C
Raw Permalink Normal View History

#!/usr/local/bin/tcc -run -L/usr/X11R6/lib -lX11
2003-10-04 21:25:32 +00:00
#include <stdlib.h>
#include <stdio.h>
#include <X11/Xlib.h>
2009-04-18 12:31:35 +00:00
/* Yes, TCC can use X11 too ! */
2003-10-04 21:25:32 +00:00
int main(int argc, char **argv)
{
Display *display;
Screen *screen;
display = XOpenDisplay("");
if (!display) {
fprintf(stderr, "Could not open X11 display\n");
exit(1);
}
printf("X11 display opened.\n");
screen = XScreenOfDisplay(display, 0);
2009-04-18 12:31:35 +00:00
printf("width = %d\nheight = %d\ndepth = %d\n",
screen->width,
2003-10-04 21:25:32 +00:00
screen->height,
screen->root_depth);
XCloseDisplay(display);
return 0;
}