1 /* 2 connect.c 3 4 Mike Hufnagel & Bill Kendrick 5 Last modified 11/17/95 (changed to return NULL on error) 6 */ 7 8 #include <X11/Xlib.h> 9 #include "connect.h" 10 ConnectToServer(char * display_name,int * screen,Window * rootwindow)11Display *ConnectToServer(char* display_name, int *screen, Window *rootwindow) 12 { 13 Display *display; 14 15 /* connect & check for problems */ 16 display = XOpenDisplay(display_name); 17 if (display != NULL) 18 { 19 /* get screen # */ 20 *screen = DefaultScreen(display); 21 22 /* get screens root window id */ 23 *rootwindow = RootWindow(display,*screen); 24 } 25 26 return(display); 27 } 28