-
Notifications
You must be signed in to change notification settings - Fork 0
XCB Text Editor (Sample Program)
So, why an XCB editor?
~/src/cpp/Edit contains a fully functional text editor implemented using ncurses library. It's my editor of choice for all my development work. However, with some of the overhead added to fix SSH security exposures some functions are no longer instantaneous when using remote terminal editing. It's not like there aren't already some good code editors available. It's that the better ones do too much, or come with too much extra baggage. As a hobbyist programmer, it just felt like a good time to try something new and different, so a rewrite using some graphic API seemed in order. This turned out to be more challenging than expected.
I first attempted to use Qt. However, many of their sample programs simply didn't work. What did work didn't work perfectly or robustly. It seemed like the output was XML rather than something closer to bare metal. It was usually easier to modify that XML code than to work with the designer. This wasn't satisfactory. I like working closer to the "bare metal."
I chose to try an XCB-based approach. XCB is challenging to use also, but at least it's C++ compatible. Its main problem is a lack of documentation. At least the sample programs worked, so there was a place to start. It didn't take too long to create a simple window that displayed text, and performance is pretty good even without any buffering. However, the user interface is poor. The pseudo-cursor (an inverted character) is annoying. There's little documentation except for the source code.
It provides working but unpolished XCB example code, self-documenting project development by example. It includes extensive debugging hooks. These were and continue to be needed to figure out how XCB works. It provides a methodology for figuring out how to use a subsystem. It's something beginners can use as an example to figure out how to begin.
Cygwin prerequisite packages: libxcb-devel and libxcb-xfixes-devel. (Providing /usr/include/xcb/xcb.h, /usr/include/xcb/xproto.h, and /usr/include/xcb/xfixes.h) Package libX11-devel is also needed but should already be installed (to build the base library,) and the package that provides /usr/include/X11/keysymdef.h should likewise already be installed. No new packages needed to be installed on Linux; all prerequisites were already present.
The source code intended to be part of the Editor are in ~/src/cpp/Edit/Xcb, and those which might eventually become part of an XCB library are in ~/src/cpp/Edit/Xcb/Xcb. I normally use an xterm window in ~/src/cpp/Edit/Xcb/Xcb for source editing. Soft links allow all files to be edited from there.
As usual when new object sub-directories are added, the updated ~/obj/.git directory is maintained is ~/src/obj. Use the .README restore script found there to update your ~/obj development tree, then compilation is done as usual from ~/obj/cpp/Edit/Xcb.
December 15, 2020 Update: The Xcb Text Editor is operational but not robustly tested. It's at an alpha pre-release state where it's usable enough to be the editor of choice when making changes to itself. This will serve to de-glitch it and put an emphasis on implementing needed features.