On Thu, 12 Feb 2004, Rick Dempster wrote:

> Hi,
> 
> First question:  Am I in the right place.  I am trying to write a
> simple X Window program but XFee86 seems to focus on video cards or
> chips.  So, if I'm not in the right place please tell me where to go but
> not like my wife does.
> 
> If this is the place, I am starting into X Window programming and I
> can't even get the simplest program to run.  It compiles and links fine
> but always fails to make the connection to the display manager.  I have
> spent 2 days pouring over the internet and trying all sorts of stuff but
> nothing has worked.
> 
> I'm running RedHat 9.0 with XFree86 4.3 on an Intel clone.  Here is my
> program:
> 
> #include <stdio.h>
> #include <X11/X.h>
> #include <X11/Xlib.h>
> 
> /*************************MAIN******************************/
> int main(int argc, char *argv[]) {
>  
>   Display     *disp;
>   int         screen = -1;
> 
> //Open the X Windows Display
>   disp = XOpenDisplay("localhost:0.");
> 
>   if (disp == NULL){
>     printf("Error opening X Display");
>     return(-1);
>   }
>   screen = DefaultScreen(disp);
>   printf("The default screen is: %d \n",screen);
> 
>   if (disp) {
>     XCloseDisplay(disp);
>     disp = 0;
>   }
> }
> 
> 
> I have tried (NULL), ("Cody:0"), ("Cody:0.0") and ("Cody:0.1") as args
> to XOpenDisplay.  But it never returns any but NULL and I never get what
> the screen number is.  


   Generally, you pass NULL so it will read the connection from
the DISPLAY environment variable.  Most shells have this set to
a reasonable default like ":0.0" .  


                        Mark.


_______________________________________________
Devel mailing list
[EMAIL PROTECTED]
http://XFree86.Org/mailman/listinfo/devel

Reply via email to