File: hardware.c

package info (click to toggle)
c-cpp-reference 2.0.2-6
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k, lenny
  • size: 8,012 kB
  • ctags: 4,612
  • sloc: ansic: 26,960; sh: 11,014; perl: 1,854; cpp: 1,324; asm: 1,239; python: 258; makefile: 115; java: 77; awk: 34; csh: 9
file content (63 lines) | stat: -rw-r--r-- 1,807 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/************************************************************************
 *
 * Purpose: Program extracts information from the X server and displays
 *          it on the screen.
 *
 * Notes:   Use the following command to compile. 
 *
 *                      gcc hardware.c -lX11
 *
 * Author:  M.J. Leslie
 *
 * Date:    26-Mar-95
 *
 ************************************************************************/

/****************** Includes ********************************************/
				/* These are in /usr/X386		*/
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xos.h>

#include <stdio.h>

main()
{
  Display * display;
  int       screen;
  char *    display_name=NULL;
  Window    root;
  Visual*   visual;

  /* Connect to X display server.		*/
  display=XOpenDisplay(display_name);

  /* Get screen ID			*/
  screen=DefaultScreen(display);


  printf("\n\tInformation extracted from the X server\n");
  printf("\t---------------------------------------\n\n");

  printf(" X server by \'%s\'\n",        ServerVendor(display));

  printf(" X Server protocol %d\n",      ProtocolVersion(display));

  printf(" X server Release %d\n",       VendorRelease(display));

  printf(" Screen is %dmm high.\n",      DisplayHeightMM(display, screen));

  printf(" Screen is %dmm wide.\n",      DisplayWidthMM(display, screen));

  printf(" Screen is %d pixels high.\n", DisplayHeight(display, screen));

  printf(" Screen is %d pixels wide.\n", DisplayWidth(display, screen));

  visual = DefaultVisual(display,screen);
  printf(" %3d Colour map entries", visual->map_entries);
  printf(" (Number of colours on the screen at one time).\n");

  printf(" %3d Display planes (bits per screen pixel).\n", DisplayPlanes(display, screen));

  printf(" There is %d screen(s).\n", ScreenCount (display));
}