XPCE on SDL Cairo Pango Outline - SWI-Prolog/packages-xpce GitHub Wiki

Porting XPCE to SDL3 and Cairo

XPCE currently has two backends, one for X11 and one for the good old Win32 GDI interface. Both are getting outdated. In addition, we have the swipl-win with two implementations, one for Windows -again- implemented on top of Win32 GDI and one for MacOS and Linux implemented on top of Qt. The first is getting outdated and the second is far too heavy weight.

The overall plan is to rebase XPCE on a portable library. For this purpose we selected three libraries:

  • SDL3 provides a widely available and highly portable interface to managing windows, multi-media, selection, etc.
  • Cairo provides a widely available and highly portable interface to draw 2D graphics.
  • Pango is used for international text rendering.

Outline of the plan

The original plan was to make a 3rd backend implementation based on SDL3+Cairo+Pango. But, XPCE is too bloated with old concepts such as colormaps, bit- and pixmaps in too many variations, outdated font support and selection, support for monochrome displays, X11 connections, etc. On the other hand it lacks support for device independent scaling, transformations, transparency, etc. As a result, the plan is no longer to merely add SDL+Cairo as a 3rd option, but make SDL+Cairo replace the x11 and win32 backends and gradually remove outdated code.

Some highlights on the major changes

  • Support for bitmaps (1-bit pixels) for backgrounds will be removed. All use of (grey) patterns is replaced by colours. All images are 32-bits RGBA.
  • Class colour_map will be removed. It is still unsure what will happen to class colour. As all colours are 32-bit RBGA tuples, as class is not strictly needed any more. On the other hand, it allows for naming colours and doing some transformations to the colour space.
  • Multiple monitors will probably be represented by instances of class display, removing class monitor. Before, a display represented an X11 display connection that could manage multiple monitors as sub-areas of a big virtual screen. That notion is gone in SDL.
  • Get rid of swipl-win by adding a class terminal to xpce, probably based on the swipl-win.exe source, ported to SDL3+Cairo.
    • Implement the terminal, now called Epilog
    • Make Epilog work as primary console