Baby X - new project

Discussion in 'C Programming' started by Malcolm McLean, Jul 25, 2013.

  1. The absolute basic interface would go something like

    int openwindow(int requestwidth, int requestheight, int *givenwidth, int *givenheight);
    void drawpixel(int x, int y, int r, int g, int b);
    int querymouse(int *x, int *y, int *buttons);
    int querykeyboard(KEYBOARD *pressed)
    int iskeypressed(KEYBOARD *keys, int ch);

    It might be an idea to provide that, and then build eveything else on top of it.
    Malcolm McLean, Jul 27, 2013
    1. Advertisements

  2. Malcolm McLean

    Ian Collins Guest

    So you are aiming at the same level as XT?

    The best by fay C only X toolkit was (and still is!) XView. I think I
    learned more bout software design (especially OO in C) form working with
    XView than just about anything else. It was made open source in the
    latter part of the last century. The excellent O'Reilly XView
    programming manual is also available for free download
    Ian Collins, Jul 27, 2013
    1. Advertisements

  3. No, Xt provides containers and such like, but no actual user-level
    objects. BabyX has functions with names like "button" which put a button
    on the screen. Currently it's always grey, with a 3d effect, it always
    has a centred text label, it doesn't visibly respond as you press it
    (but that'll probably change, I'm putting in the functionality now and
    leaving the frills until later)
    It's important to avoid the "15th standard" effect. The situation is that
    we've got 14 toolkits, all incompatible with each other, so to resolve that
    we try to provide a unified system. The result can only be fifteen standards,
    all incompatible with reach other.
    Malcolm McLean, Jul 27, 2013
  4. Malcolm McLean

    Ian Collins Guest

    Isn't that what you are developing?

    XView is the one true standard :)
    Ian Collins, Jul 27, 2013
  5. I'm sure it's a great toolkit, but the manual is 327 pages.
    That's what I'm trying to avoid.
    Malcolm McLean, Jul 27, 2013
  6. Malcolm McLean

    Ian Collins Guest

    Which is less than half the size (and better written) than the Xlib
    programming manual! It's also about a third of the size of the Motif
    manual (which frequently refers the the XT manual) and you definitely
    don't want to go down that path!
    Ian Collins, Jul 27, 2013
  7. A drawpixel function? Nooooo! If you include that someone will only go and
    use it!.A macro, possibly, but not a function. Better, IMHO, how about a way
    to call the drawing routine and pass it a list of commands, some of which
    can be single, individual, isolated, one-at-a-time pixels if absolutely

    Mice can generate scroll events as well as x and y movements.

    A given human can generate mouse and keyboard events and expect them to be
    processed in order even if the GUI is delayed for a moment. And humans can
    interact with other devices too. A human-interface packet format might be

    Your iskeypressed routine sounds appropriately low level. A keyboard is
    fundamentally a lot of switches. But I'm not sure about the int ch part. Not
    all keys generate characters. Further, a number of languages look for key
    down and key up messages.

    James Harris \(es\), Jul 27, 2013
  8. Malcolm McLean

    BartC Guest

    Yes, that's the sort of thing I used to do on top of Win32/GDI etc, and have
    been trying again to get something so simple!

    So, at the basic level:

    - create top-level window

    - create child window (although this can be dispensed at this level, the
    user of this library will have a bit of extra work to achieve the same
    functionality without it. Also system-supplied child windows can do useful
    clipping which is harder otherwise)

    - basic draw functions (I wouldn't rely on drawing single pixels, it's far
    too slow). You will need access to system-supplied clear, fill and text
    functions too.

    - wait for next event (mostly keyboard/mouse ones, but also those from the
    underlying windows system)

    However if you wanted to have the menus, buttons and dialogs you mentioned,
    you will need an extra layer on top of this. Designing something that does
    everything someone might want, or allows ways to do so, is difficult! And it
    will likely still look like something from the 1990s (not quite the 80s
    someone mentioned).
    BartC, Jul 27, 2013
  9. I've implemented a canvas.

    The interface I've provided is simply getrgba, which returns a buffer, and
    a flush, which draws the image to the screen.
    I know Open GL can be targetted to write to a memory buffer. But I don't know
    if this puts it into a slow software rasterising mode. Whilst the interface
    effectively decouples Baby X from any graphics primitives, it's not
    as efficient as it looks. The image is held in a rgba buffer whilst being
    composed. Then it needs another buffer in X format, with which to respond
    to redraw requests. Then the X server probably buffers the window pixmap.
    Finally there's video memory itself. So tons of buffering going on.

    However it's certainly OK for small images, like icons.

    I've got most of the low-level widgets working. I've got a file open dialogue,
    a scroll bar, a line editor, a menu bar and so on. They don't look nice, but
    the functionality is there. The hard part now is to decide what to do for
    the container system.
    Malcolm McLean, Jul 28, 2013
  10. Malcolm McLean

    Siri Cruise Guest

    It means you can make a reference implementation with the defined interface and
    then provide an alternate, faster implementation hidden in the library.
    Siri Cruise, Jul 28, 2013
  11. Malcolm McLean

    Phil Carmody Guest

    All news servers. Via the mechanism of SSH and screen.

    Phil Carmody, Jul 30, 2013
  12. Malcolm McLean

    blmblm Guest

    Um, doesn't that presuppose the existence of a suitable target for the
    SSH? (I'm thinking shell account on a suitable system, but maybe there
    are other possibilities.)
    blmblm, Aug 6, 2013
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.