Revision: 75419
          http://sourceforge.net/p/brlcad/code/75419
Author:   starseeker
Date:     2020-04-16 00:57:56 +0000 (Thu, 16 Apr 2020)
Log Message:
-----------
Make a stab at converting libfb to PImpl pattern (untested on Windows)

Modified Paths:
--------------
    brlcad/trunk/include/fb.h
    brlcad/trunk/src/libfb/fb_generic.c
    brlcad/trunk/src/libfb/fb_obj.c
    brlcad/trunk/src/libfb/fb_paged_io.c
    brlcad/trunk/src/libfb/fb_private.h
    brlcad/trunk/src/libfb/fb_util.c
    brlcad/trunk/src/libfb/fbserv_obj.c
    brlcad/trunk/src/libfb/if_X24.c
    brlcad/trunk/src/libfb/if_debug.c
    brlcad/trunk/src/libfb/if_disk.c
    brlcad/trunk/src/libfb/if_mem.c
    brlcad/trunk/src/libfb/if_null.c
    brlcad/trunk/src/libfb/if_ogl.c
    brlcad/trunk/src/libfb/if_osgl.cpp
    brlcad/trunk/src/libfb/if_qt.cpp
    brlcad/trunk/src/libfb/if_remote.c
    brlcad/trunk/src/libfb/if_stack.c
    brlcad/trunk/src/libfb/if_tk.c
    brlcad/trunk/src/libfb/if_wgl.c

Modified: brlcad/trunk/include/fb.h
===================================================================
--- brlcad/trunk/include/fb.h   2020-04-15 23:38:07 UTC (rev 75418)
+++ brlcad/trunk/include/fb.h   2020-04-16 00:57:56 UTC (rev 75419)
@@ -90,8 +90,11 @@
 #define RGBPIXEL_NULL (unsigned char *) 0
 #define COLORMAP_NULL (ColorMap *) 0
 
-/* Use a typedef to hide the details of the framebuffer structure */
-struct fb;
+/* The internals of the framebuffer structure are hidden using the PImpl 
pattern */
+struct fb_impl;
+struct fb {
+    struct fb_impl *i;
+};
 #define FB_NULL (struct fb *) 0
 
 /**

Modified: brlcad/trunk/src/libfb/fb_generic.c
===================================================================
--- brlcad/trunk/src/libfb/fb_generic.c 2020-04-15 23:38:07 UTC (rev 75418)
+++ brlcad/trunk/src/libfb/fb_generic.c 2020-04-16 00:57:56 UTC (rev 75419)
@@ -87,14 +87,17 @@
 {
     struct fb *new_fb = FB_NULL;
     BU_GET(new_fb, struct fb);
-    new_fb->if_name = NULL;
+    BU_GET(new_fb->i, struct fb_impl);
+    new_fb->i->if_name = NULL;
     return new_fb;
 }
 
 void fb_put(struct fb *ifp)
 {
-    if (ifp != FB_NULL)
+    if (ifp != FB_NULL) {
+       BU_PUT(ifp->i, struct fb_impl);
        BU_PUT(ifp, struct fb);
+    }
 }
 
 void fb_set_interface(struct fb *ifp, const char *interface_type)
@@ -102,7 +105,7 @@
     int i = 0;
     if (!ifp) return;
     while (_if_list[i] != FB_NULL) {
-       if (bu_strncmp(interface_type, _if_list[i]->if_name+5, 
strlen(interface_type)) == 0) {
+       if (bu_strncmp(interface_type, _if_list[i]->i->if_name+5, 
strlen(interface_type)) == 0) {
            /* found it, copy its struct in */
            *ifp = *(_if_list[i]);
            return;
@@ -118,9 +121,9 @@
     int i = 0;
     if (!magic) return NULL;
     while (_if_list[i] != FB_NULL) {
-       if (magic == _if_list[i]->type_magic) {
+       if (magic == _if_list[i]->i->type_magic) {
            /* found it, get its specific struct */
-           return (*(_if_list[i])).if_existing_get(magic);
+           return (*(_if_list[i])).i->if_existing_get(magic);
        } else {
            i++;
        }
@@ -134,9 +137,9 @@
     int i = 0;
     if (!fb_p) return;
     while (_if_list[i] != FB_NULL) {
-       if (fb_p->magic == _if_list[i]->type_magic) {
+       if (fb_p->magic == _if_list[i]->i->type_magic) {
            /* found it, clear its specific struct */
-           (*(_if_list[i])).if_existing_put(fb_p);
+           (*(_if_list[i])).i->if_existing_put(fb_p);
            return;
        } else {
            i++;
@@ -152,7 +155,7 @@
     if (!ifp) return NULL;
     fb_set_interface(ifp, file);
     fb_set_magic(ifp, FB_MAGIC);
-    if (ifp->if_open_existing) ifp->if_open_existing(ifp, width, height, fb_p);
+    if (ifp->i->if_open_existing) ifp->i->if_open_existing(ifp, width, height, 
fb_p);
     return ifp;
 }
 
@@ -159,7 +162,7 @@
 int
 fb_refresh(struct fb *ifp, int x, int y, int w, int h)
 {
-    return ifp->if_refresh(ifp, x, y, w, h);
+    return ifp->i->if_refresh(ifp, x, y, w, h);
 }
 
 int
@@ -166,29 +169,29 @@
 fb_configure_window(struct fb *ifp, int width, int height)
 {
     /* unknown/unset framebuffer */
-    if (!ifp || !ifp->if_configure_window || width < 0 || height < 0) {
+    if (!ifp || !ifp->i->if_configure_window || width < 0 || height < 0) {
        return 0;
     }
-    return ifp->if_configure_window(ifp, width, height);
+    return ifp->i->if_configure_window(ifp, width, height);
 }
 
 void fb_set_name(struct fb *ifp, const char *name)
 {
     if (!ifp) return;
-    ifp->if_name = (char *)bu_malloc((unsigned)strlen(name)+1, "if_name");
-    bu_strlcpy(ifp->if_name, name, strlen(name)+1);
+    ifp->i->if_name = (char *)bu_malloc((unsigned)strlen(name)+1, "if_name");
+    bu_strlcpy(ifp->i->if_name, name, strlen(name)+1);
 }
 
 char *fb_get_name(struct fb *ifp)
 {
     if (!ifp) return NULL;
-    return ifp->if_name;
+    return ifp->i->if_name;
 }
 
 long fb_get_pagebuffer_pixel_size(struct fb *ifp)
 {
     if (!ifp) return 0;
-    return ifp->if_ppixels;
+    return ifp->i->if_ppixels;
 }
 
 int fb_is_set_fd(struct fb *ifp, fd_set *infds)
@@ -195,9 +198,9 @@
 {
     if (!ifp) return 0;
     if (!infds) return 0;
-    if (!ifp->if_selfd) return 0;
-    if (ifp->if_selfd <= 0) return 0;
-    return FD_ISSET(ifp->if_selfd, infds);
+    if (!ifp->i->if_selfd) return 0;
+    if (ifp->i->if_selfd <= 0) return 0;
+    return FD_ISSET(ifp->i->if_selfd, infds);
 }
 
 int fb_set_fd(struct fb *ifp, fd_set *select_list)
@@ -204,10 +207,10 @@
 {
     if (!ifp) return 0;
     if (!select_list) return 0;
-    if (!ifp->if_selfd) return 0;
-    if (ifp->if_selfd <= 0) return 0;
-    FD_SET(ifp->if_selfd, select_list);
-    return ifp->if_selfd;
+    if (!ifp->i->if_selfd) return 0;
+    if (ifp->i->if_selfd <= 0) return 0;
+    FD_SET(ifp->i->if_selfd, select_list);
+    return ifp->i->if_selfd;
 }
 
 int fb_clear_fd(struct fb *ifp, fd_set *list)
@@ -214,116 +217,116 @@
 {
     if (!ifp) return 0;
     if (!list) return 0;
-    if (!ifp->if_selfd) return 0;
-    if (ifp->if_selfd <= 0) return 0;
-    FD_CLR(ifp->if_selfd, list);
-    return ifp->if_selfd;
+    if (!ifp->i->if_selfd) return 0;
+    if (ifp->i->if_selfd <= 0) return 0;
+    FD_CLR(ifp->i->if_selfd, list);
+    return ifp->i->if_selfd;
 }
 
 void fb_set_magic(struct fb *ifp, uint32_t magic)
 {
     if (!ifp) return;
-    ifp->if_magic = magic;
+    ifp->i->if_magic = magic;
 }
 
 
 char *fb_gettype(struct fb *ifp)
 {
-    return ifp->if_type;
+    return ifp->i->if_type;
 }
 
 int fb_getwidth(struct fb *ifp)
 {
-    return ifp->if_width;
+    return ifp->i->if_width;
 }
 int fb_getheight(struct fb *ifp)
 {
-    return ifp->if_height;
+    return ifp->i->if_height;
 }
 
 int fb_get_max_width(struct fb *ifp)
 {
-    return ifp->if_max_width;
+    return ifp->i->if_max_width;
 }
 int fb_get_max_height(struct fb *ifp)
 {
-    return ifp->if_max_height;
+    return ifp->i->if_max_height;
 }
 
 
 int fb_poll(struct fb *ifp)
 {
-    return (*ifp->if_poll)(ifp);
+    return (*ifp->i->if_poll)(ifp);
 }
 
 long fb_poll_rate(struct fb *ifp)
 {
-    return ifp->if_poll_refresh_rate;
+    return ifp->i->if_poll_refresh_rate;
 }
 
 int fb_help(struct fb *ifp)
 {
-    return (*ifp->if_help)(ifp);
+    return (*ifp->i->if_help)(ifp);
 }
 int fb_free(struct fb *ifp)
 {
-    return (*ifp->if_free)(ifp);
+    return (*ifp->i->if_free)(ifp);
 }
 int fb_clear(struct fb *ifp, unsigned char *pp)
 {
-    return (*ifp->if_clear)(ifp, pp);
+    return (*ifp->i->if_clear)(ifp, pp);
 }
 ssize_t fb_read(struct fb *ifp, int x, int y, unsigned char *pp, size_t count)
 {
-    return (*ifp->if_read)(ifp, x, y, pp, count);
+    return (*ifp->i->if_read)(ifp, x, y, pp, count);
 }
 ssize_t fb_write(struct fb *ifp, int x, int y, const unsigned char *pp, size_t 
count)
 {
-    return (*ifp->if_write)(ifp, x, y, pp, count);
+    return (*ifp->i->if_write)(ifp, x, y, pp, count);
 }
 int fb_rmap(struct fb *ifp, ColorMap *cmap)
 {
-    return (*ifp->if_rmap)(ifp, cmap);
+    return (*ifp->i->if_rmap)(ifp, cmap);
 }
 int fb_wmap(struct fb *ifp, const ColorMap *cmap)
 {
-    return (*ifp->if_wmap)(ifp, cmap);
+    return (*ifp->i->if_wmap)(ifp, cmap);
 }
 int fb_view(struct fb *ifp, int xcenter, int ycenter, int xzoom, int yzoom)
 {
-    return (*ifp->if_view)(ifp, xcenter, ycenter, xzoom, yzoom);
+    return (*ifp->i->if_view)(ifp, xcenter, ycenter, xzoom, yzoom);
 }
 int fb_getview(struct fb *ifp, int *xcenter, int *ycenter, int *xzoom, int 
*yzoom)
 {
-    return (*ifp->if_getview)(ifp, xcenter, ycenter, xzoom, yzoom);
+    return (*ifp->i->if_getview)(ifp, xcenter, ycenter, xzoom, yzoom);
 }
 int fb_setcursor(struct fb *ifp, const unsigned char *bits, int xb, int yb, 
int xo, int yo)
 {
-    return (*ifp->if_setcursor)(ifp, bits, xb, yb, xo, yo);
+    return (*ifp->i->if_setcursor)(ifp, bits, xb, yb, xo, yo);
 }
 int fb_cursor(struct fb *ifp, int mode, int x, int y)
 {
-    return (*ifp->if_cursor)(ifp, mode, x, y);
+    return (*ifp->i->if_cursor)(ifp, mode, x, y);
 }
 int fb_getcursor(struct fb *ifp, int *mode, int *x, int *y)
 {
-    return (*ifp->if_getcursor)(ifp, mode, x, y);
+    return (*ifp->i->if_getcursor)(ifp, mode, x, y);
 }
 int fb_readrect(struct fb *ifp, int xmin, int ymin, int width, int height, 
unsigned char *pp)
 {
-    return (*ifp->if_readrect)(ifp, xmin, ymin, width, height, pp);
+    return (*ifp->i->if_readrect)(ifp, xmin, ymin, width, height, pp);
 }
 int fb_writerect(struct fb *ifp, int xmin, int ymin, int width, int height, 
const unsigned char *pp)
 {
-    return (*ifp->if_writerect)(ifp, xmin, ymin, width, height, pp);
+    return (*ifp->i->if_writerect)(ifp, xmin, ymin, width, height, pp);
 }
 int fb_bwreadrect(struct fb *ifp, int xmin, int ymin, int width, int height, 
unsigned char *pp)
 {
-    return (*ifp->if_bwreadrect)(ifp, xmin, ymin, width, height, pp);
+    return (*ifp->i->if_bwreadrect)(ifp, xmin, ymin, width, height, pp);
 }
 int fb_bwwriterect(struct fb *ifp, int xmin, int ymin, int width, int height, 
const unsigned char *pp)
 {
-    return (*ifp->if_bwwriterect)(ifp, xmin, ymin, width, height, pp);
+    return (*ifp->i->if_bwwriterect)(ifp, xmin, ymin, width, height, pp);
 }
 
 
@@ -363,7 +366,7 @@
 int fb_null(struct fb *ifp)
 {
     if (ifp) {
-       FB_CK_FB(ifp);
+       FB_CK_FB(ifp->i);
     }
 
     return 0;
@@ -376,7 +379,7 @@
 int fb_null_setcursor(struct fb *ifp, const unsigned char *UNUSED(bits), int 
UNUSED(xbits), int UNUSED(ybits), int UNUSED(xorig), int UNUSED(yorig))
 {
     if (ifp) {
-       FB_CK_FB(ifp);
+       FB_CK_FB(ifp->i);
     }
 
     return 0;
@@ -394,6 +397,7 @@
        return FB_NULL;
 
     ifp = (struct fb *) calloc(sizeof(struct fb), 1);
+    ifp->i = (struct fb_impl *) calloc(sizeof(struct fb_impl), 1);
     if (ifp == FB_NULL) {
        Malloc_Bomb(sizeof(struct fb));
        return FB_NULL;
@@ -403,7 +407,7 @@
        if ((file = (const char *)getenv("FB_FILE")) == NULL || *file == '\0') {
            /* None set, use first device as default */
            *ifp = *(_if_list[0]);      /* struct copy */
-           file = ifp->if_name;
+           file = ifp->i->if_name;
            goto found_interface;
        }
     }
@@ -419,10 +423,10 @@
      */
     i = 0;
     while (_if_list[i] != (struct fb *)NULL) {
-       if (bu_strncmp(file, _if_list[i]->if_name,
-                   strlen(_if_list[i]->if_name)) == 0) {
+       if (bu_strncmp(file, _if_list[i]->i->if_name,
+                   strlen(_if_list[i]->i->if_name)) == 0) {
            /* found it, copy its struct in */
-           *ifp = *(_if_list[i]);
+           *ifp->i = *(_if_list[i]->i);
            goto found_interface;
        }
        i++;
@@ -455,21 +459,21 @@
 
 found_interface:
     /* Copy over the name it was opened by. */
-    ifp->if_name = (char*)malloc((unsigned) strlen(file) + 1);
-    if (ifp->if_name == (char *)NULL) {
+    ifp->i->if_name = (char*)malloc((unsigned) strlen(file) + 1);
+    if (ifp->i->if_name == (char *)NULL) {
        Malloc_Bomb(strlen(file) + 1);
        free((void *) ifp);
        return FB_NULL;
     }
-    bu_strlcpy(ifp->if_name, file, strlen(file)+1);
+    bu_strlcpy(ifp->i->if_name, file, strlen(file)+1);
 
     /* Mark OK by filling in magic number */
-    ifp->if_magic = FB_MAGIC;
+    ifp->i->if_magic = FB_MAGIC;
 
-    i=(*ifp->if_open)(ifp, file, width, height);
+    i=(*ifp->i->if_open)(ifp, file, width, height);
     if (i != 0) {
-       ifp->if_magic = 0;              /* sanity */
-       free((void *) ifp->if_name);
+       ifp->i->if_magic = 0;           /* sanity */
+       free((void *) ifp->i->if_name);
        free((void *) ifp);
 
        if (i < 0)
@@ -488,16 +492,16 @@
 {
     int i;
 
-    FB_CK_FB(ifp);
+    FB_CK_FB(ifp->i);
     fb_flush(ifp);
-    if ((i=(*ifp->if_close)(ifp)) <= -1) {
+    if ((i=(*ifp->i->if_close)(ifp)) <= -1) {
        fb_log("fb_close: can not close device \"%s\", ret=%d.\n",
-              ifp->if_name, i);
+              ifp->i->if_name, i);
        return -1;
     }
-    if (ifp->if_pbase != PIXEL_NULL)
-       free((void *) ifp->if_pbase);
-    free((void *) ifp->if_name);
+    if (ifp->i->if_pbase != PIXEL_NULL)
+       free((void *) ifp->i->if_pbase);
+    free((void *) ifp->i->if_name);
     free((void *) ifp);
     return 0;
 }
@@ -510,16 +514,16 @@
     if (!ifp)
        return 0;
 
-    FB_CK_FB(ifp);
+    FB_CK_FB(ifp->i);
 
     fb_flush(ifp);
 
     /* FIXME: these should be callbacks, not listed directly */
 
-    status = ifp->if_close_existing(ifp);
+    status = ifp->i->if_close_existing(ifp);
 
     if (status  <= -1) {
-       fb_log("fb_close_existing: cannot close device \"%s\", ret=%d.\n", 
ifp->if_name, status);
+       fb_log("fb_close_existing: cannot close device \"%s\", ret=%d.\n", 
ifp->i->if_name, status);
        return BRLCAD_ERROR;
     }
     fb_put(ifp);
@@ -539,8 +543,8 @@
     i = 0;
     while (_if_list[i] != (struct fb *)NULL) {
        fb_log("%-12s  %s\n",
-              _if_list[i]->if_name,
-              _if_list[i]->if_type);
+              _if_list[i]->i->if_name,
+              _if_list[i]->i->if_type);
        i++;
     }
 
@@ -547,13 +551,13 @@
     /* Print the ones not in the device list */
 #ifdef IF_REMOTE
     fb_log("%-12s  %s\n",
-          remote_interface.if_name,
-          remote_interface.if_type);
+          remote_interface.i->if_name,
+          remote_interface.i->if_type);
 #endif
     if (_fb_disk_enable) {
        fb_log("%-12s  %s\n",
-              disk_interface.if_name,
-              disk_interface.if_type);
+              disk_interface.i->if_name,
+              disk_interface.i->if_type);
     }
 
     return 0;

Modified: brlcad/trunk/src/libfb/fb_obj.c
===================================================================
--- brlcad/trunk/src/libfb/fb_obj.c     2020-04-15 23:38:07 UTC (rev 75418)
+++ brlcad/trunk/src/libfb/fb_obj.c     2020-04-16 00:57:56 UTC (rev 75419)
@@ -307,8 +307,8 @@
     if (argc == 2) {
        /* refresh the whole display */
        x = y = 0;
-       w = fbop->fbo_fbs.fbs_fbp->if_width;
-       h = fbop->fbo_fbs.fbs_fbp->if_height;
+       w = fbop->fbo_fbs.fbs_fbp->i->if_width;
+       h = fbop->fbo_fbs.fbs_fbp->i->if_height;
     } else if (sscanf(argv[2], "%d %d %d %d", &x, &y, &w, &h) != 4) {
        /* refresh rectangular area */
        bu_log("fb_refresh: bad rectangle - %s", argv[2]);

Modified: brlcad/trunk/src/libfb/fb_paged_io.c
===================================================================
--- brlcad/trunk/src/libfb/fb_paged_io.c        2020-04-15 23:38:07 UTC (rev 
75418)
+++ brlcad/trunk/src/libfb/fb_paged_io.c        2020-04-16 00:57:56 UTC (rev 
75419)
@@ -38,8 +38,8 @@
 
 
 #define PAGE_BYTES (63*1024L)          /* Max # of bytes/dma. */
-#define PAGE_PIXELS (((PAGE_BYTES/sizeof(RGBpixel))/ifp->if_width) 
*ifp->if_width)
-#define PAGE_SCANS (ifp->if_ppixels/ifp->if_width)
+#define PAGE_PIXELS (((PAGE_BYTES/sizeof(RGBpixel))/ifp->i->if_width) 
*ifp->i->if_width)
+#define PAGE_SCANS (ifp->i->if_ppixels/ifp->i->if_width)
 
 #define Malloc_Bomb(_bytes_)                                   \
     fb_log("\"%s\"(%d) : allocation of %lu bytes failed.\n",   \
@@ -51,14 +51,14 @@
 {
     size_t scans, first_scan;
 
-    /*fb_log("_fb_pgout(%d)\n", ifp->if_pno);*/
+    /*fb_log("_fb_pgout(%d)\n", ifp->i->if_pno);*/
 
-    if (ifp->if_pno < 0)       /* Already paged out, return 1. */
+    if (ifp->i->if_pno < 0)    /* Already paged out, return 1. */
        return 1;
 
-    first_scan = ifp->if_pno * PAGE_SCANS;
-    if (first_scan + PAGE_SCANS > (size_t)ifp->if_height)
-       scans = ifp->if_height - first_scan;
+    first_scan = ifp->i->if_pno * PAGE_SCANS;
+    if (first_scan + PAGE_SCANS > (size_t)ifp->i->if_height)
+       scans = ifp->i->if_height - first_scan;
     else
        scans = PAGE_SCANS;
 
@@ -65,8 +65,8 @@
     return fb_write(ifp,
                    0,
                    first_scan,
-                   ifp->if_pbase,
-                   scans * ifp->if_width
+                   ifp->i->if_pbase,
+                   scans * ifp->i->if_width
        );
 }
 
@@ -79,13 +79,13 @@
     /*fb_log("_fb_pgin(%d)\n", pageno);*/
 
     /* Set pixel pointer to beginning of page. */
-    ifp->if_pcurp = ifp->if_pbase;
-    ifp->if_pno = pageno;
-    ifp->if_pdirty = 0;
+    ifp->i->if_pcurp = ifp->i->if_pbase;
+    ifp->i->if_pno = pageno;
+    ifp->i->if_pdirty = 0;
 
-    first_scan = ifp->if_pno * PAGE_SCANS;
-    if (first_scan + PAGE_SCANS > (size_t)ifp->if_height)
-       scans = ifp->if_height - first_scan;
+    first_scan = ifp->i->if_pno * PAGE_SCANS;
+    if (first_scan + PAGE_SCANS > (size_t)ifp->i->if_height)
+       scans = ifp->i->if_height - first_scan;
     else
        scans = PAGE_SCANS;
 
@@ -92,8 +92,8 @@
     return fb_read(ifp,
                   0,
                   first_scan,
-                  ifp->if_pbase,
-                  scans * ifp->if_width
+                  ifp->i->if_pbase,
+                  scans * ifp->i->if_width
        );
 }
 
@@ -101,14 +101,14 @@
 static int
 _fb_pgflush(register struct fb *ifp)
 {
-    if (ifp->if_debug & FB_DEBUG_BIO) {
+    if (ifp->i->if_debug & FB_DEBUG_BIO) {
        fb_log("_fb_pgflush(%p)\n", (void *)ifp);
     }
 
-    if (ifp->if_pdirty) {
+    if (ifp->i->if_pdirty) {
        if (_fb_pgout(ifp) <= -1)
            return -1;
-       ifp->if_pdirty = 0;
+       ifp->i->if_pdirty = 0;
     }
 
     return 0;
@@ -122,25 +122,25 @@
 int
 fb_ioinit(register struct fb *ifp)
 {
-    if (ifp->if_debug & FB_DEBUG_BIO) {
+    if (ifp->i->if_debug & FB_DEBUG_BIO) {
        fb_log("fb_ioinit(%p)\n", (void *)ifp);
     }
 
-    ifp->if_pno = -1;          /* Force _fb_pgin() initially.  */
-    ifp->if_pixcur = 0L;               /* Initialize pixel number.     */
-    if (ifp->if_pbase == PIXEL_NULL) {
+    ifp->i->if_pno = -1;               /* Force _fb_pgin() initially.  */
+    ifp->i->if_pixcur = 0L;            /* Initialize pixel number.     */
+    if (ifp->i->if_pbase == PIXEL_NULL) {
        /* Only allocate buffer once. */
-       ifp->if_ppixels = PAGE_PIXELS;  /* Pixels/page. */
-       if (ifp->if_ppixels > ifp->if_width * ifp->if_height)
-           ifp->if_ppixels = ifp->if_width * ifp->if_height;
-       if ((ifp->if_pbase = (unsigned char *)malloc(ifp->if_ppixels * 
sizeof(RGBpixel)))
+       ifp->i->if_ppixels = PAGE_PIXELS;       /* Pixels/page. */
+       if (ifp->i->if_ppixels > ifp->i->if_width * ifp->i->if_height)
+           ifp->i->if_ppixels = ifp->i->if_width * ifp->i->if_height;
+       if ((ifp->i->if_pbase = (unsigned char *)malloc(ifp->i->if_ppixels * 
sizeof(RGBpixel)))
            == PIXEL_NULL) {
-           Malloc_Bomb(ifp->if_ppixels * sizeof(RGBpixel));
+           Malloc_Bomb(ifp->i->if_ppixels * sizeof(RGBpixel));
            return -1;
        }
     }
-    ifp->if_pcurp = ifp->if_pbase;     /* Initialize pointer.  */
-    ifp->if_pendp = ifp->if_pbase+ifp->if_ppixels*sizeof(RGBpixel);
+    ifp->i->if_pcurp = ifp->i->if_pbase;       /* Initialize pointer.  */
+    ifp->i->if_pendp = ifp->i->if_pbase+ifp->i->if_ppixels*sizeof(RGBpixel);
     return 0;
 }
 
@@ -151,28 +151,28 @@
     long pixelnum;
     long pagepixel;
 
-    if (ifp->if_debug & FB_DEBUG_BIO) {
+    if (ifp->i->if_debug & FB_DEBUG_BIO) {
        fb_log("fb_seek(%p, %d, %d)\n",
               (void *)ifp, x, y);
     }
 
-    if (x < 0 || y < 0 || x >= ifp->if_width || y >= ifp->if_height) {
+    if (x < 0 || y < 0 || x >= ifp->i->if_width || y >= ifp->i->if_height) {
        fb_log("fb_seek: illegal address <%d, %d>.\n", x, y);
        return -1;
     }
-    pixelnum = ((long) y * (long) ifp->if_width) + x;
-    pagepixel = (long) ifp->if_pno * ifp->if_ppixels;
-    if (pixelnum < pagepixel || pixelnum >= (pagepixel + ifp->if_ppixels)) {
-       if (ifp->if_pdirty)
+    pixelnum = ((long) y * (long) ifp->i->if_width) + x;
+    pagepixel = (long) ifp->i->if_pno * ifp->i->if_ppixels;
+    if (pixelnum < pagepixel || pixelnum >= (pagepixel + ifp->i->if_ppixels)) {
+       if (ifp->i->if_pdirty)
            if (_fb_pgout(ifp) == - 1)
                return -1;
-       if (_fb_pgin(ifp, (int) (pixelnum / (long) ifp->if_ppixels)) <= -1)
+       if (_fb_pgin(ifp, (int) (pixelnum / (long) ifp->i->if_ppixels)) <= -1)
            return -1;
     }
-    ifp->if_pixcur = pixelnum;
+    ifp->i->if_pixcur = pixelnum;
     /* Compute new pixel pointer into page. */
-    ifp->if_pcurp = ifp->if_pbase +
-       (ifp->if_pixcur % ifp->if_ppixels)*sizeof(RGBpixel);
+    ifp->i->if_pcurp = ifp->i->if_pbase +
+       (ifp->i->if_pixcur % ifp->i->if_ppixels)*sizeof(RGBpixel);
     return 0;
 }
 
@@ -180,10 +180,10 @@
 int
 fb_tell(register struct fb *ifp, int *xp, int *yp)
 {
-    *yp = (int) (ifp->if_pixcur / ifp->if_width);
-    *xp = (int) (ifp->if_pixcur % ifp->if_width);
+    *yp = (int) (ifp->i->if_pixcur / ifp->i->if_width);
+    *xp = (int) (ifp->i->if_pixcur % ifp->i->if_width);
 
-    if (ifp->if_debug & FB_DEBUG_BIO) {
+    if (ifp->i->if_debug & FB_DEBUG_BIO) {
        fb_log("fb_tell(%p, %p, %p) => (%4d, %4d)\n",
               (void *)ifp, (void *)xp, (void *)yp, *xp, *yp);
     }
@@ -195,18 +195,18 @@
 int
 fb_wpixel(register struct fb *ifp, unsigned char *pixelp)
 {
-    if (ifp->if_pno == -1)
-       if (_fb_pgin(ifp, ifp->if_pixcur / ifp->if_ppixels) <= -1)
+    if (ifp->i->if_pno == -1)
+       if (_fb_pgin(ifp, ifp->i->if_pixcur / ifp->i->if_ppixels) <= -1)
            return -1;
 
-    COPYRGB((ifp->if_pcurp), pixelp);
-    ifp->if_pcurp += sizeof(RGBpixel); /* position in page */
-    ifp->if_pixcur++;  /* position in framebuffer */
-    ifp->if_pdirty = 1;        /* page referenced (dirty) */
-    if (ifp->if_pcurp >= ifp->if_pendp) {
+    COPYRGB((ifp->i->if_pcurp), pixelp);
+    ifp->i->if_pcurp += sizeof(RGBpixel);      /* position in page */
+    ifp->i->if_pixcur++;       /* position in framebuffer */
+    ifp->i->if_pdirty = 1;     /* page referenced (dirty) */
+    if (ifp->i->if_pcurp >= ifp->i->if_pendp) {
        if (_fb_pgout(ifp) <= -1)
            return -1;
-       ifp->if_pno = -1;
+       ifp->i->if_pno = -1;
     }
     return 0;
 }
@@ -215,17 +215,17 @@
 int
 fb_rpixel(register struct fb *ifp, unsigned char *pixelp)
 {
-    if (ifp->if_pno == -1)
-       if (_fb_pgin(ifp, ifp->if_pixcur / ifp->if_ppixels) <= -1)
+    if (ifp->i->if_pno == -1)
+       if (_fb_pgin(ifp, ifp->i->if_pixcur / ifp->i->if_ppixels) <= -1)
            return -1;
 
-    COPYRGB(pixelp, (ifp->if_pcurp));
-    ifp->if_pcurp += sizeof(RGBpixel); /* position in page */
-    ifp->if_pixcur++;  /* position in framebuffer */
-    if (ifp->if_pcurp >= ifp->if_pendp) {
+    COPYRGB(pixelp, (ifp->i->if_pcurp));
+    ifp->i->if_pcurp += sizeof(RGBpixel);      /* position in page */
+    ifp->i->if_pixcur++;       /* position in framebuffer */
+    if (ifp->i->if_pcurp >= ifp->i->if_pendp) {
        if (_fb_pgout(ifp) <= -1)
            return -1;
-       ifp->if_pno = -1;
+       ifp->i->if_pno = -1;
     }
 
     return 0;
@@ -238,7 +238,7 @@
     _fb_pgflush(ifp);
 
     /* call device specific flush routine */
-    if ((*ifp->if_flush)(ifp) <= -1)
+    if ((*ifp->i->if_flush)(ifp) <= -1)
        return -1;
 
     return 0;

Modified: brlcad/trunk/src/libfb/fb_private.h
===================================================================
--- brlcad/trunk/src/libfb/fb_private.h 2020-04-15 23:38:07 UTC (rev 75418)
+++ brlcad/trunk/src/libfb/fb_private.h 2020-04-16 00:57:56 UTC (rev 75419)
@@ -90,7 +90,7 @@
  * calls in the fb.h API - no code external to libfb should work
  * directly with structure members.
  */
-struct fb {
+struct fb_impl {
     uint32_t if_magic;
     uint32_t type_magic;
     /* Static information: per device TYPE.     */

Modified: brlcad/trunk/src/libfb/fb_util.c
===================================================================
--- brlcad/trunk/src/libfb/fb_util.c    2020-04-15 23:38:07 UTC (rev 75418)
+++ brlcad/trunk/src/libfb/fb_util.c    2020-04-16 00:57:56 UTC (rev 75419)
@@ -42,12 +42,12 @@
 int
 fb_sim_view(struct fb *ifp, int xcenter, int ycenter, int xzoom, int yzoom)
 {
-    FB_CK_FB(ifp);
+    FB_CK_FB(ifp->i);
 
-    ifp->if_xcenter = xcenter;
-    ifp->if_ycenter = ycenter;
-    ifp->if_xzoom = xzoom;
-    ifp->if_yzoom = yzoom;
+    ifp->i->if_xcenter = xcenter;
+    ifp->i->if_ycenter = ycenter;
+    ifp->i->if_xzoom = xzoom;
+    ifp->i->if_yzoom = yzoom;
 
     return 0;
 }
@@ -60,12 +60,12 @@
 int
 fb_sim_getview(struct fb *ifp, int *xcenter, int *ycenter, int *xzoom, int 
*yzoom)
 {
-    FB_CK_FB(ifp);
+    FB_CK_FB(ifp->i);
 
-    *xcenter = ifp->if_xcenter;
-    *ycenter = ifp->if_ycenter;
-    *xzoom = ifp->if_xzoom;
-    *yzoom = ifp->if_yzoom;
+    *xcenter = ifp->i->if_xcenter;
+    *ycenter = ifp->i->if_ycenter;
+    *xzoom = ifp->i->if_xzoom;
+    *yzoom = ifp->i->if_yzoom;
 
     return 0;
 }
@@ -78,11 +78,11 @@
 int
 fb_sim_cursor(struct fb *ifp, int mode, int x, int y)
 {
-    FB_CK_FB(ifp);
+    FB_CK_FB(ifp->i);
 
-    ifp->if_cursmode = mode;
-    ifp->if_xcurs = x;
-    ifp->if_ycurs = y;
+    ifp->i->if_cursmode = mode;
+    ifp->i->if_xcurs = x;
+    ifp->i->if_ycurs = y;
 
     return 0;
 }
@@ -95,11 +95,11 @@
 int
 fb_sim_getcursor(struct fb *ifp, int *mode, int *x, int *y)
 {
-    FB_CK_FB(ifp);
+    FB_CK_FB(ifp->i);
 
-    *mode = ifp->if_cursmode;
-    *x = ifp->if_xcurs;
-    *y = ifp->if_ycurs;
+    *mode = ifp->i->if_cursmode;
+    *x = ifp->i->if_xcurs;
+    *y = ifp->i->if_ycurs;
 
     return 0;
 }
@@ -111,7 +111,7 @@
 fb_reset(struct fb *ifp)
 {
     if (ifp) {
-       FB_CK_FB(ifp);
+       FB_CK_FB(ifp->i);
     }
 
     return 0;
@@ -122,7 +122,7 @@
 fb_viewport(struct fb *ifp, int UNUSED(left), int UNUSED(top), int 
UNUSED(right), int UNUSED(bottom))
 {
     if (ifp) {
-       FB_CK_FB(ifp);
+       FB_CK_FB(ifp->i);
     }
 
     return 0;
@@ -136,7 +136,7 @@
     int xzoom, yzoom;
 
     if (ifp) {
-      FB_CK_FB(ifp);
+      FB_CK_FB(ifp->i);
       fb_getview(ifp, &xcenter, &ycenter, &xzoom, &yzoom);
       xcenter = x;
       ycenter = y;
@@ -154,7 +154,7 @@
     int xzoom, yzoom;
 
     if (ifp) {
-      FB_CK_FB(ifp);
+      FB_CK_FB(ifp->i);
 
       fb_getview(ifp, &xcenter, &ycenter, &xzoom, &yzoom);
       xzoom = x;
@@ -170,7 +170,7 @@
 fb_scursor(struct fb *ifp, int UNUSED(mode), int UNUSED(x), int UNUSED(y))
 {
     if (ifp) {
-       FB_CK_FB(ifp);
+       FB_CK_FB(ifp->i);
     }
 
     /* We could actually implement this but it

Modified: brlcad/trunk/src/libfb/fbserv_obj.c
===================================================================
--- brlcad/trunk/src/libfb/fbserv_obj.c 2020-04-15 23:38:07 UTC (rev 75418)
+++ brlcad/trunk/src/libfb/fbserv_obj.c 2020-04-16 00:57:56 UTC (rev 75419)
@@ -285,10 +285,10 @@
 
     /* Don't really open a new framebuffer --- use existing one */
     (void)pkg_plong(&rbuf[0*NET_LONG_LEN], 0); /* ret */
-    (void)pkg_plong(&rbuf[1*NET_LONG_LEN], curr_fbp->if_max_width);
-    (void)pkg_plong(&rbuf[2*NET_LONG_LEN], curr_fbp->if_max_height);
-    (void)pkg_plong(&rbuf[3*NET_LONG_LEN], curr_fbp->if_width);
-    (void)pkg_plong(&rbuf[4*NET_LONG_LEN], curr_fbp->if_height);
+    (void)pkg_plong(&rbuf[1*NET_LONG_LEN], curr_fbp->i->if_max_width);
+    (void)pkg_plong(&rbuf[2*NET_LONG_LEN], curr_fbp->i->if_max_height);
+    (void)pkg_plong(&rbuf[3*NET_LONG_LEN], curr_fbp->i->if_width);
+    (void)pkg_plong(&rbuf[4*NET_LONG_LEN], curr_fbp->i->if_height);
 
     want = 5*NET_LONG_LEN;
     if (pkg_send(MSG_RETURN, rbuf, want, pcp) != want)

Modified: brlcad/trunk/src/libfb/if_X24.c
===================================================================
--- brlcad/trunk/src/libfb/if_X24.c     2020-04-15 23:38:07 UTC (rev 75418)
+++ brlcad/trunk/src/libfb/if_X24.c     2020-04-16 00:57:56 UTC (rev 75419)
@@ -162,8 +162,8 @@
     int xi_xtp;                /* Y-coord of topmost pixels */
     int xi_xbt;                /* Y-coord of bottommost pixels */
 };
-#define XI(ptr) ((struct xinfo *)((ptr)->u1.p))
-#define XI_SET(ptr, val) ((ptr)->u1.p) = (char *) val;
+#define XI(ptr) ((struct xinfo *)((ptr)->i->u1.p))
+#define XI_SET(ptr, val) ((ptr)->i->u1.p) = (char *) val;
 
 
 /* Flags in xi_flags */
@@ -536,7 +536,7 @@
     XRectangle rect;
     char *xname;
 
-    FB_CK_FB(ifp);
+    FB_CK_FB(ifp->i);
 
     /* Save these in state structure */
 
@@ -828,10 +828,10 @@
      */
     xsh.flags = PPosition | PSize | PMinSize | PMaxSize;
     xsh.width = width;
-    xsh.max_width = ifp->if_max_width;
+    xsh.max_width = ifp->i->if_max_width;
     xsh.min_width = 0;
     xsh.height = height;
-    xsh.max_height = ifp->if_max_height;
+    xsh.max_height = ifp->i->if_max_height;
     xsh.min_height = 0;
     xsh.x = xsh.y = 0;
 
@@ -1037,7 +1037,7 @@
     unsigned int mask_blue = xi->xi_image->blue_mask << 6;
     size_t i;
 
-    FB_CK_FB(ifp);
+    FB_CK_FB(ifp->i);
 
     /*
      * Now that we know the mask, we shift a bit left, one bit at a
@@ -1102,16 +1102,16 @@
     /*
      * Figure out sizes of outermost image pixels
      */
-    x_1wd = (x_1 == xi->xi_ilf) ? xi->xi_ilf_w : ifp->if_xzoom;
-    x2wd = (x2 == xi->xi_irt) ? xi->xi_irt_w : ifp->if_xzoom;
-    y_1ht = (y_1 == xi->xi_ibt) ? xi->xi_ibt_h : ifp->if_yzoom;
-    y2ht = (y2 == xi->xi_itp) ? xi->xi_itp_h : ifp->if_yzoom;
+    x_1wd = (x_1 == xi->xi_ilf) ? xi->xi_ilf_w : ifp->i->if_xzoom;
+    x2wd = (x2 == xi->xi_irt) ? xi->xi_irt_w : ifp->i->if_xzoom;
+    y_1ht = (y_1 == xi->xi_ibt) ? xi->xi_ibt_h : ifp->i->if_yzoom;
+    y2ht = (y2 == xi->xi_itp) ? xi->xi_itp_h : ifp->i->if_yzoom;
 
     /* Compute ox: offset from left edge of window to left pixel */
 
     xdel = x_1 - xi->xi_ilf;
     if (xdel) {
-       ox = x_1wd + ((xdel - 1) * ifp->if_xzoom) + xi->xi_xlf;
+       ox = x_1wd + ((xdel - 1) * ifp->i->if_xzoom) + xi->xi_xlf;
     } else {
        ox = xi->xi_xlf;
     }
@@ -1121,7 +1121,7 @@
 
     ydel = y_1 - xi->xi_ibt;
     if (ydel) {
-       oy = xi->xi_xbt - (y_1ht + ((ydel - 1) * ifp->if_yzoom));
+       oy = xi->xi_xbt - (y_1ht + ((ydel - 1) * ifp->i->if_yzoom));
     } else {
        oy = xi->xi_xbt;
     }
@@ -1132,13 +1132,13 @@
     if (x2 == x_1) {
        xwd = x_1wd;
     } else {
-       xwd = x_1wd + x2wd + ifp->if_xzoom * (x2 - x_1 - 1);
+       xwd = x_1wd + x2wd + ifp->i->if_xzoom * (x2 - x_1 - 1);
     }
 
     if (y2 == y_1) {
        xht = y_1ht;
     } else {
-       xht = y_1ht + y2ht + ifp->if_yzoom * (y2 - y_1 - 1);
+       xht = y_1ht + y2ht + ifp->i->if_yzoom * (y2 - y_1 - 1);
     }
 
     /*
@@ -1195,7 +1195,7 @@
                        } else if (x == x2) {
                            pxwd = x2wd;
                        } else {
-                           pxwd = ifp->if_xzoom;
+                           pxwd = ifp->i->if_xzoom;
                        }
 
                        /*
@@ -1303,7 +1303,7 @@
                                                                  xi->xi_xwidth 
+ ox];
 
 
-               if (ifp->if_xzoom == 1 && ifp->if_yzoom == 1) {
+               if (ifp->i->if_xzoom == 1 && ifp->i->if_yzoom == 1) {
                    /* Special case if no zooming */
 
                    int j, k;
@@ -1367,7 +1367,7 @@
                        else if (y == y2)
                            pyht = y2ht;
                        else
-                           pyht = ifp->if_yzoom;
+                           pyht = ifp->i->if_yzoom;
 
                        /* For each line, convert/copy pixels */
 
@@ -1386,7 +1386,7 @@
                                    else if (x == x2)
                                        pxwd = x2wd;
                                    else
-                                       pxwd = ifp->if_xzoom;
+                                       pxwd = ifp->i->if_xzoom;
 
                                    r = lip[RED];
                                    g = lip[GRN];
@@ -1414,7 +1414,7 @@
                                    else if (x == x2)
                                        pxwd = x2wd;
                                    else
-                                       pxwd = ifp->if_xzoom;
+                                       pxwd = ifp->i->if_xzoom;
 
                                    r = red[lip[RED]];
                                    g = grn[lip[GRN]];
@@ -1456,7 +1456,7 @@
                unsigned char *op = (unsigned char *) &xi->xi_pix[oy *
                                                                  xi->xi_xwidth 
+ ox];
 
-               if (ifp->if_xzoom == 1 && ifp->if_yzoom == 1) {
+               if (ifp->i->if_xzoom == 1 && ifp->i->if_yzoom == 1) {
                    /* Special case if no zooming */
 
                    int j, k;
@@ -1515,7 +1515,7 @@
                        else if (y == y2)
                            pyht = y2ht;
                        else
-                           pyht = ifp->if_yzoom;
+                           pyht = ifp->i->if_yzoom;
 
 
                        /* Save pointer to start of line */
@@ -1536,7 +1536,7 @@
                                else if (x == x2)
                                    pxwd = x2wd;
                                else
-                                   pxwd = ifp->if_xzoom;
+                                   pxwd = ifp->i->if_xzoom;
 
                                /* Get/convert pixel */
 
@@ -1567,7 +1567,7 @@
                                else if (x == x2)
                                    pxwd = x2wd;
                                else
-                                   pxwd = ifp->if_xzoom;
+                                   pxwd = ifp->i->if_xzoom;
 
                                /* Get/convert pixel */
 
@@ -1622,7 +1622,7 @@
                                                                  
xi->xi_image->bytes_per_line + ox / 8];
 
 
-               if (ifp->if_xzoom == 1 && ifp->if_yzoom == 1) {
+               if (ifp->i->if_xzoom == 1 && ifp->i->if_yzoom == 1) {
                    /* Special case if no zooming */
 
                    int j, k;
@@ -1715,7 +1715,7 @@
                        else if (y == y2)
                            pyht = y2ht;
                        else
-                           pyht = ifp->if_yzoom;
+                           pyht = ifp->i->if_yzoom;
 
                        /* For each line, convert/copy pixels */
 
@@ -1735,7 +1735,7 @@
                                    else if (x == x2)
                                        pxwd = x2wd;
                                    else
-                                       pxwd = ifp->if_xzoom;
+                                       pxwd = ifp->i->if_xzoom;
 
                                    r = lip[RED];
                                    g = lip[GRN];
@@ -1773,7 +1773,7 @@
                                    else if (x == x2)
                                        pxwd = x2wd;
                                    else
-                                       pxwd = ifp->if_xzoom;
+                                       pxwd = ifp->i->if_xzoom;
 
                                    r = lip[RED];
                                    g = lip[GRN];
@@ -1864,7 +1864,7 @@
 X24_rmap(struct fb *ifp, ColorMap *cmp)
 {
     struct xinfo *xi = XI(ifp);
-    FB_CK_FB(ifp);
+    FB_CK_FB(ifp->i);
 
     memcpy(cmp, xi->xi_rgb_cmap, sizeof (ColorMap));
 
@@ -1878,7 +1878,7 @@
     struct xinfo *xi = XI(ifp);
     ColorMap *map = xi->xi_rgb_cmap;
     int waslincmap;
-    FB_CK_FB(ifp);
+    FB_CK_FB(ifp->i);
 
     /* Did we have a linear colormap before this call? */
 
@@ -1990,9 +1990,9 @@
     size_t size;
     int isnew = 0;
 
-    FB_CK_FB(ifp);
+    FB_CK_FB(ifp->i);
 
-    pixsize = ifp->if_max_height * ifp->if_max_width * sizeof(RGBpixel);
+    pixsize = ifp->i->if_max_height * ifp->i->if_max_width * sizeof(RGBpixel);
     size = pixsize + sizeof(ColorMap);
 
     /*
@@ -2091,21 +2091,21 @@
 
     int want, avail;   /* Wanted/available image pixels */
 
-    FB_CK_FB(ifp);
+    FB_CK_FB(ifp->i);
 
     /*
      * Set ?wp to the number of whole zoomed image pixels we could display
      * in the X window.
      */
-    xwp = xi->xi_xwidth / ifp->if_xzoom;
-    ywp = xi->xi_xheight / ifp->if_yzoom;
+    xwp = xi->xi_xwidth / ifp->i->if_xzoom;
+    ywp = xi->xi_xheight / ifp->i->if_yzoom;
 
     /*
      * Set ?rp to the number of leftover X pixels we have, after displaying
      * wp whole zoomed image pixels.
      */
-    xrp = xi->xi_xwidth % ifp->if_xzoom;
-    yrp = xi->xi_xheight % ifp->if_yzoom;
+    xrp = xi->xi_xwidth % ifp->i->if_xzoom;
+    yrp = xi->xi_xheight % ifp->i->if_yzoom;
 
     /*
      * Force ?wp to be the same as the window width (mod 2).  This
@@ -2115,12 +2115,12 @@
 
     if (xwp && (xwp ^ xi->xi_xwidth) & 1) {
        xwp--;
-       xrp += ifp->if_xzoom;
+       xrp += ifp->i->if_xzoom;
     }
 
     if (ywp && (ywp ^ xi->xi_xheight) & 1) {
        ywp--;
-       yrp += ifp->if_yzoom;
+       yrp += ifp->i->if_yzoom;
     }
 
     /*
@@ -2132,13 +2132,13 @@
      */
     switch (xrp) {
        case 0:
-           lf_w = ifp->if_xzoom;
-           rt_w = ifp->if_xzoom;
+           lf_w = ifp->i->if_xzoom;
+           rt_w = ifp->i->if_xzoom;
            break;
 
        case 1:
            lf_w = 1;
-           rt_w = ifp->if_xzoom;
+           rt_w = ifp->i->if_xzoom;
            xwp += 1;
            break;
 
@@ -2151,13 +2151,13 @@
 
     switch (yrp) {
        case 0:
-           tp_h = ifp->if_yzoom;
-           bt_h = ifp->if_yzoom;
+           tp_h = ifp->i->if_yzoom;
+           bt_h = ifp->i->if_yzoom;
            break;
 
        case 1:
            tp_h = 1;
-           bt_h = ifp->if_yzoom;
+           bt_h = ifp->i->if_yzoom;
            ywp += 1;
            break;
 
@@ -2187,7 +2187,7 @@
      * calculate the remaining parameters as noted.
      */
 
-    want = ifp->if_xcenter;
+    want = ifp->i->if_xcenter;
     avail = xwp/2;
     if (want >= avail) {
        /*
@@ -2216,14 +2216,14 @@
         *    x coordinate.
         */
 
-       xi->xi_xlf = lf_w + (avail - want - 1) * ifp->if_xzoom;
-       xi->xi_ilf_w = ifp->if_xzoom;
+       xi->xi_xlf = lf_w + (avail - want - 1) * ifp->i->if_xzoom;
+       xi->xi_ilf_w = ifp->i->if_xzoom;
        xi->xi_ilf = 0;
     }
 
     /* Calculation for bottom edge. */
 
-    want = ifp->if_ycenter;
+    want = ifp->i->if_ycenter;
     avail = ywp/2;
     if (want >= avail) {
        /*
@@ -2254,14 +2254,14 @@
         */
 
        xi->xi_xbt = xi->xi_xheight - (bt_h + (avail - want - 1) *
-                                      ifp->if_yzoom) - 1;
-       xi->xi_ibt_h = ifp->if_yzoom;
+                                      ifp->i->if_yzoom) - 1;
+       xi->xi_ibt_h = ifp->i->if_yzoom;
        xi->xi_ibt = 0;
     }
 
     /* Calculation for right edge. */
 
-    want = xi->xi_iwidth - ifp->if_xcenter;
+    want = xi->xi_iwidth - ifp->i->if_xcenter;
     avail =  xwp - xwp/2;
     if (want >= avail) {
        /*
@@ -2278,7 +2278,7 @@
 
        xi->xi_xrt = xi->xi_xwidth - 1;
        xi->xi_irt_w = rt_w;
-       xi->xi_irt = ifp->if_xcenter + avail - 1;
+       xi->xi_irt = ifp->i->if_xcenter + avail - 1;
     } else {
        /*
         * Not enough image pixels to fill the area.  We'll be
@@ -2293,14 +2293,14 @@
         */
 
        xi->xi_xrt = xi->xi_xwidth - (rt_w + (avail - want - 1) *
-                                     ifp->if_xzoom) - 1;
-       xi->xi_irt_w = ifp->if_xzoom;
+                                     ifp->i->if_xzoom) - 1;
+       xi->xi_irt_w = ifp->i->if_xzoom;
        xi->xi_irt = xi->xi_iwidth - 1;
     }
 
     /* Calculation for top edge. */
 
-    want = xi->xi_iheight - ifp->if_ycenter;
+    want = xi->xi_iheight - ifp->i->if_ycenter;
     avail = ywp - ywp/2;
     if (want >= avail) {
        /*
@@ -2316,7 +2316,7 @@
 
        xi->xi_xtp = 0;
        xi->xi_itp_h = tp_h;
-       xi->xi_itp = ifp->if_ycenter + avail - 1;
+       xi->xi_itp = ifp->i->if_ycenter + avail - 1;
     } else {
        /*
         * Not enough image pixels to fill the area.  We'll be
@@ -2329,8 +2329,8 @@
         *    coordinate equal to the height of the image minus 1.
         */
 
-       xi->xi_xtp = tp_h + (avail - want - 1) * ifp->if_yzoom;
-       xi->xi_itp_h = ifp->if_yzoom;
+       xi->xi_xtp = tp_h + (avail - want - 1) * ifp->i->if_yzoom;
+       xi->xi_itp_h = ifp->i->if_yzoom;
        xi->xi_itp = xi->xi_iheight - 1;
     }
 
@@ -2421,7 +2421,7 @@
     unsigned long mode;                        /* local copy */
     int getmem_stat;
 
-    FB_CK_FB(ifp);
+    FB_CK_FB(ifp->i);
 
     /*
      * First, attempt to determine operating mode for this open,
@@ -2437,7 +2437,7 @@
        int alpha;
        struct modeflags *mfp;
 
-       if (bu_strncmp(file, ifp->if_name, strlen(ifp->if_name))) {
+       if (bu_strncmp(file, ifp->i->if_name, strlen(ifp->i->if_name))) {
            /* How did this happen?? */
            mode = 0;
        } else {
@@ -2477,21 +2477,21 @@
     }
 
     if (width <= 0)
-       width = ifp->if_width;
+       width = ifp->i->if_width;
     if (height <= 0)
-       height = ifp->if_height;
-    if (width > ifp->if_max_width)
-       width = ifp->if_max_width;
-    if (height > ifp->if_max_height)
-       height = ifp->if_max_height;
+       height = ifp->i->if_height;
+    if (width > ifp->i->if_max_width)
+       width = ifp->i->if_max_width;
+    if (height > ifp->i->if_max_height)
+       height = ifp->i->if_max_height;
 
-    ifp->if_width = width;
-    ifp->if_height = height;
+    ifp->i->if_width = width;
+    ifp->i->if_height = height;
 
-    ifp->if_xzoom = 1;
-    ifp->if_yzoom = 1;
-    ifp->if_xcenter = width/2;
-    ifp->if_ycenter = height/2;
+    ifp->i->if_xzoom = 1;
+    ifp->i->if_yzoom = 1;
+    ifp->i->if_xcenter = width/2;
+    ifp->i->if_ycenter = height/2;
 
     /* create a struct of state information */
     if ((xi = (struct xinfo *) calloc(1, sizeof(struct xinfo))) == NULL) {
@@ -2523,7 +2523,7 @@
     X24_updstate(ifp);
 
     /* Make the Display connection available for selecting on */
-    ifp->if_selfd = ConnectionNumber(xi->xi_dpy);
+    ifp->i->if_selfd = ConnectionNumber(xi->xi_dpy);
 
     /* If we already have data, display it */
 
@@ -2549,7 +2549,7 @@
     struct xinfo *xi = XI(ifp);
     XRectangle rect;
 
-    FB_CK_FB(ifp);
+    FB_CK_FB(ifp->i);
 
     if (!xi) {
        return 1;
@@ -2559,14 +2559,14 @@
        return 1;
     }
 
-    ifp->if_width = ifp->if_max_width = width;
-    ifp->if_height = ifp->if_max_height = height;
+    ifp->i->if_width = ifp->i->if_max_width = width;
+    ifp->i->if_height = ifp->i->if_max_height = height;
 
     xi->xi_xwidth = xi->xi_iwidth = width;
     xi->xi_xheight = xi->xi_iheight = height;
 
-    ifp->if_xcenter = width/2;
-    ifp->if_ycenter = height/2;
+    ifp->i->if_xcenter = width/2;
+    ifp->i->if_ycenter = height/2;
 
     /* redo region */
     if (xi->xi_usereg) {
@@ -2667,14 +2667,14 @@
     struct xinfo *xi;
     int getmem_stat;
 
-    ifp->if_width = width;
-    ifp->if_height = height;
+    ifp->i->if_width = width;
+    ifp->i->if_height = height;
 
-    ifp->if_xzoom = 1;
-    ifp->if_yzoom = 1;
+    ifp->i->if_xzoom = 1;
+    ifp->i->if_yzoom = 1;
 
-    ifp->if_xcenter = width/2;
-    ifp->if_ycenter = height/2;
+    ifp->i->if_xcenter = width/2;
+    ifp->i->if_ycenter = height/2;
 
     /* create a struct of state information */
     if ((xi = (struct xinfo *)calloc(1, sizeof(struct xinfo))) == NULL) {
@@ -2806,7 +2806,7 @@
     X24_updstate(ifp);
 
     /* Make the Display connection available for selecting on */
-    ifp->if_selfd = ConnectionNumber(xi->xi_dpy);
+    ifp->i->if_selfd = ConnectionNumber(xi->xi_dpy);
 
     if (getmem_stat == 0) {
        X24_wmap(ifp, xi->xi_rgb_cmap);
@@ -2866,7 +2866,7 @@
 X24_handle_event(struct fb *ifp, XEvent *event)
 {
     struct xinfo *xi = XI(ifp);
-    FB_CK_FB(ifp);
+    FB_CK_FB(ifp->i);
 
     switch ((int)event->type) {
        case Expose:
@@ -2938,12 +2938,12 @@
                            if (x < xi->xi_ilf_w)
                                ix = xi->xi_ilf;
                            else
-                               ix = xi->xi_ilf + (x - xi->xi_ilf_w + 
ifp->if_xzoom - 1) / ifp->if_xzoom;
+                               ix = xi->xi_ilf + (x - xi->xi_ilf_w + 
ifp->i->if_xzoom - 1) / ifp->i->if_xzoom;
 
                            if (sy < xi->xi_ibt_h)
                                isy = xi->xi_ibt;
                            else
-                               isy = xi->xi_ibt + (sy - xi->xi_ibt_h + 
ifp->if_yzoom - 1) / ifp->if_yzoom;
+                               isy = xi->xi_ibt + (sy - xi->xi_ibt_h + 
ifp->i->if_yzoom - 1) / ifp->i->if_yzoom;
 
                            if (ix >= xi->xi_iwidth || isy >= xi->xi_iheight) {
                                fb_log("No RGB (outside image) 2\n");
@@ -2992,7 +2992,7 @@
 {
     struct xinfo *xi = XI(ifp);
     XEvent event;
-    FB_CK_FB(ifp);
+    FB_CK_FB(ifp->i);
 
     if (fork() != 0)
        return 1;       /* release the parent */
@@ -3009,7 +3009,7 @@
 X24_close(struct fb *ifp)
 {
     struct xinfo *xi = XI(ifp);
-    FB_CK_FB(ifp);
+    FB_CK_FB(ifp->i);
 
     XFlush(xi->xi_dpy);
     if ((xi->xi_mode & MODE1_MASK) == MODE1_LINGERING) {
@@ -3027,7 +3027,7 @@
 X24_close_existing(struct fb *ifp)
 {
     struct xinfo *xi = XI(ifp);
-    FB_CK_FB(ifp);
+    FB_CK_FB(ifp->i);
 
     if (xi->xi_image)
        XDestroyImage(xi->xi_image);
@@ -3058,7 +3058,7 @@
     int n;
     unsigned char *cp;
 
-    FB_CK_FB(ifp);
+    FB_CK_FB(ifp->i);
 
     if (pp == (unsigned char *)NULL) {
        red = grn = blu = 0;
@@ -3095,7 +3095,7 @@
 {
     struct xinfo *xi = XI(ifp);
     size_t maxcount;
-    FB_CK_FB(ifp);
+    FB_CK_FB(ifp->i);
 
     /* check origin bounds */
     if (x < 0 || x >= xi->xi_iwidth || y < 0 || y >= xi->xi_iheight)
@@ -3117,7 +3117,7 @@
     struct xinfo *xi = XI(ifp);
     size_t maxcount;
 
-    FB_CK_FB(ifp);
+    FB_CK_FB(ifp->i);
 
     /* Check origin bounds */
     if (x < 0 || x >= xi->xi_iwidth || y < 0 || y >= xi->xi_iheight)
@@ -3155,11 +3155,11 @@
 X24_view(struct fb *ifp, int xcenter, int ycenter, int xzoom, int yzoom)
 {
     struct xinfo *xi = XI(ifp);
-    FB_CK_FB(ifp);
+    FB_CK_FB(ifp->i);
 
     /* bypass if no change */
-    if (ifp->if_xcenter == xcenter && ifp->if_ycenter == ycenter
-       && ifp->if_xzoom == xcenter && ifp->if_yzoom == ycenter)
+    if (ifp->i->if_xcenter == xcenter && ifp->i->if_ycenter == ycenter
+       && ifp->i->if_xzoom == xcenter && ifp->i->if_yzoom == ycenter)
        return 0;
     /* check bounds */
     if (xcenter < 0 || xcenter >= xi->xi_iwidth
@@ -3169,10 +3169,10 @@
        || yzoom <= 0 || yzoom >= xi->xi_iheight/2)
        return -1;
 
-    ifp->if_xcenter = xcenter;
-    ifp->if_ycenter = ycenter;
-    ifp->if_xzoom = xzoom;
-    ifp->if_yzoom = yzoom;
+    ifp->i->if_xcenter = xcenter;
+    ifp->i->if_ycenter = ycenter;
+    ifp->i->if_xzoom = xzoom;
+    ifp->i->if_yzoom = yzoom;
 
     X24_updstate(ifp);
     X24_blit(ifp, 0, 0, xi->xi_iwidth, xi->xi_iheight,
@@ -3186,10 +3186,10 @@
 X24_getview(struct fb *ifp, int *xcenter, int *ycenter, int *xzoom, int *yzoom)
 {
 
-    *xcenter = ifp->if_xcenter;
-    *ycenter = ifp->if_ycenter;
-    *xzoom = ifp->if_xzoom;
-    *yzoom = ifp->if_yzoom;
+    *xcenter = ifp->i->if_xcenter;
+    *ycenter = ifp->i->if_ycenter;
+    *xzoom = ifp->i->if_xzoom;
+    *yzoom = ifp->i->if_yzoom;
 
     return 0;
 }
@@ -3199,7 +3199,7 @@
 HIDDEN int
 X24_setcursor(struct fb *ifp, const unsigned char *UNUSED(bits), int 
UNUSED(xbits), int UNUSED(ybits), int UNUSED(xorig), int UNUSED(yorig))
 {
-    FB_CK_FB(ifp);
+    FB_CK_FB(ifp->i);
 
     return 0;
 }
@@ -3229,25 +3229,25 @@
                                        CWSaveUnder | CWColormap, &xswa);
        }
 
-       delta = ifp->if_width/ifp->if_xzoom/2;
-       xx = x - (ifp->if_xcenter - delta);
-       xx *= ifp->if_xzoom;
-       xx += ifp->if_xzoom/2;  /* center cursor */
+       delta = ifp->i->if_width/ifp->i->if_xzoom/2;
+       xx = x - (ifp->i->if_xcenter - delta);
+       xx *= ifp->i->if_xzoom;
+       xx += ifp->i->if_xzoom/2;  /* center cursor */
 
-       delta = ifp->if_height/ifp->if_yzoom/2;
-       xy = y - (ifp->if_ycenter - delta);
-       xy *= ifp->if_yzoom;
-       xy += ifp->if_yzoom/2;  /* center cursor */
+       delta = ifp->i->if_height/ifp->i->if_yzoom/2;
+       xy = y - (ifp->i->if_ycenter - delta);
+       xy *= ifp->i->if_yzoom;
+       xy += ifp->i->if_yzoom/2;  /* center cursor */
        xy = xi->xi_xheight - xy;
 
        /* Move cursor into place; make it visible if it isn't */
        XMoveWindow(xi->xi_dpy, xi->xi_cwin, xx - 4, xy - 4);
 
-       if (!ifp->if_cursmode)
+       if (!ifp->i->if_cursmode)
            XMapRaised(xi->xi_dpy, xi->xi_cwin);
     } else {
        /* If we have a cursor and it's visible, hide it */
-       if (xi->xi_cwin && ifp->if_cursmode)
+       if (xi->xi_cwin && ifp->i->if_cursmode)
            XUnmapWindow(xi->xi_dpy, xi->xi_cwin);
     }
 
@@ -3255,9 +3255,9 @@
     XFlush(xi->xi_dpy);
 
     /* Update position of cursor */
-    ifp->if_cursmode = mode;
-    ifp->if_xcurs = x;
-    ifp->if_ycurs = y;
+    ifp->i->if_cursmode = mode;
+    ifp->i->if_xcurs = x;
+    ifp->i->if_ycurs = y;
 
     return 0;
 }
@@ -3276,7 +3276,7 @@
 X24_readrect(struct fb *ifp, int xmin, int ymin, int width, int height, 
unsigned char *pp)
 {
     struct xinfo *xi = XI(ifp);
-    FB_CK_FB(ifp);
+    FB_CK_FB(ifp->i);
 
     /* Clip arguments */
 
@@ -3319,7 +3319,7 @@
 X24_writerect(struct fb *ifp, int xmin, int ymin, int width, int height, const 
unsigned char *pp)
 {
     struct xinfo *xi = XI(ifp);
-    FB_CK_FB(ifp);
+    FB_CK_FB(ifp->i);
 
     /* Clip arguments */
 
@@ -3367,7 +3367,7 @@
     struct xinfo *xi = XI(ifp);
     XEvent event;
 
-    FB_CK_FB(ifp);
+    FB_CK_FB(ifp->i);
 
     /* Check for and dispatch event */
     while (XCheckMaskEvent(xi->xi_dpy, ~NoEventMask, &event))
@@ -3381,7 +3381,7 @@
 X24_flush(struct fb *ifp)
 {
     struct xinfo *xi = XI(ifp);
-    FB_CK_FB(ifp);
+    FB_CK_FB(ifp->i);
 
     XFlush(xi->xi_dpy);
     return 0;
@@ -3391,7 +3391,7 @@
 HIDDEN int
 X24_free(struct fb *ifp)
 {
-    FB_CK_FB(ifp);
+    FB_CK_FB(ifp->i);
 
     return 0;
 }
@@ -3402,16 +3402,16 @@
 {
     struct xinfo *xi = XI(ifp);
     struct modeflags *mfp;
-    FB_CK_FB(ifp);
+    FB_CK_FB(ifp->i);
 
-    fb_log("Description: %s\n", X24_interface.if_type);
-    fb_log("Device: %s\n", ifp->if_name);
+    fb_log("Description: %s\n", X24_interface.i->if_type);
+    fb_log("Device: %s\n", ifp->i->if_name);
     fb_log("Max width/height: %d %d\n",
-          X24_interface.if_max_width,
-          X24_interface.if_max_height);
+          X24_interface.i->if_max_width,
+          X24_interface.i->if_max_height);
     fb_log("Default width/height: %d %d\n",
-          X24_interface.if_width,
-          X24_interface.if_height);
+          X24_interface.i->if_width,
+          X24_interface.i->if_height);
     fb_log("Usage: /dev/X[options]\n");
     for (mfp = modeflags; mfp->c != '\0'; mfp++) {
        fb_log("   %c   %s\n", mfp->c, mfp->help);
@@ -3485,7 +3485,7 @@
 
 
 /* This is the ONLY thing that we normally "export" */
-struct fb X24_interface =  {
+struct fb_impl X24_interface_impl =  {
     0,                 /* magic number slot */
     FB_X24_MAGIC,
     X24_open,          /* open device */
@@ -3542,6 +3542,8 @@
     {0}  /* u6 */
 };
 
+struct fb X24_interface =  { &X24_interface_impl };
+
 /* Because class is actually used to access a struct
  * entry in this file, preserve our redefinition
  * of class for the benefit of avoiding C++ name

Modified: brlcad/trunk/src/libfb/if_debug.c
===================================================================
--- brlcad/trunk/src/libfb/if_debug.c   2020-04-15 23:38:07 UTC (rev 75418)
+++ brlcad/trunk/src/libfb/if_debug.c   2020-04-16 00:57:56 UTC (rev 75419)
@@ -40,7 +40,7 @@
 HIDDEN int
 deb_open(struct fb *ifp, const char *file, int width, int height)
 {
-    FB_CK_FB(ifp);
+    FB_CK_FB(ifp->i);
     if (file == (char *)NULL)
        fb_log("fb_open(%p, NULL, %d, %d)\n",
               (void *)ifp, width, height);
@@ -50,9 +50,9 @@
 
     /* check for default size */
     if (width <= 0)
-       width = ifp->if_width;
+       width = ifp->i->if_width;
     if (height <= 0)
-       height = ifp->if_height;
+       height = ifp->i->if_height;
 
     /* set debug bit vector */
     if (file != NULL) {
@@ -59,14 +59,14 @@
        const char *cp;
        for (cp = file; *cp != '\0' && !isdigit((int)*cp); cp++)
            ;
-       sscanf(cp, "%d", &ifp->if_debug);
+       sscanf(cp, "%d", &ifp->i->if_debug);
     } else {
-       ifp->if_debug = 0;
+       ifp->i->if_debug = 0;
     }
 
     /* Give the user whatever width was asked for */
-    ifp->if_width = width;
-    ifp->if_height = height;
+    ifp->i->if_width = width;
+    ifp->i->if_height = height;
 
     return 0;
 }
@@ -99,7 +99,7 @@
 HIDDEN int
 deb_close(struct fb *ifp)
 {
-    FB_CK_FB(ifp);
+    FB_CK_FB(ifp->i);
     fb_log("fb_close(%p)\n", (void *)ifp);
     return 0;
 }
@@ -119,7 +119,7 @@
 HIDDEN int
 deb_clear(struct fb *ifp, unsigned char *pp)
 {
-    FB_CK_FB(ifp);
+    FB_CK_FB(ifp->i);
     if (pp == 0)
        fb_log("fb_clear(%p, NULL)\n", (void *)ifp);
     else
@@ -134,7 +134,7 @@
 HIDDEN ssize_t
 deb_read(struct fb *ifp, int x, int y, unsigned char *pixelp, size_t count)
 {
-    FB_CK_FB(ifp);
+    FB_CK_FB(ifp->i);
     fb_log("fb_read(%p, %4d, %4d, %p, %lu)\n",
           (void *)ifp, x, y,
           (void *)pixelp, count);
@@ -147,13 +147,13 @@
 {
     size_t i;
 
-    FB_CK_FB(ifp);
+    FB_CK_FB(ifp->i);
     fb_log("fb_write(%p, %4d, %4d, %p, %ld)\n",
           (void *)ifp, x, y,
           (void *)pixelp, (long)count);
 
     /* write them out, four per line */
-    if (ifp->if_debug & FB_DEBUG_RW) {
+    if (ifp->i->if_debug & FB_DEBUG_RW) {
        for (i = 0; i < count; i++) {
            if (i % 4 == 0)
                fb_log("%4zu:", i);
@@ -173,7 +173,7 @@
 HIDDEN int
 deb_rmap(struct fb *ifp, ColorMap *cmp)
 {
-    FB_CK_FB(ifp);
+    FB_CK_FB(ifp->i);
     fb_log("fb_rmap(%p, %p)\n",
           (void *)ifp, (void *)cmp);
     return 0;
@@ -185,7 +185,7 @@
 {
     int i;
 
-    FB_CK_FB(ifp);
+    FB_CK_FB(ifp->i);
     if (cmp == NULL)
        fb_log("fb_wmap(%p, NULL)\n",
               (void *)ifp);
@@ -193,7 +193,7 @@
        fb_log("fb_wmap(%p, %p)\n",
               (void *)ifp, (void *)cmp);
 
-    if (ifp->if_debug & FB_DEBUG_CMAP && cmp != NULL) {
+    if (ifp->i->if_debug & FB_DEBUG_CMAP && cmp != NULL) {
        for (i = 0; i < 256; i++) {
            fb_log("%3d: [ 0x%4lx, 0x%4lx, 0x%4lx ]\n",
                   i,
@@ -210,7 +210,7 @@
 HIDDEN int
 deb_view(struct fb *ifp, int xcenter, int ycenter, int xzoom, int yzoom)
 {
-    FB_CK_FB(ifp);
+    FB_CK_FB(ifp->i);
     fb_log("fb_view(%p, %4d, %4d, %4d, %4d)\n",
           (void *)ifp, xcenter, ycenter, xzoom, yzoom);
     fb_sim_view(ifp, xcenter, ycenter, xzoom, yzoom);
@@ -221,7 +221,7 @@
 HIDDEN int
 deb_getview(struct fb *ifp, int *xcenter, int *ycenter, int *xzoom, int *yzoom)
 {
-    FB_CK_FB(ifp);
+    FB_CK_FB(ifp->i);
     fb_log("fb_getview(%p, %p, %p, %p, %p)\n",
           (void *)ifp, (void *)xcenter, (void *)ycenter, (void *)xzoom, (void 
*)yzoom);
     fb_sim_getview(ifp, xcenter, ycenter, xzoom, yzoom);
@@ -234,7 +234,7 @@
 HIDDEN int
 deb_setcursor(struct fb *ifp, const unsigned char *bits, int xbits, int ybits, 
int xorig, int yorig)
 {
-    FB_CK_FB(ifp);
+    FB_CK_FB(ifp->i);
     fb_log("fb_setcursor(%p, %p, %d, %d, %d, %d)\n",
           (void *)ifp, (void *)bits, xbits, ybits, xorig, yorig);
     return 0;
@@ -254,7 +254,7 @@
 HIDDEN int
 deb_getcursor(struct fb *ifp, int *mode, int *x, int *y)
 {
-    FB_CK_FB(ifp);
+    FB_CK_FB(ifp->i);
     fb_log("fb_getcursor(%p, %p, %p, %p)\n",
           (void *)ifp, (void *)mode, (void *)x, (void *)y);
     fb_sim_getcursor(ifp, mode, x, y);
@@ -266,7 +266,7 @@
 HIDDEN int
 deb_readrect(struct fb *ifp, int xmin, int ymin, int width, int height, 
unsigned char *pp)
 {
-    FB_CK_FB(ifp);
+    FB_CK_FB(ifp->i);
     fb_log("fb_readrect(%p, (%4d, %4d), %4d, %4d, %p)\n",
           (void *)ifp, xmin, ymin, width, height,
           (void *)pp);
@@ -277,7 +277,7 @@
 HIDDEN int
 deb_writerect(struct fb *ifp, int xmin, int ymin, int width, int height, const 
unsigned char *pp)
 {
-    FB_CK_FB(ifp);
+    FB_CK_FB(ifp->i);
     fb_log("fb_writerect(%p, %4d, %4d, %4d, %4d, %p)\n",
           (void *)ifp, xmin, ymin, width, height,
           (void *)pp);
@@ -288,7 +288,7 @@
 HIDDEN int
 deb_bwreadrect(struct fb *ifp, int xmin, int ymin, int width, int height, 
unsigned char *pp)
 {
-    FB_CK_FB(ifp);
+    FB_CK_FB(ifp->i);
     fb_log("fb_bwreadrect(%p, (%4d, %4d), %4d, %4d, %p)\n",
           (void *)ifp, xmin, ymin, width, height,
           (void *)pp);
@@ -299,7 +299,7 @@
 HIDDEN int
 deb_bwwriterect(struct fb *ifp, int xmin, int ymin, int width, int height, 
const unsigned char *pp)
 {
-    FB_CK_FB(ifp);
+    FB_CK_FB(ifp->i);
     fb_log("fb_bwwriterect(%p, %4d, %4d, %4d, %4d, %p)\n",
           (void *)ifp, xmin, ymin, width, height,
           (void *)pp);
@@ -310,7 +310,7 @@
 HIDDEN int
 deb_poll(struct fb *ifp)
 {
-    FB_CK_FB(ifp);
+    FB_CK_FB(ifp->i);
     fb_log("fb_poll(%p)\n", (void *)ifp);
     return 0;
 }
@@ -319,7 +319,7 @@
 HIDDEN int
 deb_flush(struct fb *ifp)
 {
-    FB_CK_FB(ifp);
+    FB_CK_FB(ifp->i);
     fb_log("if_flush(%p)\n", (void *)ifp);
     return 0;
 }
@@ -328,7 +328,7 @@
 HIDDEN int
 deb_free(struct fb *ifp)
 {
-    FB_CK_FB(ifp);
+    FB_CK_FB(ifp->i);
     fb_log("fb_free(%p)\n", (void *)ifp);
     return 0;
 }
@@ -338,15 +338,15 @@
 HIDDEN int
 deb_help(struct fb *ifp)
 {
-    FB_CK_FB(ifp);
-    fb_log("Description: %s\n", debug_interface.if_type);
-    fb_log("Device: %s\n", ifp->if_name);
+    FB_CK_FB(ifp->i);
+    fb_log("Description: %s\n", debug_interface.i->if_type);
+    fb_log("Device: %s\n", ifp->i->if_name);
     fb_log("Max width/height: %d %d\n",
-          debug_interface.if_max_width,
-          debug_interface.if_max_height);
+          debug_interface.i->if_max_width,
+          debug_interface.i->if_max_height);
     fb_log("Default width/height: %d %d\n",
-          debug_interface.if_width,
-          debug_interface.if_height);
+          debug_interface.i->if_width,
+          debug_interface.i->if_height);
     fb_log("\
 Usage: /dev/debug[#]\n\
   where # is a optional bit vector from:\n\
@@ -360,7 +360,7 @@
 
 
 /* This is the ONLY thing that we "export" */
-struct fb debug_interface = {
+struct fb_impl debug_interface_impl = {
     0,
     FB_DEBUG_MAGIC,
     deb_open,
@@ -417,6 +417,7 @@
     {0}  /* u6 */
 };
 
+struct fb debug_interface = { &debug_interface_impl };
 
 /*
  * Local Variables:

Modified: brlcad/trunk/src/libfb/if_disk.c
===================================================================
--- brlcad/trunk/src/libfb/if_disk.c    2020-04-15 23:38:07 UTC (rev 75418)
+++ brlcad/trunk/src/libfb/if_disk.c    2020-04-16 00:57:56 UTC (rev 75419)
@@ -35,7 +35,7 @@
 #include "fb.h"
 
 
-#define FILE_CMAP_SIZE ((size_t)ifp->if_width * ifp->if_height * 
sizeof(RGBpixel))
+#define FILE_CMAP_SIZE ((size_t)ifp->i->if_width * ifp->i->if_height * 
sizeof(RGBpixel))
 
 /* Ensure integer number of pixels per DMA */
 #define DISK_DMA_BYTES 
((size_t)16*(size_t)1024/sizeof(RGBpixel)*sizeof(RGBpixel))
@@ -49,13 +49,13 @@
 {
     static char zero = 0;
 
-    FB_CK_FB(ifp);
+    FB_CK_FB(ifp->i);
 
     /* check for default size */
     if (width == 0)
-       width = ifp->if_width;
+       width = ifp->i->if_width;
     if (height == 0)
-       height = ifp->if_height;
+       height = ifp->i->if_height;
 
     if (BU_STR_EQUAL(file, "-")) {
        /*
@@ -63,22 +63,22 @@
         * If it does not, then this can be stacked with /dev/mem,
         * i.e. /dev/mem -
         */
-       ifp->if_fd = 1;         /* fileno(stdout) */
-       ifp->if_width = width;
-       ifp->if_height = height;
-       ifp->if_seekpos = 0;
+       ifp->i->if_fd = 1;              /* fileno(stdout) */
+       ifp->i->if_width = width;
+       ifp->i->if_height = height;
+       ifp->i->if_seekpos = 0;
        return 0;
     }
 
-    if ((ifp->if_fd = open(file, O_RDWR | O_BINARY, 0)) == -1
-       && (ifp->if_fd = open(file, O_RDONLY | O_BINARY, 0)) == -1) {
-       if ((ifp->if_fd = open(file, O_RDWR | O_CREAT | O_BINARY, 0664)) > 0) {
+    if ((ifp->i->if_fd = open(file, O_RDWR | O_BINARY, 0)) == -1
+       && (ifp->i->if_fd = open(file, O_RDONLY | O_BINARY, 0)) == -1) {
+       if ((ifp->i->if_fd = open(file, O_RDWR | O_CREAT | O_BINARY, 0664)) > 
0) {
            /* New file, write byte at end */
-           if (lseek(ifp->if_fd, (height*width*sizeof(RGBpixel)-1), 0) == -1) {
+           if (lseek(ifp->i->if_fd, (height*width*sizeof(RGBpixel)-1), 0) == 
-1) {
                fb_log("disk_device_open : can not seek to end of new file.\n");
                return -1;
            }
-           if (write(ifp->if_fd, &zero, 1) < 0) {
+           if (write(ifp->i->if_fd, &zero, 1) < 0) {
                fb_log("disk_device_open : initial write failed.\n");
                return -1;
            }
@@ -86,15 +86,15 @@
            return -1;
     }
 
-    setmode(ifp->if_fd, O_BINARY);
+    setmode(ifp->i->if_fd, O_BINARY);
 
-    ifp->if_width = width;
-    ifp->if_height = height;
-    if (lseek(ifp->if_fd, 0, 0) == -1) {
+    ifp->i->if_width = width;
+    ifp->i->if_height = height;
+    if (lseek(ifp->i->if_fd, 0, 0) == -1) {
        fb_log("disk_device_open : can not seek to beginning.\n");
        return -1;
     }
-    ifp->if_seekpos = 0;
+    ifp->i->if_seekpos = 0;
     return 0;
 }
 
@@ -138,7 +138,7 @@
 HIDDEN int
 dsk_close(struct fb *ifp)
 {
-    return close(ifp->if_fd);
+    return close(ifp->i->if_fd);
 }
 
 
@@ -145,8 +145,8 @@
 HIDDEN int
 dsk_free(struct fb *ifp)
 {
-    close(ifp->if_fd);
-    if (bu_file_delete(ifp->if_name)) {
+    close(ifp->i->if_fd);
+    if (bu_file_delete(ifp->i->if_name)) {
        return 0;
     } else {
        return 1;
@@ -173,20 +173,20 @@
     }
 
     /* Set start of framebuffer */
-    fd = ifp->if_fd;
-    if (ifp->if_seekpos != 0 && lseek(fd, 0, 0) == -1) {
+    fd = ifp->i->if_fd;
+    if (ifp->i->if_seekpos != 0 && lseek(fd, 0, 0) == -1) {
        fb_log("disk_color_clear : seek failed.\n");
        return -1;
     }
 
     /* Send until frame buffer is full. */
-    pixelstodo = ifp->if_height * ifp->if_width;
+    pixelstodo = ifp->i->if_height * ifp->i->if_width;
     while (pixelstodo > 0) {
        i = pixelstodo > DISK_DMA_PIXELS ? DISK_DMA_PIXELS : pixelstodo;
        if (write(fd, pix_buf, i * sizeof(RGBpixel)) == -1)
            return -1;
        pixelstodo -= i;
-       ifp->if_seekpos += i * sizeof(RGBpixel);
+       ifp->i->if_seekpos += i * sizeof(RGBpixel);
     }
 
     return 0;
@@ -213,17 +213,17 @@
     ssize_t got;
     size_t dest;
     size_t bytes_read = 0;
-    int fd = ifp->if_fd;
+    int fd = ifp->i->if_fd;
 
     /* Reads on stdout make no sense.  Take reads from stdin. */
     if (fd == 1) fd = 0;
 
-    dest = ((y * ifp->if_width) + x) * sizeof(RGBpixel);
-    if (ifp->if_seekpos != dest && lseek(fd, dest, 0) == -1) {
+    dest = ((y * ifp->i->if_width) + x) * sizeof(RGBpixel);
+    if (ifp->i->if_seekpos != dest && lseek(fd, dest, 0) == -1) {
        fb_log("disk_buffer_read : seek to %ld failed.\n", dest);
        return -1;
     }
-    ifp->if_seekpos = dest;
+    ifp->i->if_seekpos = dest;
     while (bytes > 0) {
        todo = bytes;
        if ((got = read(fd, (char *) pixelp, todo)) != (ssize_t)todo) {
@@ -246,7 +246,7 @@
        }
        bytes -= got;
        pixelp += got;
-       ifp->if_seekpos += got;
+       ifp->i->if_seekpos += got;
        bytes_read += got;
     }
     return bytes_read/sizeof(RGBpixel);
@@ -260,18 +260,18 @@
     ssize_t todo;
     size_t dest;
 
-    dest = (y * ifp->if_width + x) * sizeof(RGBpixel);
-    if (dest != ifp->if_seekpos) {
-       if (lseek(ifp->if_fd, (b_off_t)dest, 0) == -1) {
+    dest = (y * ifp->i->if_width + x) * sizeof(RGBpixel);
+    if (dest != ifp->i->if_seekpos) {
+       if (lseek(ifp->i->if_fd, (b_off_t)dest, 0) == -1) {
            fb_log("disk_buffer_write : seek to %zd failed.\n", dest);
            return -1;
        }
-       ifp->if_seekpos = dest;
+       ifp->i->if_seekpos = dest;
     }
     while (bytes > 0) {
        ssize_t ret;
        todo = bytes;
-       ret = write(ifp->if_fd, (char *) pixelp, todo);
+       ret = write(ifp->i->if_fd, (char *) pixelp, todo);
        if (ret != todo) {
            fb_log("disk_buffer_write: write failed\n");
            return -1;
@@ -278,7 +278,7 @@
        }
        bytes -= todo;
        pixelp += todo / sizeof(RGBpixel);
-       ifp->if_seekpos += todo;
+       ifp->i->if_seekpos += todo;
     }
     return count;
 }
@@ -287,12 +287,12 @@
 HIDDEN int
 dsk_rmap(struct fb *ifp, ColorMap *cmap)
 {
-    int fd = ifp->if_fd;
+    int fd = ifp->i->if_fd;
 
     /* Reads on stdout make no sense.  Take reads from stdin. */
     if (fd == 1) fd = 0;
 
-    if (ifp->if_seekpos != FILE_CMAP_SIZE &&
+    if (ifp->i->if_seekpos != FILE_CMAP_SIZE &&
        lseek(fd, (b_off_t)FILE_CMAP_SIZE, 0) == -1) {
        fb_log("disk_colormap_read : seek to %zd failed.\n", FILE_CMAP_SIZE);
        return -1;
@@ -316,11 +316,11 @@
        return 0;
     if (fb_is_linear_cmap(cmap))
        return 0;
-    if (lseek(ifp->if_fd, (b_off_t)FILE_CMAP_SIZE, 0) == -1) {
+    if (lseek(ifp->i->if_fd, (b_off_t)FILE_CMAP_SIZE, 0) == -1) {
        fb_log("disk_colormap_write : seek to %zd failed.\n", FILE_CMAP_SIZE);
        return -1;
     }
-    if (write(ifp->if_fd, (char *)cmap, sizeof(ColorMap))
+    if (write(ifp->i->if_fd, (char *)cmap, sizeof(ColorMap))
        != sizeof(ColorMap)) {
        fb_log("disk_colormap_write : write failed.\n");
        return -1;
@@ -332,19 +332,19 @@
 HIDDEN int
 dsk_help(struct fb *ifp)
 {
-    fb_log("Description: %s\n", disk_interface.if_type);
-    fb_log("Device: %s\n", ifp->if_name);
+    fb_log("Description: %s\n", disk_interface.i->if_type);
+    fb_log("Device: %s\n", ifp->i->if_name);
     fb_log("Max width/height: %d %d\n",
-          disk_interface.if_max_width,
-          disk_interface.if_max_height);
+          disk_interface.i->if_max_width,
+          disk_interface.i->if_max_height);
     fb_log("Default width/height: %d %d\n",
-          disk_interface.if_width,
-          disk_interface.if_height);
-    if (ifp->if_fd == 1) {
+          disk_interface.i->if_width,
+          disk_interface.i->if_height);
+    if (ifp->i->if_fd == 1) {
        fb_log("File \"-\" reads from stdin, writes to stdout\n");
     } else {
        fb_log("Note: you may have just created a disk file\n");
-       fb_log("called \"%s\" by running this.\n", ifp->if_name);
+       fb_log("called \"%s\" by running this.\n", ifp->i->if_name);
     }
 
     return 0;
@@ -351,7 +351,7 @@
 }
 
 
-struct fb disk_interface = {
+struct fb_impl disk_interface_impl = {
     0,
     FB_DISK_MAGIC,
     dsk_open,
@@ -408,6 +408,7 @@
     {0}  /* u6 */
 };
 
+struct fb disk_interface = { &disk_interface_impl };
 
 /*
  * Local Variables:

Modified: brlcad/trunk/src/libfb/if_mem.c
===================================================================
--- brlcad/trunk/src/libfb/if_mem.c     2020-04-15 23:38:07 UTC (rev 75418)
+++ brlcad/trunk/src/libfb/if_mem.c     2020-04-16 00:57:56 UTC (rev 75419)
@@ -50,8 +50,8 @@
     int cmap_dirty;    /* !0 implies unflushed written cmap */
     int write_thru;    /* !0 implies pass-thru write mode */
 };
-#define MI(ptr) ((struct mem_info *)((ptr)->u1.p))
-#define MIL(ptr) ((ptr)->u1.p)         /* left hand side version */
+#define MI(ptr) ((struct mem_info *)((ptr)->i->u1.p))
+#define MIL(ptr) ((ptr)->i->u1.p)              /* left hand side version */
 
 #define MODE_1MASK     (1<<1)
 #define MODE_1BUFFERED (0<<1)          /* output flushed only at close */
@@ -86,7 +86,7 @@
     int alpha;
     struct modeflags *mfp;
 
-    FB_CK_FB(ifp);
+    FB_CK_FB(ifp->i);
 
     /* This function doesn't look like it will work if file
      * is NULL - stop before we start, if that's the case.*/
@@ -149,19 +149,19 @@
            return -1;
        }
        MI(ifp)->fbp = fbp;
-       ifp->if_width = fbp->if_width;
-       ifp->if_height = fbp->if_height;
-       ifp->if_selfd = fbp->if_selfd;
+       ifp->i->if_width = fbp->i->if_width;
+       ifp->i->if_height = fbp->i->if_height;
+       ifp->i->if_selfd = fbp->i->if_selfd;
        if ((mode & MODE_1MASK) == MODE_1IMMEDIATE)
            MI(ifp)->write_thru = 1;
     } else {
        /* no frame buffer specified */
        if (width > 0)
-           ifp->if_width = width;
+           ifp->i->if_width = width;
        if (height > 0)
-           ifp->if_height = height;
+           ifp->i->if_height = height;
     }
-    if ((MI(ifp)->mem = (unsigned char *)calloc(ifp->if_width*ifp->if_height, 
3)) == NULL) {
+    if ((MI(ifp)->mem = (unsigned char 
*)calloc(ifp->i->if_width*ifp->i->if_height, 3)) == NULL) {
        fb_log("mem_open:  memory buffer malloc failed\n");
        (void)free(MIL(ifp));
        return -1;
@@ -171,11 +171,11 @@
        /* Pre read all of the image data and cmap */
        int got;
        got = fb_readrect(MI(ifp)->fbp, 0, 0,
-                         ifp->if_width, ifp->if_height,
+                         ifp->i->if_width, ifp->i->if_height,
                          (unsigned char *)MI(ifp)->mem);
-       if (got != ifp->if_width * ifp->if_height) {
+       if (got != ifp->i->if_width * ifp->i->if_height) {
            fb_log("if_mem:  WARNING: pre-read of %d only got %d, your image is 
truncated.\n",
-                  ifp->if_width * ifp->if_height, got);
+                  ifp->i->if_width * ifp->i->if_height, got);
        }
        if (fb_rmap(MI(ifp)->fbp, &(MI(ifp)->cmap)) < 0)
            fb_make_linear_cmap(&(MI(ifp)->cmap));
@@ -236,7 +236,7 @@
        }
        if (MI(ifp)->mem_dirty) {
            fb_writerect(MI(ifp)->fbp, 0, 0,
-                        ifp->if_width, ifp->if_height, (unsigned char 
*)MI(ifp)->mem);
+                        ifp->i->if_width, ifp->i->if_height, (unsigned char 
*)MI(ifp)->mem);
        }
        fb_close(MI(ifp)->fbp);
        MI(ifp)->fbp = FB_NULL;
@@ -265,13 +265,13 @@
 
     cp = MI(ifp)->mem;
     if (v[RED] == v[GRN] && v[RED] == v[BLU]) {
-       int bytes = ifp->if_width*ifp->if_height*3;
+       int bytes = ifp->i->if_width*ifp->i->if_height*3;
        if (v[RED] == 0)
            memset((char *)cp, 0, bytes);       /* all black */
        else
            memset(cp, v[RED], bytes);  /* all grey */
     } else {
-       for (n = ifp->if_width*ifp->if_height; n; n--) {
+       for (n = ifp->i->if_width*ifp->i->if_height; n; n--) {
            *cp++ = v[RED];
            *cp++ = v[GRN];
            *cp++ = v[BLU];
@@ -291,15 +291,15 @@
 {
     size_t pixels_to_end;
 
-    if (x < 0 || x >= ifp->if_width || y < 0 || y >= ifp->if_height)
+    if (x < 0 || x >= ifp->i->if_width || y < 0 || y >= ifp->i->if_height)
        return -1;
 
     /* make sure we don't run off the end of the buffer */
-    pixels_to_end = ifp->if_width*ifp->if_height - (y*ifp->if_width + x);
+    pixels_to_end = ifp->i->if_width*ifp->i->if_height - (y*ifp->i->if_width + 
x);
     if (pixels_to_end < count)
        count = pixels_to_end;
 
-    memcpy((char *)pixelp, &(MI(ifp)->mem[(y*ifp->if_width + x)*3]), count*3);
+    memcpy((char *)pixelp, &(MI(ifp)->mem[(y*ifp->i->if_width + x)*3]), 
count*3);
 
     return count;
 }
@@ -310,15 +310,15 @@
 {
     size_t pixels_to_end;
 
-    if (x < 0 || x >= ifp->if_width || y < 0 || y >= ifp->if_height)
+    if (x < 0 || x >= ifp->i->if_width || y < 0 || y >= ifp->i->if_height)
        return -1;
 
     /* make sure we don't run off the end of the buffer */
-    pixels_to_end = ifp->if_width*ifp->if_height - (y*ifp->if_width + x);
+    pixels_to_end = ifp->i->if_width*ifp->i->if_height - (y*ifp->i->if_width + 
x);
     if (pixels_to_end < count)
        count = pixels_to_end;
 
-    memcpy(&(MI(ifp)->mem[(y*ifp->if_width + x)*3]), (char *)pixelp, count*3);
+    memcpy(&(MI(ifp)->mem[(y*ifp->i->if_width + x)*3]), (char *)pixelp, 
count*3);
 
     if (MI(ifp)->write_thru) {
        return fb_write(MI(ifp)->fbp, x, y, pixelp, count);
@@ -435,7 +435,7 @@
        }
        if (MI(ifp)->mem_dirty) {
            fb_writerect(MI(ifp)->fbp, 0, 0,
-                        ifp->if_width, ifp->if_height, (unsigned char 
*)MI(ifp)->mem);
+                        ifp->i->if_width, ifp->i->if_height, (unsigned char 
*)MI(ifp)->mem);
            MI(ifp)->mem_dirty = 0;
        }
        return fb_flush(MI(ifp)->fbp);
@@ -452,14 +452,14 @@
 {
     struct modeflags *mfp;
 
-    fb_log("Description: %s\n", memory_interface.if_type);
-    fb_log("Device: %s\n", ifp->if_name);
+    fb_log("Description: %s\n", memory_interface.i->if_type);
+    fb_log("Device: %s\n", ifp->i->if_name);
     fb_log("Max width/height: %d %d\n",
-          memory_interface.if_max_width,
-          memory_interface.if_max_height);
+          memory_interface.i->if_max_width,
+          memory_interface.i->if_max_height);
     fb_log("Default width/height: %d %d\n",
-          memory_interface.if_width,
-          memory_interface.if_height);
+          memory_interface.i->if_width,
+          memory_interface.i->if_height);
     fb_log("Usage: /dev/mem[options] [attached_framebuffer]\n");
     for (mfp = modeflags; mfp->c != '\0'; mfp++) {
        fb_log("   %c   %s\n", mfp->c, mfp->help);
@@ -469,7 +469,7 @@
 
 
 /* This is the ONLY thing that we normally "export" */
-struct fb memory_interface =  {
+struct fb_impl memory_interface_impl =  {
     0,
     FB_MEMORY_MAGIC,
     mem_open,          /* device_open */
@@ -526,6 +526,7 @@
     {0}  /* u6 */
 };
 
+struct fb memory_interface =  { &memory_interface_impl };
 
 /*
  * Local Variables:

Modified: brlcad/trunk/src/libfb/if_null.c
===================================================================
--- brlcad/trunk/src/libfb/if_null.c    2020-04-15 23:38:07 UTC (rev 75418)
+++ brlcad/trunk/src/libfb/if_null.c    2020-04-16 00:57:56 UTC (rev 75419)
@@ -40,12 +40,12 @@
 HIDDEN int
 _fb_null_open(struct fb *ifp, const char *UNUSED(file), int width, int height)
 {
-    FB_CK_FB(ifp);
+    FB_CK_FB(ifp->i);
 
     if (width > 0)
-       ifp->if_width = width;
+       ifp->i->if_width = width;
     if (height > 0)
-       ifp->if_height = height;
+       ifp->i->if_height = height;
 
     return 0;
 }
@@ -90,7 +90,7 @@
 HIDDEN int
 _fb_null_close(struct fb *ifp)
 {
-    FB_CK_FB(ifp);
+    FB_CK_FB(ifp->i);
 
     return 0;
 }
@@ -99,7 +99,7 @@
 HIDDEN int
 _fb_null_clear(struct fb *ifp, unsigned char *UNUSED(pp))
 {
-    FB_CK_FB(ifp);
+    FB_CK_FB(ifp->i);
 
     return 0;
 }
@@ -108,7 +108,7 @@
 HIDDEN ssize_t
 _fb_null_read(struct fb *ifp, int UNUSED(x), int UNUSED(y), unsigned char 
*UNUSED(pixelp), size_t count)
 {
-    FB_CK_FB(ifp);
+    FB_CK_FB(ifp->i);
 
     return count;
 }
@@ -117,7 +117,7 @@
 HIDDEN ssize_t
 _fb_null_write(struct fb *ifp, int UNUSED(x), int UNUSED(y), const unsigned 
char *UNUSED(pixelp), size_t count)
 {
-    FB_CK_FB(ifp);
+    FB_CK_FB(ifp->i);
 
     return count;
 }
@@ -126,7 +126,7 @@
 HIDDEN int
 _fb_null_rmap(struct fb *ifp, ColorMap *UNUSED(cmp))
 {
-    FB_CK_FB(ifp);
+    FB_CK_FB(ifp->i);
 
     return 0;
 }
@@ -135,7 +135,7 @@
 HIDDEN int
 _fb_null_wmap(struct fb *ifp, const ColorMap *UNUSED(cmp))
 {
-    FB_CK_FB(ifp);
+    FB_CK_FB(ifp->i);
 
     return 0;
 }
@@ -144,7 +144,7 @@
 HIDDEN int
 _fb_null_view(struct fb *ifp, int UNUSED(xcenter), int UNUSED(ycenter), int 
UNUSED(xzoom), int UNUSED(yzoom))
 {
-    FB_CK_FB(ifp);
+    FB_CK_FB(ifp->i);
 
     /*fb_sim_view(ifp, xcenter, ycenter, xzoom, yzoom);*/
     return 0;
@@ -154,7 +154,7 @@
 HIDDEN int
 _fb_null_getview(struct fb *ifp, int *UNUSED(xcenter), int *UNUSED(ycenter), 
int *UNUSED(xzoom), int *UNUSED(yzoom))
 {
-    FB_CK_FB(ifp);
+    FB_CK_FB(ifp->i);
 
     /*fb_sim_getview(ifp, xcenter, ycenter, xzoom, yzoom);*/
     return 0;
@@ -164,7 +164,7 @@
 HIDDEN int
 _fb_null_setcursor(struct fb *ifp, const unsigned char *UNUSED(bits), int 
UNUSED(xbits), int UNUSED(ybits), int UNUSED(xorig), int UNUSED(yorig))
 {
-    FB_CK_FB(ifp);
+    FB_CK_FB(ifp->i);
 
     return 0;
 }
@@ -173,7 +173,7 @@
 HIDDEN int
 _fb_null_cursor(struct fb *ifp, int UNUSED(mode), int UNUSED(x), int UNUSED(y))
 {
-    FB_CK_FB(ifp);
+    FB_CK_FB(ifp->i);
 
     /*fb_sim_cursor(ifp, mode, x, y);*/
     return 0;
@@ -183,7 +183,7 @@
 HIDDEN int
 _fb_null_getcursor(struct fb *ifp, int *UNUSED(mode), int *UNUSED(x), int 
*UNUSED(y))
 {
-    FB_CK_FB(ifp);
+    FB_CK_FB(ifp->i);
 
     /*fb_sim_getcursor(ifp, mode, x, y);*/
     return 0;
@@ -193,7 +193,7 @@
 HIDDEN int
 _fb_null_readrect(struct fb *ifp, int UNUSED(xmin), int UNUSED(ymin), int 
width, int height, unsigned char *UNUSED(pp))
 {
-    FB_CK_FB(ifp);
+    FB_CK_FB(ifp->i);
 
     return width*height;
 }
@@ -202,7 +202,7 @@
 HIDDEN int
 _fb_null_writerect(struct fb *ifp, int UNUSED(xmin), int UNUSED(ymin), int 
width, int height, const unsigned char *UNUSED(pp))
 {
-    FB_CK_FB(ifp);
+    FB_CK_FB(ifp->i);
 
     return width*height;
 }
@@ -211,7 +211,7 @@
 HIDDEN int
 _fb_null_poll(struct fb *ifp)
 {
-    FB_CK_FB(ifp);
+    FB_CK_FB(ifp->i);
 
     return 0;
 }
@@ -220,7 +220,7 @@
 HIDDEN int
 _fb_null_flush(struct fb *ifp)
 {
-    FB_CK_FB(ifp);
+    FB_CK_FB(ifp->i);
 
     return 0;
 }
@@ -229,7 +229,7 @@
 HIDDEN int
 _fb_null_free(struct fb *ifp)
 {
-    FB_CK_FB(ifp);
+    FB_CK_FB(ifp->i);
 
     return 0;
 }
@@ -238,16 +238,16 @@
 HIDDEN int
 _fb_null_help(struct fb *ifp)
 {
-    FB_CK_FB(ifp);
+    FB_CK_FB(ifp->i);
 
-    fb_log("Description: %s\n", fb_null_interface.if_type);
-    fb_log("Device: %s\n", ifp->if_name);
+    fb_log("Description: %s\n", fb_null_interface.i->if_type);
+    fb_log("Device: %s\n", ifp->i->if_name);
     fb_log("Max width/height: %d %d\n",
-          fb_null_interface.if_max_width,
-          fb_null_interface.if_max_height);
+          fb_null_interface.i->if_max_width,
+          fb_null_interface.i->if_max_height);
     fb_log("Default width/height: %d %d\n",
-          fb_null_interface.if_width,
-          fb_null_interface.if_height);
+          fb_null_interface.i->if_width,
+          fb_null_interface.i->if_height);
     fb_log("Useful for Benchmarking/Debugging\n");
     return 0;
 }
@@ -254,7 +254,7 @@
 
 
 /* This is the ONLY thing that we normally "export" */
-struct fb fb_null_interface =  {
+struct fb_impl fb_null_interface_impl =  {
     0,
     FB_NULL_MAGIC,
     _fb_null_open,             /* device_open */
@@ -311,6 +311,7 @@
     {0}  /* u6 */
 };
 
+struct fb fb_null_interface =  { &fb_null_interface_impl };
 
 /*
  * Local Variables:

Modified: brlcad/trunk/src/libfb/if_ogl.c
===================================================================
--- brlcad/trunk/src/libfb/if_ogl.c     2020-04-15 23:38:07 UTC (rev 75418)
+++ brlcad/trunk/src/libfb/if_ogl.c     2020-04-16 00:57:56 UTC (rev 75419)
@@ -132,15 +132,15 @@
 };
 
 
-#define WIN(ptr) ((struct wininfo *)((ptr)->u1.p))
-#define WINL(ptr) ((ptr)->u1.p)        /* left hand side version */
-#define OGL(ptr) ((struct oglinfo *)((ptr)->u6.p))
-#define OGLL(ptr) ((ptr)->u6.p)        /* left hand side version */
+#define WIN(ptr) ((struct wininfo *)((ptr)->i->u1.p))
+#define WINL(ptr) ((ptr)->i->u1.p)     /* left hand side version */
+#define OGL(ptr) ((struct oglinfo *)((ptr)->i->u6.p))
+#define OGLL(ptr) ((ptr)->i->u6.p)     /* left hand side version */
 #define if_mem u2.p            /* shared memory pointer */
 #define if_cmap u3.p           /* color map in shared memory */
-#define CMR(x) ((struct fb_cmap *)((x)->if_cmap))->cmr
-#define CMG(x) ((struct fb_cmap *)((x)->if_cmap))->cmg
-#define CMB(x) ((struct fb_cmap *)((x)->if_cmap))->cmb
+#define CMR(x) ((struct fb_cmap *)((x)->i->if_cmap))->cmr
+#define CMG(x) ((struct fb_cmap *)((x)->i->if_cmap))->cmg
+#define CMB(x) ((struct fb_cmap *)((x)->i->if_cmap))->cmb
 #define if_zoomflag u4.l       /* zoom > 1 */
 #define if_mode u5.l           /* see MODE_* defines */
 
@@ -231,7 +231,7 @@
        glDrawBuffer(GL_FRONT);
        glMatrixMode(GL_PROJECTION);
        glPopMatrix();
-       glPixelZoom((float) ifp->if_xzoom, (float) ifp->if_yzoom);
+       glPixelZoom((float) ifp->i->if_xzoom, (float) ifp->i->if_yzoom);
     }
 
     clp = &(OGL(ifp)->clip);
@@ -258,7 +258,7 @@
         * than if_width
         */
        /* Blank out area right of image */
-       if (clp->xscrmax >= OGL(ifp)->vp_width) glRecti(ifp->if_width - 
CLIP_XTRA,
+       if (clp->xscrmax >= OGL(ifp)->vp_width) glRecti(ifp->i->if_width - 
CLIP_XTRA,
                                                        clp->yscrmin - 
CLIP_XTRA,
                                                        clp->xscrmax + 
CLIP_XTRA,
                                                        clp->yscrmax + 
CLIP_XTRA);
@@ -348,14 +348,14 @@
                                          CLIP_XTRA);
 
            /* Blank out area right of image */
-           if (clp->xscrmax >= ifp->if_width) glRecti(ifp->if_width - 
CLIP_XTRA,
+           if (clp->xscrmax >= ifp->i->if_width) glRecti(ifp->i->if_width - 
CLIP_XTRA,
                                                       clp->yscrmin - CLIP_XTRA,
                                                       clp->xscrmax + CLIP_XTRA,
                                                       clp->yscrmax + 
CLIP_XTRA);
 
            /* Blank out area above image */
-           if (clp->yscrmax >= ifp->if_height) glRecti(clp->xscrmin - 
CLIP_XTRA,
-                                                       ifp->if_height- 
CLIP_XTRA,
+           if (clp->yscrmax >= ifp->i->if_height) glRecti(clp->xscrmin - 
CLIP_XTRA,
+                                                       ifp->i->if_height- 
CLIP_XTRA,
                                                        clp->xscrmax + 
CLIP_XTRA,
                                                        clp->yscrmax + 
CLIP_XTRA);
 
@@ -387,7 +387,7 @@
            printf("Doing sw colormap xmit\n");
 
        /* Perform software color mapping into temp scanline */
-       scanline = (struct fb_pixel *)calloc(ifp->if_width, sizeof(struct 
fb_pixel));
+       scanline = (struct fb_pixel *)calloc(ifp->i->if_width, sizeof(struct 
fb_pixel));
        if (scanline == NULL) {
            fb_log("ogl_getmem: scanline memory malloc failed\n");
            return;
@@ -394,7 +394,7 @@
        }
 
        for (n=nlines; n>0; n--, y++) {
-           oglp = (struct fb_pixel *)&ifp->if_mem[(y*WIN(ifp)->mi_pixwidth) * 
sizeof(struct fb_pixel)];
+           oglp = (struct fb_pixel *)&ifp->i->if_mem[(y*WIN(ifp)->mi_pixwidth) 
* sizeof(struct fb_pixel)];
            for (x=xbase+npix-1; x>=xbase; x--) {
                scanline[x].red   = CMR(ifp)[oglp[x].red];
                scanline[x].green = CMG(ifp)[oglp[x].green];
@@ -416,7 +416,7 @@
        glPixelStorei(GL_UNPACK_SKIP_ROWS, ybase);
 
        glRasterPos2i(xbase, ybase);
-       glDrawPixels(npix, nlines, GL_BGRA_EXT, GL_UNSIGNED_BYTE, (const GLvoid 
*) ifp->if_mem);
+       glDrawPixels(npix, nlines, GL_BGRA_EXT, GL_UNSIGNED_BYTE, (const GLvoid 
*) ifp->i->if_mem);
     }
 }
 
@@ -477,7 +477,7 @@
 
     errno = 0;
 
-    pixsize = ifp->if_height * ifp->if_width * sizeof(struct fb_pixel);
+    pixsize = ifp->i->if_height * ifp->i->if_width * sizeof(struct fb_pixel);
 
     /* shared memory behaves badly if we try to allocate too much, so
      * arbitrarily constrain it to our default 1000x1000 size & samller.
@@ -484,13 +484,13 @@
      */
     if (pixsize > sizeof(struct fb_pixel)*1000*1000) {
        /* let the user know */
-       ifp->if_mode |= MODE_1MALLOC;
+       ifp->i->if_mode |= MODE_1MALLOC;
        /* fb_log("ogl_getmem: image too big for shared memory, using 
private\n"); */
     }
 
-    if ((ifp->if_mode & MODE_1MASK) == MODE_1MALLOC) {
+    if ((ifp->i->if_mode & MODE_1MASK) == MODE_1MALLOC) {
        /* In this mode, only malloc as much memory as is needed. */
-       WIN(ifp)->mi_pixwidth = ifp->if_width;
+       WIN(ifp)->mi_pixwidth = ifp->i->if_width;
        size = pixsize + sizeof(struct fb_cmap);
 
        sp = (char *)calloc(1, size);
@@ -503,9 +503,9 @@
 
     } else {
        /* The shared memory section never changes size */
-       WIN(ifp)->mi_pixwidth = ifp->if_max_width;
+       WIN(ifp)->mi_pixwidth = ifp->i->if_max_width;
 
-       pixsize = ifp->if_max_height * ifp->if_max_width * sizeof(struct 
fb_pixel);
+       pixsize = ifp->i->if_max_height * ifp->i->if_max_width * sizeof(struct 
fb_pixel);
        size = pixsize + sizeof(struct fb_cmap);
 
        shm_result = bu_shmget(&(WIN(ifp)->mi_shmid), &sp, SHMEM_KEY, size);
@@ -514,7 +514,7 @@
            memset(sp, 0, size); /* match calloc */
            new_mem = 1;
        } else if (shm_result == 1) {
-           ifp->if_mode |= MODE_1MALLOC;
+           ifp->i->if_mode |= MODE_1MALLOC;
            fb_log("ogl_getmem:  Unable to attach to shared memory, using 
private\n");
            if ((sp = (char *)calloc(1, size)) == NULL) {
                fb_log("ogl_getmem:  malloc failure\n");
@@ -524,8 +524,8 @@
        }
     }
 
-    ifp->if_mem = sp;
-    ifp->if_cmap = sp + pixsize; /* cmap at end of area */
+    ifp->i->if_mem = sp;
+    ifp->i->if_cmap = sp + pixsize; /* cmap at end of area */
     i = CMB(ifp)[255];          /* try to deref last word */
     CMB(ifp)[255] = i;
 
@@ -583,17 +583,17 @@
 
     clp = &(OGL(ifp)->clip);
 
-    i = OGL(ifp)->vp_width/(2*ifp->if_xzoom);
-    clp->xscrmin = ifp->if_xcenter - i;
-    i = OGL(ifp)->vp_width/ifp->if_xzoom;
+    i = OGL(ifp)->vp_width/(2*ifp->i->if_xzoom);
+    clp->xscrmin = ifp->i->if_xcenter - i;
+    i = OGL(ifp)->vp_width/ifp->i->if_xzoom;
     clp->xscrmax = clp->xscrmin + i;
     pixels = (double) i;
     clp->oleft = ((double) clp->xscrmin) - 0.25*pixels/((double) 
OGL(ifp)->vp_width);
     clp->oright = clp->oleft + pixels;
 
-    i = OGL(ifp)->vp_height/(2*ifp->if_yzoom);
-    clp->yscrmin = ifp->if_ycenter - i;
-    i = OGL(ifp)->vp_height/ifp->if_yzoom;
+    i = OGL(ifp)->vp_height/(2*ifp->i->if_yzoom);
+    clp->yscrmin = ifp->i->if_ycenter - i;
+    i = OGL(ifp)->vp_height/ifp->i->if_yzoom;
     clp->yscrmax = clp->yscrmin + i;
     pixels = (double) i;
     clp->obottom = ((double) clp->yscrmin) - 0.25*pixels/((double) 
OGL(ifp)->vp_height);
@@ -624,11 +624,11 @@
            clp->ypixmax = OGL(ifp)->vp_height-1;
        }
     } else {
-       if (clp->xpixmax > ifp->if_width-1) {
-           clp->xpixmax = ifp->if_width-1;
+       if (clp->xpixmax > ifp->i->if_width-1) {
+           clp->xpixmax = ifp->i->if_width-1;
        }
-       if (clp->ypixmax > ifp->if_height-1) {
-           clp->ypixmax = ifp->if_height-1;
+       if (clp->ypixmax > ifp->i->if_height-1) {
+           clp->ypixmax = ifp->i->if_height-1;
        }
     }
 
@@ -660,13 +660,13 @@
            glDrawBuffer(GL_FRONT);
        }
 
-       if ((ifp->if_mode & MODE_4MASK) == MODE_4NODITH) {
+       if ((ifp->i->if_mode & MODE_4MASK) == MODE_4NODITH) {
            glDisable(GL_DITHER);
        }
 
        /* set copy mode if possible and requested */
        if (WIN(ifp)->mi_doublebuffer &&
-           ((ifp->if_mode & MODE_11MASK)==MODE_11COPY)) {
+           ((ifp->i->if_mode & MODE_11MASK)==MODE_11COPY)) {
            /* Copy mode only works if there are two
             * buffers to use. It conflicts with
             * double buffering
@@ -691,12 +691,12 @@
        /* Set normal viewport size to minimum of actual window
         * size and requested framebuffer size
         */
-       OGL(ifp)->vp_width = (OGL(ifp)->win_width < ifp->if_width) ?
-           OGL(ifp)->win_width : ifp->if_width;
-       OGL(ifp)->vp_height = (OGL(ifp)->win_height < ifp->if_height) ?
-           OGL(ifp)->win_height : ifp->if_height;
-       ifp->if_xcenter = OGL(ifp)->vp_width/2;
-       ifp->if_ycenter = OGL(ifp)->vp_height/2;
+       OGL(ifp)->vp_width = (OGL(ifp)->win_width < ifp->i->if_width) ?
+           OGL(ifp)->win_width : ifp->i->if_width;
+       OGL(ifp)->vp_height = (OGL(ifp)->win_height < ifp->i->if_height) ?
+           OGL(ifp)->win_height : ifp->i->if_height;
+       ifp->i->if_xcenter = OGL(ifp)->vp_width/2;
+       ifp->i->if_ycenter = OGL(ifp)->vp_height/2;
 
        /* center viewport in window */
        WIN(ifp)->mi_xoff=(OGL(ifp)->win_width-OGL(ifp)->vp_width)/2;
@@ -712,9 +712,9 @@
        glLoadIdentity();
        glOrtho(clp->oleft, clp->oright, clp->obottom, clp->otop,
                -1.0, 1.0);
-       glPixelZoom((float) ifp->if_xzoom, (float) ifp->if_yzoom);
-    } else if ((OGL(ifp)->win_width > ifp->if_width) ||
-              (OGL(ifp)->win_height > ifp->if_height)) {
+       glPixelZoom((float) ifp->i->if_xzoom, (float) ifp->i->if_yzoom);
+    } else if ((OGL(ifp)->win_width > ifp->i->if_width) ||
+              (OGL(ifp)->win_height > ifp->i->if_height)) {
        /* clear whole buffer if window larger than framebuffer */
        if (OGL(ifp)->copy_flag && !OGL(ifp)->front_flag) {
            glDrawBuffer(GL_FRONT);
@@ -737,7 +737,7 @@
     }
 
     /* repaint entire image */
-    ogl_xmit_scanlines(ifp, 0, ifp->if_height, 0, ifp->if_width);
+    ogl_xmit_scanlines(ifp, 0, ifp->i->if_height, 0, ifp->i->if_width);
     if (WIN(ifp)->mi_doublebuffer) {
        glXSwapBuffers(OGL(ifp)->dispp, OGL(ifp)->wind);
     } else if (OGL(ifp)->copy_flag) {
@@ -770,17 +770,17 @@
        height == OGL(ifp)->win_height)
        return 1;
 
-    ifp->if_width = ifp->if_max_width = width;
-    ifp->if_height = ifp->if_max_height = height;
+    ifp->i->if_width = ifp->i->if_max_width = width;
+    ifp->i->if_height = ifp->i->if_max_height = height;
 
     OGL(ifp)->win_width = OGL(ifp)->vp_width = width;
     OGL(ifp)->win_height = OGL(ifp)->vp_height = height;
 
-    ifp->if_zoomflag = 0;
-    ifp->if_xzoom = 1;
-    ifp->if_yzoom = 1;
-    ifp->if_xcenter = width/2;
-    ifp->if_ycenter = height/2;
+    ifp->i->if_zoomflag = 0;
+    ifp->i->if_xzoom = 1;
+    ifp->i->if_yzoom = 1;
+    ifp->i->if_xcenter = width/2;
+    ifp->i->if_ycenter = height/2;
 
     ogl_getmem(ifp);
     fb_clipper(ifp);
@@ -827,7 +827,7 @@
                                register struct fb_pixel *oglp;
 
                                x = event.xbutton.x;
-                               y = ifp->if_height - event.xbutton.y - 1;
+                               y = ifp->i->if_height - event.xbutton.y - 1;
 
                                if (x < 0 || y < 0) {
                                    fb_log("No RGB (outside image viewport)\n");
@@ -834,7 +834,7 @@
                                    break;
                                }
 
-                               oglp = (struct fb_pixel *)&ifp->if_mem[
+                               oglp = (struct fb_pixel *)&ifp->i->if_mem[
                                    (y*WIN(ifp)->mi_pixwidth)*
                                    sizeof(struct fb_pixel) ];
 
@@ -903,8 +903,8 @@
     int m_hard_cmap, m_sing_buf, m_doub_buf;
     int use, rgba, dbfr;
 
-    m_hard_cmap = ((ifp->if_mode & MODE_7MASK)==MODE_7NORMAL);
-    m_sing_buf  = ((ifp->if_mode & MODE_9MASK)==MODE_9SINGLEBUF);
+    m_hard_cmap = ((ifp->i->if_mode & MODE_7MASK)==MODE_7NORMAL);
+    m_sing_buf  = ((ifp->i->if_mode & MODE_9MASK)==MODE_9SINGLEBUF);
     m_doub_buf =  !m_sing_buf;
 
     memset((void *)&_template, 0, sizeof(XVisualInfo));
@@ -1026,7 +1026,7 @@
     long valuemask;
     XSetWindowAttributes swa;
 
-    FB_CK_FB(ifp);
+    FB_CK_FB(ifp->i);
 
     /*
      * First, attempt to determine operating mode for this open,
@@ -1042,7 +1042,7 @@
        int alpha;
        struct modeflags *mfp;
 
-       if (bu_strncmp(file, ifp->if_name, strlen(ifp->if_name))) {
+       if (bu_strncmp(file, ifp->i->if_name, strlen(ifp->i->if_name))) {
            /* How did this happen? */
            mode = 0;
        } else {
@@ -1081,9 +1081,9 @@
        }
     }
 #if DIRECT_COLOR_VISUAL_ALLOWED
-    ifp->if_mode = mode;
+    ifp->i->if_mode = mode;
 #else
-    ifp->if_mode = mode|MODE_7SWCMAP;
+    ifp->i->if_mode = mode|MODE_7SWCMAP;
 #endif
 
     /*
@@ -1105,17 +1105,17 @@
 
     /* use defaults if invalid width and height specified */
     if (width <= 0)
-       width = ifp->if_width;
+       width = ifp->i->if_width;
     if (height <= 0)
-       height = ifp->if_height;
+       height = ifp->i->if_height;
     /* use max values if width and height are greater */
-    if (width > ifp->if_max_width)
-       width = ifp->if_max_width;
-    if (height > ifp->if_max_height)
-       height = ifp->if_max_height;
+    if (width > ifp->i->if_max_width)
+       width = ifp->i->if_max_width;
+    if (height > ifp->i->if_max_height)
+       height = ifp->i->if_max_height;
 
-    ifp->if_width = width;
-    ifp->if_height = height;
+    ifp->i->if_width = width;
+    ifp->i->if_height = height;
 
     /* Attach to shared memory, potentially with a screen repaint */
     if (ogl_getmem(ifp) < 0)
@@ -1125,19 +1125,19 @@
 
     /* Build a descriptive window title bar */
     snprintf(title, 128, "BRL-CAD /dev/ogl %s, %s",
-            ((ifp->if_mode & MODE_2MASK) == MODE_2TRANSIENT) ?
+            ((ifp->i->if_mode & MODE_2MASK) == MODE_2TRANSIENT) ?
             "Transient Win":
             "Lingering Win",
-            ((ifp->if_mode & MODE_1MASK) == MODE_1MALLOC) ?
+            ((ifp->i->if_mode & MODE_1MASK) == MODE_1MALLOC) ?
             "Private Mem" :
             "Shared Mem");
 
     /* initialize window state variables before calling ogl_getmem */
-    ifp->if_zoomflag = 0;
-    ifp->if_xzoom = 1; /* for zoom fakeout */
-    ifp->if_yzoom = 1; /* for zoom fakeout */
-    ifp->if_xcenter = width/2;
-    ifp->if_ycenter = height/2;
+    ifp->i->if_zoomflag = 0;
+    ifp->i->if_xzoom = 1;      /* for zoom fakeout */
+    ifp->i->if_yzoom = 1;      /* for zoom fakeout */
+    ifp->i->if_xcenter = width/2;
+    ifp->i->if_ycenter = height/2;
 
     /* Open an X connection to the display.  Sending NULL to XOpenDisplay
        tells it to use the DISPLAY environment variable. */
@@ -1145,7 +1145,7 @@
        fb_log("fb_ogl_open: Failed to open display.  Check DISPLAY environment 
variable.\n");
        return -1;
     }
-    ifp->if_selfd = ConnectionNumber(OGL(ifp)->dispp);
+    ifp->i->if_selfd = ConnectionNumber(OGL(ifp)->dispp);
     if (FB_DEBUG)
        printf("Connection opened to X display on fd %d.\n", 
ConnectionNumber(OGL(ifp)->dispp));
 
@@ -1249,7 +1249,7 @@
        OGL(ifp)->wind = XCreateWindowDebug(OGL(ifp)->dispp,
                                            RootWindow(OGL(ifp)->dispp,
                                                       OGL(ifp)->vip->screen),
-                                           0, 0, ifp->if_width, 
ifp->if_height, 0,
+                                           0, 0, ifp->i->if_width, 
ifp->i->if_height, 0,
                                            OGL(ifp)->vip->depth,
                                            InputOutput,
                                            OGL(ifp)->vip->visual,
@@ -1258,7 +1258,7 @@
        OGL(ifp)->wind = XCreateWindow(OGL(ifp)->dispp,
                                       RootWindow(OGL(ifp)->dispp,
                                                  OGL(ifp)->vip->screen),
-                                      0, 0, ifp->if_width, ifp->if_height, 0,
+                                      0, 0, ifp->i->if_width, 
ifp->i->if_height, 0,
                                       OGL(ifp)->vip->depth,
                                       InputOutput,
                                       OGL(ifp)->vip->visual,
@@ -1286,7 +1286,7 @@
 open_existing(struct fb *ifp, Display *dpy, Window win, Colormap cmap, 
XVisualInfo *vip, int width, int height, GLXContext glxc, int double_buffer, 
int soft_cmap)
 {
     /*XXX for now use private memory */
-    ifp->if_mode = MODE_1MALLOC;
+    ifp->i->if_mode = MODE_1MALLOC;
 
     /*
      * Allocate extension memory sections,
@@ -1307,8 +1307,8 @@
     /* default to no shared memory */
     WIN(ifp)->mi_shmid = -1;
 
-    ifp->if_width = ifp->if_max_width = width;
-    ifp->if_height = ifp->if_max_height = height;
+    ifp->i->if_width = ifp->i->if_max_width = width;
+    ifp->i->if_height = ifp->i->if_max_height = height;
 
     OGL(ifp)->win_width = OGL(ifp)->vp_width = width;
     OGL(ifp)->win_height = OGL(ifp)->vp_height = height;
@@ -1316,11 +1316,11 @@
     WIN(ifp)->mi_curs_on = 1;
 
     /* initialize window state variables before calling ogl_getmem */
-    ifp->if_zoomflag = 0;
-    ifp->if_xzoom = 1; /* for zoom fakeout */
-    ifp->if_yzoom = 1; /* for zoom fakeout */
-    ifp->if_xcenter = width/2;
-    ifp->if_ycenter = height/2;
+    ifp->i->if_zoomflag = 0;
+    ifp->i->if_xzoom = 1;      /* for zoom fakeout */
+    ifp->i->if_yzoom = 1;      /* for zoom fakeout */
+    ifp->i->if_xcenter = width/2;
+    ifp->i->if_ycenter = height/2;
 
     /* Attach to shared memory, potentially with a screen repaint */
     if (ogl_getmem(ifp) < 0)
@@ -1327,7 +1327,7 @@
        return -1;
 
     OGL(ifp)->dispp = dpy;
-    ifp->if_selfd = ConnectionNumber(OGL(ifp)->dispp);
+    ifp->i->if_selfd = ConnectionNumber(OGL(ifp)->dispp);
 
     OGL(ifp)->vip = vip;
     OGL(ifp)->glxc = glxc;
@@ -1398,7 +1398,7 @@
            errno = 0;
 
            /* detach from shared memory */
-           if (shmdt(ifp->if_mem) == -1) {
+           if (shmdt(ifp->i->if_mem) == -1) {
                fb_log("fb_ogl_close: shmdt failed, errno=%d\n", errno);
                perror("shmdt");
                return -1;
@@ -1405,7 +1405,7 @@
            }
        } else {
            /* free private memory */
-           (void)free(ifp->if_mem);
+           (void)free(ifp->i->if_mem);
        }
 
        /* free state information */
@@ -1448,13 +1448,13 @@
     if (FB_DEBUG)
        printf("flushing, copy flag is %d\n", OGL(ifp)->copy_flag);
 
-    if ((ifp->if_mode & MODE_12MASK) == MODE_12DELAY_WRITES_TILL_FLUSH) {
+    if ((ifp->i->if_mode & MODE_12MASK) == MODE_12DELAY_WRITES_TILL_FLUSH) {
        if (glXMakeCurrent(OGL(ifp)->dispp, OGL(ifp)->wind, 
OGL(ifp)->glxc)==False) {
            fb_log("Warning, ogl_flush: glXMakeCurrent unsuccessful.\n");
        }
 
        /* Send entire in-memory buffer to the screen, all at once */
-       ogl_xmit_scanlines(ifp, 0, ifp->if_height, 0, ifp->if_width);
+       ogl_xmit_scanlines(ifp, 0, ifp->i->if_height, 0, ifp->i->if_width);
        if (WIN(ifp)->mi_doublebuffer) {
            glXSwapBuffers(OGL(ifp)->dispp, OGL(ifp)->wind);
        } else if (OGL(ifp)->copy_flag) {
@@ -1495,7 +1495,7 @@
      * call final_close if not lingering
      */
     if (ogl_nwindows > 1 ||
-       (ifp->if_mode & MODE_2MASK) == MODE_2TRANSIENT)
+       (ifp->i->if_mode & MODE_2MASK) == MODE_2TRANSIENT)
        return ogl_final_close(ifp);
 
     if (FB_DEBUG)
@@ -1546,7 +1546,7 @@
     /* Close the framebuffer */
     ret = ogl_final_close(ifp);
 
-    if ((ifp->if_mode & MODE_1MASK) == MODE_1SHARED) {
+    if ((ifp->i->if_mode & MODE_1MASK) == MODE_1SHARED) {
        /* If shared mem, release the shared memory segment */
        ogl_zapmem();
     }
@@ -1579,10 +1579,10 @@
     }
 
     /* Flood rectangle in shared memory */
-    for (y = 0; y < ifp->if_height; y++) {
-       oglp = (struct fb_pixel *)&ifp->if_mem[
+    for (y = 0; y < ifp->i->if_height; y++) {
+       oglp = (struct fb_pixel *)&ifp->i->if_mem[
            (y*WIN(ifp)->mi_pixwidth)*sizeof(struct fb_pixel) ];
-       for (cnt = ifp->if_width-1; cnt >= 0; cnt--) {
+       for (cnt = ifp->i->if_width-1; cnt >= 0; cnt--) {
            *oglp++ = bg;       /* struct copy */
        }
     }
@@ -1638,25 +1638,25 @@
 
     if (xzoom < 1) xzoom = 1;
     if (yzoom < 1) yzoom = 1;
-    if (ifp->if_xcenter == xcenter && ifp->if_ycenter == ycenter
-       && ifp->if_xzoom == xzoom && ifp->if_yzoom == yzoom)
+    if (ifp->i->if_xcenter == xcenter && ifp->i->if_ycenter == ycenter
+       && ifp->i->if_xzoom == xzoom && ifp->i->if_yzoom == yzoom)
        return 0;
 
-    if (xcenter < 0 || xcenter >= ifp->if_width)
+    if (xcenter < 0 || xcenter >= ifp->i->if_width)
        return -1;
-    if (ycenter < 0 || ycenter >= ifp->if_height)
+    if (ycenter < 0 || ycenter >= ifp->i->if_height)
        return -1;
-    if (xzoom >= ifp->if_width || yzoom >= ifp->if_height)
+    if (xzoom >= ifp->i->if_width || yzoom >= ifp->i->if_height)
        return -1;
 
-    ifp->if_xcenter = xcenter;
-    ifp->if_ycenter = ycenter;
-    ifp->if_xzoom = xzoom;
-    ifp->if_yzoom = yzoom;
+    ifp->i->if_xcenter = xcenter;
+    ifp->i->if_ycenter = ycenter;
+    ifp->i->if_xzoom = xzoom;
+    ifp->i->if_yzoom = yzoom;
 
-    if (ifp->if_xzoom > 1 || ifp->if_yzoom > 1)
-       ifp->if_zoomflag = 1;
-    else ifp->if_zoomflag = 0;
+    if (ifp->i->if_xzoom > 1 || ifp->i->if_yzoom > 1)
+       ifp->i->if_zoomflag = 1;
+    else ifp->i->if_zoomflag = 0;
 
 
     if (OGL(ifp)->use_ext_ctrl) {
@@ -1681,12 +1681,12 @@
        fb_clipper(ifp);
        clp = &(OGL(ifp)->clip);
        glOrtho(clp->oleft, clp->oright, clp->obottom, clp->otop, -1.0, 1.0);
-       glPixelZoom((float) ifp->if_xzoom, (float) ifp->if_yzoom);
+       glPixelZoom((float) ifp->i->if_xzoom, (float) ifp->i->if_yzoom);
 
        if (OGL(ifp)->copy_flag) {
            backbuffer_to_screen(ifp, -1);
        } else {
-           ogl_xmit_scanlines(ifp, 0, ifp->if_height, 0, ifp->if_width);
+           ogl_xmit_scanlines(ifp, 0, ifp->i->if_height, 0, ifp->i->if_width);
            if (WIN(ifp)->mi_doublebuffer) {
                glXSwapBuffers(OGL(ifp)->dispp, OGL(ifp)->wind);
            }
@@ -1707,10 +1707,10 @@
     if (FB_DEBUG)
        printf("entering ogl_getview\n");
 
-    *xcenter = ifp->if_xcenter;
-    *ycenter = ifp->if_ycenter;
-    *xzoom = ifp->if_xzoom;
-    *yzoom = ifp->if_yzoom;
+    *xcenter = ifp->i->if_xcenter;
+    *ycenter = ifp->i->if_ycenter;
+    *xzoom = ifp->i->if_xzoom;
+    *yzoom = ifp->i->if_yzoom;
 
     return 0;
 }
@@ -1729,8 +1729,8 @@
     if (FB_DEBUG)
        printf("entering ogl_read\n");
 
-    if (x < 0 || x >= ifp->if_width ||
-       y < 0 || y >= ifp->if_height)
+    if (x < 0 || x >= ifp->i->if_width ||
+       y < 0 || y >= ifp->i->if_height)
        return -1;
 
     ret = 0;
@@ -1737,15 +1737,15 @@
     cp = (unsigned char *)(pixelp);
 
     while (count) {
-       if (y >= ifp->if_height)
+       if (y >= ifp->i->if_height)
            break;
 
-       if (count >= (size_t)(ifp->if_width-x))
-           scan_count = ifp->if_width-x;
+       if (count >= (size_t)(ifp->i->if_width-x))
+           scan_count = ifp->i->if_width-x;
        else
            scan_count = count;
 
-       oglp = (struct fb_pixel *)&ifp->if_mem[
+       oglp = (struct fb_pixel *)&ifp->i->if_mem[
            (y*WIN(ifp)->mi_pixwidth+x)*sizeof(struct fb_pixel) ];
 
        n = scan_count;
@@ -1761,7 +1761,7 @@
        count -= scan_count;
        x = 0;
        /* Advance upwards */
-       if (++y >= ifp->if_height)
+       if (++y >= ifp->i->if_height)
            break;
     }
     return ret;
@@ -1791,8 +1791,8 @@
     x = xstart;
     ybase = y = ystart;
 
-    if (x < 0 || x >= ifp->if_width ||
-       y < 0 || y >= ifp->if_height)
+    if (x < 0 || x >= ifp->i->if_width ||
+       y < 0 || y >= ifp->i->if_height)
        return -1;
 
     ret = 0;
@@ -1802,15 +1802,15 @@
        size_t n;
        register struct fb_pixel *oglp;
 
-       if (y >= ifp->if_height)
+       if (y >= ifp->i->if_height)
            break;
 
-       if (pix_count >= (size_t)(ifp->if_width-x))
-           scan_count = (size_t)(ifp->if_width-x);
+       if (pix_count >= (size_t)(ifp->i->if_width-x))
+           scan_count = (size_t)(ifp->i->if_width-x);
        else
            scan_count = pix_count;
 
-       oglp = (struct fb_pixel *)&ifp->if_mem[
+       oglp = (struct fb_pixel *)&ifp->i->if_mem[
            (y*WIN(ifp)->mi_pixwidth+x)*sizeof(struct fb_pixel) ];
 
        n = scan_count;
@@ -1848,11 +1848,11 @@
        ret += scan_count;
        pix_count -= scan_count;
        x = 0;
-       if (++y >= ifp->if_height)
+       if (++y >= ifp->i->if_height)
            break;
     }
 
-    if ((ifp->if_mode & MODE_12MASK) == MODE_12DELAY_WRITES_TILL_FLUSH)
+    if ((ifp->i->if_mode & MODE_12MASK) == MODE_12DELAY_WRITES_TILL_FLUSH)
        return ret;
 
     if (!OGL(ifp)->use_ext_ctrl) {
@@ -1861,7 +1861,7 @@
            fb_log("Warning, ogl_write: glXMakeCurrent unsuccessful.\n");
        }
 
-       if (xstart + count < (size_t)ifp->if_width) {
+       if (xstart + count < (size_t)ifp->i->if_width) {
            ogl_xmit_scanlines(ifp, ybase, 1, xstart, count);
            if (WIN(ifp)->mi_doublebuffer) {
                glXSwapBuffers(OGL(ifp)->dispp, OGL(ifp)->wind);
@@ -1873,11 +1873,11 @@
            /* Normal case -- multi-pixel write */
            if (WIN(ifp)->mi_doublebuffer) {
                /* refresh whole screen */
-               ogl_xmit_scanlines(ifp, 0, ifp->if_height, 0, ifp->if_width);
+               ogl_xmit_scanlines(ifp, 0, ifp->i->if_height, 0, 
ifp->i->if_width);
                glXSwapBuffers(OGL(ifp)->dispp, OGL(ifp)->wind);
            } else {
                /* just write rectangle */
-               ogl_xmit_scanlines(ifp, ybase, y-ybase, 0, ifp->if_width);
+               ogl_xmit_scanlines(ifp, ybase, y-ybase, 0, ifp->i->if_width);
                if (OGL(ifp)->copy_flag) {
                    backbuffer_to_screen(ifp, -1);
                }
@@ -1913,13 +1913,13 @@
 
     if (width <= 0 || height <= 0)
        return 0;  /* do nothing */
-    if (xmin < 0 || xmin+width > ifp->if_width ||
-       ymin < 0 || ymin+height > ifp->if_height)
+    if (xmin < 0 || xmin+width > ifp->i->if_width ||
+       ymin < 0 || ymin+height > ifp->i->if_height)
        return -1; /* no can do */
 
     cp = (unsigned char *)(pp);
     for (y = ymin; y < ymin+height; y++) {
-       oglp = (struct fb_pixel *)&ifp->if_mem[
+       oglp = (struct fb_pixel *)&ifp->i->if_mem[
            (y*WIN(ifp)->mi_pixwidth+xmin)*sizeof(struct fb_pixel) ];
        for (x = xmin; x < xmin+width; x++) {
            /* alpha channel is always zero */
@@ -1931,7 +1931,7 @@
        }
     }
 
-    if ((ifp->if_mode & MODE_12MASK) == MODE_12DELAY_WRITES_TILL_FLUSH)
+    if ((ifp->i->if_mode & MODE_12MASK) == MODE_12DELAY_WRITES_TILL_FLUSH)
        return width*height;
 
     if (!OGL(ifp)->use_ext_ctrl) {
@@ -1941,7 +1941,7 @@
 
        if (WIN(ifp)->mi_doublebuffer) {
            /* refresh whole screen */
-           ogl_xmit_scanlines(ifp, 0, ifp->if_height, 0, ifp->if_width);
+           ogl_xmit_scanlines(ifp, 0, ifp->i->if_height, 0, ifp->i->if_width);
            glXSwapBuffers(OGL(ifp)->dispp, OGL(ifp)->wind);
        } else {
            /* just write rectangle*/
@@ -1978,13 +1978,13 @@
 
     if (width <= 0 || height <= 0)
        return 0;  /* do nothing */
-    if (xmin < 0 || xmin+width > ifp->if_width ||
-       ymin < 0 || ymin+height > ifp->if_height)
+    if (xmin < 0 || xmin+width > ifp->i->if_width ||
+       ymin < 0 || ymin+height > ifp->i->if_height)
        return -1; /* no can do */
 
     cp = (unsigned char *)(pp);
     for (y = ymin; y < ymin+height; y++) {
-       oglp = (struct fb_pixel *)&ifp->if_mem[
+       oglp = (struct fb_pixel *)&ifp->i->if_mem[
            (y*WIN(ifp)->mi_pixwidth+xmin)*sizeof(struct fb_pixel) ];
        for (x = xmin; x < xmin+width; x++) {
            register int val;
@@ -1996,7 +1996,7 @@
        }
     }
 
-    if ((ifp->if_mode & MODE_12MASK) == MODE_12DELAY_WRITES_TILL_FLUSH)
+    if ((ifp->i->if_mode & MODE_12MASK) == MODE_12DELAY_WRITES_TILL_FLUSH)
        return width*height;
 
     if (!OGL(ifp)->use_ext_ctrl) {
@@ -2006,7 +2006,7 @@
 
        if (WIN(ifp)->mi_doublebuffer) {
            /* refresh whole screen */
-           ogl_xmit_scanlines(ifp, 0, ifp->if_height, 0, ifp->if_width);
+           ogl_xmit_scanlines(ifp, 0, ifp->i->if_height, 0, ifp->i->if_width);
            glXSwapBuffers(OGL(ifp)->dispp, OGL(ifp)->wind);
        } else {
            /* just write rectangle*/
@@ -2075,7 +2075,7 @@
                fb_log("Warning, ogl_wmap: glXMakeCurrent unsuccessful.\n");
            }
 
-           ogl_xmit_scanlines(ifp, 0, ifp->if_height, 0, ifp->if_width);
+           ogl_xmit_scanlines(ifp, 0, ifp->i->if_height, 0, ifp->i->if_width);
            if (WIN(ifp)->mi_doublebuffer) {
                glXSwapBuffers(OGL(ifp)->dispp, OGL(ifp)->wind);
            } else if (OGL(ifp)->copy_flag) {
@@ -2109,14 +2109,14 @@
     struct modeflags *mfp;
     XVisualInfo *visual = OGL(ifp)->vip;
 
-    fb_log("Description: %s\n", ifp->if_type);
-    fb_log("Device: %s\n", ifp->if_name);
+    fb_log("Description: %s\n", ifp->i->if_type);
+    fb_log("Device: %s\n", ifp->i->if_name);
     fb_log("Max width height: %d %d\n",
-          ifp->if_max_width,
-          ifp->if_max_height);
+          ifp->i->if_max_width,
+          ifp->i->if_max_height);
     fb_log("Default width height: %d %d\n",
-          ifp->if_width,
-          ifp->if_height);
+          ifp->i->if_width,
+          ifp->i->if_height);
     fb_log("Usage: /dev/ogl[option letters]\n");
     for (mfp = modeflags; mfp->c != '\0'; mfp++) {
        fb_log("   %c   %s\n", mfp->c, mfp->help);
@@ -2170,7 +2170,7 @@
 HIDDEN int
 ogl_setcursor(struct fb *ifp, const unsigned char *UNUSED(bits), int 
UNUSED(xbits), int UNUSED(ybits), int UNUSED(xorig), int UNUSED(yorig))
 {
-    FB_CK_FB(ifp);
+    FB_CK_FB(ifp->i);
 
     return 0;
 }
@@ -2204,15 +2204,15 @@
                                             CWSaveUnder | CWColormap, &xswa);
        }
 
-       delta = ifp->if_width/ifp->if_xzoom/2;
-       xx = x - (ifp->if_xcenter - delta);
-       xx *= ifp->if_xzoom;
-       xx += ifp->if_xzoom/2;  /* center cursor */
+       delta = ifp->i->if_width/ifp->i->if_xzoom/2;
+       xx = x - (ifp->i->if_xcenter - delta);
+       xx *= ifp->i->if_xzoom;
+       xx += ifp->i->if_xzoom/2;  /* center cursor */
 
-       delta = ifp->if_height/ifp->if_yzoom/2;
-       xy = y - (ifp->if_ycenter - delta);
-       xy *= ifp->if_yzoom;
-       xy += ifp->if_yzoom/2;  /* center cursor */
+       delta = ifp->i->if_height/ifp->i->if_yzoom/2;
+       xy = y - (ifp->i->if_ycenter - delta);
+       xy *= ifp->i->if_yzoom;
+       xy += ifp->i->if_yzoom/2;  /* center cursor */
        xy = OGL(ifp)->win_height - xy;
 
        /* Move cursor into place; make it visible if it isn't */
@@ -2219,11 +2219,11 @@
        XMoveWindow(OGL(ifp)->dispp, OGL(ifp)->cursor, xx - 4, xy - 4);
 
        /* if cursor window is currently not mapped, map it */
-       if (!ifp->if_cursmode)
+       if (!ifp->i->if_cursmode)
            XMapRaised(OGL(ifp)->dispp, OGL(ifp)->cursor);
     } else {
        /* If we have a cursor and it's mapped, unmap it */
-       if (OGL(ifp)->cursor && ifp->if_cursmode)
+       if (OGL(ifp)->cursor && ifp->i->if_cursmode)
            XUnmapWindow(OGL(ifp)->dispp, OGL(ifp)->cursor);
     }
 
@@ -2231,9 +2231,9 @@
     XFlush(OGL(ifp)->dispp);
 
     /* Update position of cursor */
-    ifp->if_cursmode = mode;
-    ifp->if_xcurs = x;
-    ifp->if_ycurs = y;
+    ifp->i->if_cursmode = mode;
+    ifp->i->if_xcurs = x;
+    ifp->i->if_ycurs = y;
 
     return 0;
 }
@@ -2264,7 +2264,7 @@
     fb_clipper(ifp);
     clp = &(OGL(ifp)->clip);
     glOrtho(clp->oleft, clp->oright, clp->obottom, clp->otop, -1.0, 1.0);
-    glPixelZoom((float) ifp->if_xzoom, (float) ifp->if_yzoom);
+    glPixelZoom((float) ifp->i->if_xzoom, (float) ifp->i->if_yzoom);
 
     glMatrixMode(GL_MODELVIEW);
     glPushMatrix();
@@ -2287,8 +2287,7 @@
 
 
 /* This is the ONLY thing that we normally "export" */
-struct fb ogl_interface =
-{
+struct fb_impl ogl_interface_impl =  {
     0,                 /* magic number slot */
     FB_OGL_MAGIC,
     fb_ogl_open,       /* open device */
@@ -2346,6 +2345,8 @@
 };
 
 
+struct fb ogl_interface =  { &ogl_interface_impl };
+
 /* Because class is actually used to access a struct
  * entry in this file, preserve our redefinition
  * of class for the benefit of avoiding C++ name

Modified: brlcad/trunk/src/libfb/if_osgl.cpp
===================================================================
--- brlcad/trunk/src/libfb/if_osgl.cpp  2020-04-15 23:38:07 UTC (rev 75418)
+++ brlcad/trunk/src/libfb/if_osgl.cpp  2020-04-16 00:57:56 UTC (rev 75419)
@@ -461,7 +461,7 @@
 HIDDEN int
 fb_osgl_open(struct fb *ifp, const char *UNUSED(file), int width, int height)
 {
-    FB_CK_FB(ifp);
+    FB_CK_FB(ifp->i);
 
     ifp->if_mode = MODE_2LINGERING;
 
@@ -1027,7 +1027,7 @@
     size_t pix_count;   /* # pixels to send */
     ssize_t ret;
 
-    FB_CK_FB(ifp);
+    FB_CK_FB(ifp->i);
 
     if (FB_DEBUG)
        printf("entering osgl_write\n");
@@ -1384,7 +1384,7 @@
 HIDDEN int
 osgl_setcursor(struct fb *ifp, const unsigned char *UNUSED(bits), int 
UNUSED(xbits), int UNUSED(ybits), int UNUSED(xorig), int UNUSED(yorig))
 {
-    FB_CK_FB(ifp);
+    FB_CK_FB(ifp->i);
 
     // If it should ever prove desirable to alter the cursor or disable it, 
here's how it is done:

@@ Diff output truncated at 100000 characters. @@
This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to