Tuesday, December 25, 2018

The new Xchars interface

I made it a bit hierarchical.

NewConn conn;       // Gets a connection, assigns it to name conn
NewGC conn gc;      // Gets a new gc names it gc if the given conn exists
NewWin conn win;  // As above
NewRect win rect;   // as above, a new rect depends on a valid win

SetColot gc color;   // color is an rgb value
SetFont gc font;      // font is a string
PutStr rect str;        // puts the string to rect,d eleting the previous string
WriteRect rect gc;  //  both rect and gc must be defined.
ClearRect rect gc;        // set rect to background color, deletes string.

You cannot put anything to screen without a valid gc and rect, there is no default gc. Gces are free floating, tied to screen->root. Al marking of text if via a rect. Both must be specified.

A lot of repetition in converting from symbol to xcb calls. But the set up for each call is less than ten lines.  The other side, the xcb interface is still a bit of spaghettit, but I am squashing that.

Nine API, simple, hierarchical, limited to strings  perfect architecture for a new power shell. Total line count will be under 500. Get this done, then look at capturing mouse and key strokes.  But interaction is simplified, I pass cursor processing back to clients. Xcharsshould run on a thread.

I posted a rough copy. This approach is clearly a winner to replace xtermios or ncurses. Built on xcb, it doesn't really need wayland.  Managing strings is fast, easily deleted and replaced. They are meant to be temporary, this is still a bit of emulating the old time press.  The keyboard and mouse IO will be a breeze, the polling loop already set up.   Console will do the default, just manage a command line rect, letting the loadable use the rest of a window, or creating their own..


No comments: