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, 0xffff);
        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

Reply via email to