Re: XOpenDisplay for new X Windows Programmer.

2004-02-13 Thread Rick Beldin
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.
Probably not the right place.  I'm not sure but perhaps some newsgroup
like linux.dev.X11 or comp.programming.X (not sure about this one).
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.
Don't hardcode in the string to XOpenDisplay().  Pass a NULL, and it
will use value of DISPLAY environment.   I think it is probably trying
to specifically connection to port 6000 on localhost, which on your system
X may not be listening.
Your program doesn't try to create any windows.

Here is a skeleton that I use to start all my test programs:

#include X11/Xlib.h
#include X11/Xatom.h
#include stdio.h


void main(int argc, char *argv[])
{
Display *display;
Window my_window;
int screen;
XEvent event;
display = XOpenDisplay(NULL);
if (display == NULL)
{
printf(error opening display\n);
exit(0);
}
screen = DefaultScreen(display);
XSynchronize(display, 1);
my_window =
XCreateSimpleWindow(display,
   RootWindow(display,screen),
   100,100,
   100,100,
   10,
   BlackPixel(display,screen),
   WhitePixel(display,screen));
XSelectInput(display, my_window, 0x);
XMapWindow(display,my_window);
XFlush(display);
while (1)
{
XNextEvent(display,event);
printf(Event recieved is %d\n,event.type);
}
}

--
+--+
| Rick Beldin|  Hewlett-Packard Company|
||  Global Solutions Engineering   |
||  20 Perimeter Summit|
||  Atlanta, GA 30319  |
+--+
___
Devel mailing list
[EMAIL PROTECTED]
http://XFree86.Org/mailman/listinfo/devel


XOpenDisplay for new X Windows Programmer.

2004-02-12 Thread Rick Dempster
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.  

I'm starting to think it's a RedHat problem or an enviroment problem. 
I also have xhost + set.

So at this point I am very frustrated with X Windows! :)

Thanks is advance to all.

Sincerely,
Rick Dempster
___
Devel mailing list
[EMAIL PROTECTED]
http://XFree86.Org/mailman/listinfo/devel


Re: XOpenDisplay for new X Windows Programmer.

2004-02-12 Thread Mark Vojkovich
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