I just wanted to follow up on this before I start making any changes.
It looks like the appropriate place to implement auto-backend select is:

  src/libnsfb.c

nsfb_t*
nsfb_new(const enum nsfb_type_e surface_type)
{
    nsfb_t *newfb;
    newfb = calloc(1, sizeof(nsfb_t));
    if (newfb == NULL)
-        return NULL;
+{
+     /*autoselect code here: if (getenv("WAYLAND_DISPLAY")) ... */
+}else{

It looks like modes that are not supported still get checked,
but could be skipped if libnsfb.h had some #ifdefs for:

enum nsfb_type_e {
    NSFB_SURFACE_NONE = 0, /**< No surface */
    NSFB_SURFACE_RAM, /**< RAM surface */
#ifdef NSFB_SDL_AVAILABLE
    NSFB_SURFACE_SDL, /**< SDL surface */
#endif
#ifdef NSFB_LINUX_AVAILABLE 
   NSFB_SURFACE_LINUX, /**< Linux framebuffer surface */
#endif
#ifdef NSFB_VNC_AVAILABLE
    NSFB_SURFACE_VNC, /**< VNC surface */
#endif
#ifdef NSFB_ABLE_AVAILABLE
    NSFB_SURFACE_ABLE, /**< ABLE framebuffer surface */
#endif
#ifdef NSFB_XCB_AVAILABLE  /* naming inconsistent */
    NSFB_SURFACE_X, /**< X windows surface */
#endif
#ifdef NSFB_WLD_AVAILABLE
    NSFB_SURFACE_WL /**< Wayland surface */
#endif
/*put a dummy here so it is always last? and can be used in loops?*/
/* it looks like default order is the reverse of this */
};

Note: these would need to be define in a nsfb-config.h

BTW, the default width and height of 800x600 could be problematic on small 
devices
Is there a reason it cannot be clamped to the screen resolution on a per 
surface basis?

Reply via email to