Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | Download | RSS feed

  1. #!/usr/local/bin/tcc -run -L/usr/X11R6/lib -lX11
  2. #include <stdlib.h>
  3. #include <stdio.h>
  4. #include <X11/Xlib.h>
  5.  
  6. /* Yes, TCC can use X11 too ! */
  7.  
  8. int main(int argc, char **argv)
  9. {
  10.     Display *display;
  11.     Screen *screen;
  12.  
  13.     display = XOpenDisplay("");
  14.     if (!display) {
  15.         fprintf(stderr, "Could not open X11 display\n");
  16.         exit(1);
  17.     }
  18.     printf("X11 display opened.\n");
  19.     screen = XScreenOfDisplay(display, 0);
  20.     printf("width = %d\nheight = %d\ndepth = %d\n",
  21.            screen->width,
  22.            screen->height,
  23.            screen->root_depth);
  24.     XCloseDisplay(display);
  25.     return 0;
  26. }
  27.