Skip to content

Replace lib(X)g with libdraw #16

Open
@japanoise

Description

@japanoise

In trying to solve #8 I got knee deep in the dead weeds with libg and have come to the conclusion that it sucks and is terrible. The plan9 devs themselves realized this years ago, and replaced libg with libdraw. An X version (libXdraw?) that also works nicely on macos is already available in plan9port - an interface in libdraw runs the program devdraw, which communicates with the X server/Mac OS whatever to actually perform the windowing calls:

That's pretty neat, and is a good way to separate out the drawing code (not dissimilar to how sam/samterm are two separate processes, thus encouraging a little bit of decoupling). This should solve #10 for free, so I'll close that issue.

Here's how I think this would work:

  1. Port devdraw
  2. Port libdraw
  3. Switch libframe to call into libdraw instead of lib(X)g
  4. Remove X-dependent stuff in headers, samterm etc.
  5. Switch any direct calls into libg in samterm to libdraw (refer back to p9p source)

What would be extra extra cool, with all this separation of concerns, is that I think it might actually be fairly trivial to port devdraw to SDL3, and thus allow sam to be built anywhere that supports SDL (notably including Windows). One thing at a time though - that will be a follow-up when this ticket is done.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions