Graphic dev with C - BSD

This is a discussion on Graphic dev with C - BSD ; Hello, i'd like to learn the graphic development under BSD, particulary freeBSD, with the C language. I know X11 is the standart window manager, so I suppose there's some API to use it with C right? I'm looking on google ...

+ Reply to Thread
Results 1 to 5 of 5

Thread: Graphic dev with C

  1. Graphic dev with C

    Hello,
    i'd like to learn the graphic development under BSD, particulary
    freeBSD, with the C language.
    I know X11 is the standart window manager, so I suppose there's some
    API to use it with C right?
    I'm looking on google but can't find some tutorial, infos, etc. about
    "how to create a simple window", I'm pretty good with C under windows
    but still a newbie in Unix programing, so could you explain me if
    there are some dependencies to download to make such a program? I just
    have the standart X11 installed (basic CD installation) and I suppose
    it's not enough to develop my own tools...
    thanks for helping!


  2. Re: Graphic dev with C

    m.impini@gmail.com wrote:

    > Hello,
    > i'd like to learn the graphic development under BSD, particulary
    > freeBSD, with the C language.
    > I know X11 is the standart window manager, so I suppose there's some
    > API to use it with C right?
    > I'm looking on google but can't find some tutorial, infos, etc. about
    > "how to create a simple window", I'm pretty good with C under windows
    > but still a newbie in Unix programing, so could you explain me if
    > there are some dependencies to download to make such a program? I just
    > have the standart X11 installed (basic CD installation) and I suppose
    > it's not enough to develop my own tools...
    > thanks for helping!


    If you want to learn the low level X window programming (very painful) the
    proper reference is the O'Reilly book
    XLIB Programming Manual, Rel. 5, Third Edition
    This sort of low level X is quite similar with similar low level Microsoft
    Windows programming, as far as i remember many years ago.

    If you want the quick and easy modern programming with a toolkit, you have
    to choose one, Qt or Gtk. In particular Qt is very well documented
    http://doc.trolltech.com/
    there is a graphical wizard to create applications, qtdesigner, and bindings
    to high level languages such as python which allow to create simple
    applications in no time
    http://www.commandprompt.com/communi.../x1067#AEN1087


  3. Re: Graphic dev with C

    m.impini@gmail.com wrote:
    > i'd like to learn the graphic development under BSD, particulary freeBSD,
    > with the C language.


    Welcome!

    > I know X11 is the standart window manager, so I suppose there's some API to
    > use it with C right?


    X11 is not a window manager, it is a windowing system and a protocol (and a
    nightmare, among other things). There are a number of libraries that you can
    use to access it. If you like pain, you can use Xlib, perhaps together with
    Xt or Xaw and Motif to make it somewhat more bearable. Alternatively, you
    could use GTK, which is a more "modern" toolkit to talk with X11.

    > I'm looking on google but can't find some tutorial, infos, etc. about "how
    > to create a simple window"


    #include

    #include

    int
    main(void)
    {
    Display *disp;
    Window win;
    XEvent evt;
    int scr;

    disp = XOpenDisplay(NULL);
    if (disp == NULL) {
    printf("Waargh\n");
    return (-1);
    }

    scr = DefaultScreen(disp);

    win = XCreateSimpleWindow(disp, RootWindow(disp, scr),
    0, 0, 512, 256, 1,
    BlackPixel(disp, scr), WhitePixel(disp, scr));

    XSelectInput(disp, win, KeyPressMask);
    XMapWindow(disp, win);

    do
    XNextEvent(disp, &evt);
    while (evt.type != KeyPress);

    XCloseDisplay(disp);

    return (0);
    }

    gcc -I/usr/X11R6/include -L/usr/X11R6/lib -o foo foo.c -lX11

    > I'm pretty good with C under windows but still a newbie in Unix programing,
    > so could you explain me if there are some dependencies to download to make
    > such a program? I just have the standart X11 installed (basic CD
    > installation) and I suppose it's not enough to develop my own tools...


    You will probably want to install a friendlier toolkit like GTK or Motif or
    something. Though playing with Xlib directly can be quite instructive if
    you've not afraid of such things.

    - Philip

    --
    Philip Paeps Please don't email any replies
    philip@paeps.cx I follow the newsgroup.

    The simpler the instruction, e.g. "press here", the
    more difficult it will be to open the package.

  4. Re: Graphic dev with C

    In article <1175543288.023222.196300@q75g2000hsh.googlegroups. com>,
    wrote:
    >
    >
    >Hello,
    >i'd like to learn the graphic development under BSD, particulary
    >freeBSD, with the C language.
    >I know X11 is the standart window manager, so I suppose there's some
    >API to use it with C right?
    >I'm looking on google but can't find some tutorial, infos, etc. about
    >"how to create a simple window", I'm pretty good with C under windows
    >but still a newbie in Unix programing, so could you explain me if
    >there are some dependencies to download to make such a program? I just
    >have the standart X11 installed (basic CD installation) and I suppose
    >it's not enough to develop my own tools...
    >thanks for helping!
    >


    Xlib is the low-level API, but veeeeeery painful. Whenever I need to
    go a GUI, I use Tcl/Tk, which is a scripted language, but lets you
    go down to C whenever you need to.

    Ted

  5. Re: Graphic dev with C

    m.impini@gmail.com wrote:
    > I know X11 is the standart window manager, so I suppose there's some
    > API to use it with C right?


    X11 is not a window manager. X11 is a windowing system. A window manager
    is a client of the X11 server.

    I suggest you have a lot of reading to do before you start programming.

    pete
    --
    pete@fenelon.com "how many clever men have called the sun a fool?"

+ Reply to Thread