Revision: 76685
http://sourceforge.net/p/brlcad/code/76685
Author: starseeker
Date: 2020-08-07 14:43:24 +0000 (Fri, 07 Aug 2020)
Log Message:
-----------
Merge trunk changes through r76684
Modified Paths:
--------------
brlcad/branches/bioh/include/dm.h
brlcad/branches/bioh/src/fbserv/fbserv.c
brlcad/branches/bioh/src/fbserv/server.c
brlcad/branches/bioh/src/libdm/X/dm-X.c
brlcad/branches/bioh/src/libdm/dm-generic.c
brlcad/branches/bioh/src/libdm/dm_plugins.cpp
brlcad/branches/bioh/src/libdm/glx/dm-ogl.c
brlcad/branches/bioh/src/libdm/include/calltable.h
brlcad/branches/bioh/src/libdm/null/dm-Null.c
brlcad/branches/bioh/src/libdm/osgl/dm-osgl.cpp
brlcad/branches/bioh/src/libdm/plot/dm-plot.c
brlcad/branches/bioh/src/libdm/postscript/dm-ps.c
brlcad/branches/bioh/src/libdm/qt/dm-qt.cpp
brlcad/branches/bioh/src/libdm/tk/dm-tk.c
brlcad/branches/bioh/src/libdm/txt/dm-txt.c
brlcad/branches/bioh/src/libdm/wgl/dm-wgl.c
brlcad/branches/bioh/src/mged/CMakeLists.txt
brlcad/branches/bioh/src/mged/attach.c
brlcad/branches/bioh/src/mged/fbserv.c
Removed Paths:
-------------
brlcad/branches/bioh/src/mged/fbserv.h
Property Changed:
----------------
brlcad/branches/bioh/
brlcad/branches/bioh/include/
Index: brlcad/branches/bioh
===================================================================
--- brlcad/branches/bioh 2020-08-07 14:38:45 UTC (rev 76684)
+++ brlcad/branches/bioh 2020-08-07 14:43:24 UTC (rev 76685)
Property changes on: brlcad/branches/bioh
___________________________________________________________________
Modified: svn:mergeinfo
## -9,4 +9,4 ##
/brlcad/branches/osg:62110-62113
/brlcad/branches/prep-cache:68236-68933
/brlcad/branches/tcltk86:68300-75257
-/brlcad/trunk:75720-76157,76160-76365,76386-76676
\ No newline at end of property
+/brlcad/trunk:75720-76157,76160-76365,76386-76684
\ No newline at end of property
Index: brlcad/branches/bioh/include
===================================================================
--- brlcad/branches/bioh/include 2020-08-07 14:38:45 UTC (rev 76684)
+++ brlcad/branches/bioh/include 2020-08-07 14:43:24 UTC (rev 76685)
Property changes on: brlcad/branches/bioh/include
___________________________________________________________________
Modified: svn:mergeinfo
## -9,4 +9,4 ##
/brlcad/branches/osg/include:62110-62113
/brlcad/branches/prep-cache/include:68236-68933
/brlcad/branches/tcltk86/include:68300-75257
-/brlcad/trunk/include:75728-75834,75891-75926,75986-76146,76148-76154,76160-76351,76386-76505,76641-76676
\ No newline at end of property
+/brlcad/trunk/include:75728-75834,75891-75926,75986-76146,76148-76154,76160-76351,76386-76505,76641-76684
\ No newline at end of property
Modified: brlcad/branches/bioh/include/dm.h
===================================================================
--- brlcad/branches/bioh/include/dm.h 2020-08-07 14:38:45 UTC (rev 76684)
+++ brlcad/branches/bioh/include/dm.h 2020-08-07 14:43:24 UTC (rev 76685)
@@ -164,6 +164,10 @@
DM_EXPORT const char *dm_bestXType(const char *dpy_string);
DM_EXPORT extern int dm_have_graphics();
+/* This reports the graphics system associated with the specified dm type
(returned values
+ * right now would be NULL, Tk or Qt - another eventual possibility is
GLFW...) */
+DM_EXPORT extern const char *dm_graphics_system(const char *dmtype);
+
/* functions to make a dm struct hideable - will need to
* sort these out later */
@@ -170,8 +174,9 @@
DM_EXPORT extern struct dm *dm_get();
DM_EXPORT extern void dm_put(struct dm *dmp);
DM_EXPORT extern void dm_set_null(struct dm *dmp); /* TODO - HACK, need
general set mechanism */
-DM_EXPORT extern const char *dm_get_dm_name(struct dm *dmp);
+DM_EXPORT extern const char *dm_get_dm_name(const struct dm *dmp);
DM_EXPORT extern const char *dm_get_dm_lname(struct dm *dmp);
+DM_EXPORT extern const char *dm_get_graphics_system(const struct dm *dmp);
DM_EXPORT extern int dm_get_width(struct dm *dmp);
DM_EXPORT extern int dm_get_height(struct dm *dmp);
DM_EXPORT extern void dm_set_width(struct dm *dmp, int width);
Modified: brlcad/branches/bioh/src/fbserv/fbserv.c
===================================================================
--- brlcad/branches/bioh/src/fbserv/fbserv.c 2020-08-07 14:38:45 UTC (rev
76684)
+++ brlcad/branches/bioh/src/fbserv/fbserv.c 2020-08-07 14:43:24 UTC (rev
76685)
@@ -77,9 +77,11 @@
#include "bio.h"
#include "bu/app.h"
+#include "bu/color.h"
+#include "bu/exit.h"
+#include "bu/getopt.h"
+#include "bu/log.h"
#include "bu/malloc.h"
-#include "bu/getopt.h"
-#include "bu/exit.h"
#include "bu/snooze.h"
#include "vmath.h"
#include "dm.h"
@@ -107,7 +109,7 @@
int verbose = 0;
/* from server.c */
-extern const struct pkg_switch fb_server_pkg_switch[];
+extern const struct pkg_switch pkg_switch[];
extern struct fb *fb_server_fbp;
extern fd_set *fb_server_select_list;
extern int *fb_server_max_fd;
@@ -194,13 +196,36 @@
return 0;
}
+/*
+ * Communication error. An error occurred on the PKG link.
+ * It may be local, or it may be between us and the client we are serving.
+ * We send a copy to syslog or stderr.
+ * Don't send one down the wire, this can cause loops.
+ */
+static void
+communications_error(const char *str)
+{
+#if defined(HAVE_SYSLOG_H)
+ if (use_syslog) {
+ syslog(LOG_ERR, "%s", str);
+ } else {
+ fprintf(stderr, "%s", str);
+ }
+#else
+ fprintf(stderr, "%s", str);
+#endif
+ if (verbose) {
+ fprintf(stderr, "%s", str);
+ }
+}
+
static void
-setup_socket(int fd)
+fbserv_setup_socket(int fd)
{
int on = 1;
-#ifdef SO_KEEPALIVE
+#if defined(SO_KEEPALIVE)
if (setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, (char *)&on, sizeof(on)) < 0)
{
# ifdef HAVE_SYSLOG_H
syslog(LOG_WARNING, "setsockopt (SO_KEEPALIVE): %s", strerror(errno));
@@ -207,11 +232,10 @@
# endif
}
#endif
-#ifdef SO_RCVBUF
+#if defined(SO_RCVBUF)
/* try to set our buffers up larger */
{
- int m = 0;
- int n = 0;
+ int m = -1, n = -1;
int val;
int size;
@@ -224,14 +248,30 @@
(char *)&val, sizeof(val));
if (m >= 0 && n >= 0) break;
}
- if (m < 0 || n < 0) perror("fbserv setsockopt()");
+
+ if (m < 0 || n < 0)
+ perror("setsockopt");
}
#endif
}
+static void
+fbserv_drop_client(int sub)
+{
+ int fd;
-void
-new_client(struct pkg_conn *pcp)
+ if (clients[sub] == PKC_NULL)
+ return;
+
+ fd = clients[sub]->pkc_fd;
+
+ FD_CLR(fd, &select_list);
+ pkg_close(clients[sub]);
+ clients[sub] = PKC_NULL;
+}
+
+static void
+fbserv_new_client(struct pkg_conn *pcp)
{
int i;
@@ -244,7 +284,7 @@
clients[i] = pcp;
FD_SET(pcp->pkc_fd, &select_list);
V_MAX(max_fd, pcp->pkc_fd);
- setup_socket(pcp->pkc_fd);
+ fbserv_setup_socket(pcp->pkc_fd);
return;
}
fprintf(stderr, "fbserv: too many clients\n");
@@ -252,47 +292,8 @@
}
-void
-drop_client(int sub)
-{
- int fd;
- if (clients[sub] == PKC_NULL)
- return;
-
- fd = clients[sub]->pkc_fd;
-
- FD_CLR(fd, &select_list);
- pkg_close(clients[sub]);
- clients[sub] = PKC_NULL;
-}
-
-
/*
- * Communication error. An error occurred on the PKG link.
- * It may be local, or it may be between us and the client we are serving.
- * We send a copy to syslog or stderr.
- * Don't send one down the wire, this can cause loops.
- */
-static void
-comm_error(const char *str)
-{
-#if defined(HAVE_SYSLOG_H)
- if (use_syslog) {
- syslog(LOG_ERR, "%s", str);
- } else {
- fprintf(stderr, "%s", str);
- }
-#else
- fprintf(stderr, "%s", str);
-#endif
- if (verbose) {
- fprintf(stderr, "%s", str);
- }
-}
-
-
-/*
* Loop forever handling clients as they come and go.
* Access to the framebuffer may be interleaved, if the user
* wants it that way.
@@ -336,7 +337,7 @@
/* Accept any new client connections */
if (netfd > 0 && FD_ISSET(netfd, &infds)) {
- new_client(pkg_getclient(netfd, fb_server_pkg_switch, comm_error,
0));
+ fbserv_new_client(pkg_getclient(netfd, pkg_switch,
communications_error, 0));
nopens++;
}
@@ -350,7 +351,7 @@
if (! FD_ISSET(clients[i]->pkc_fd, &infds)) continue;
if (pkg_suckin(clients[i]) <= 0) {
/* Probably EOF */
- drop_client(i);
+ fbserv_drop_client(i);
ncloses++;
continue;
}
@@ -415,7 +416,7 @@
netfd = 0;
if (is_socket(netfd)) {
init_syslog();
- new_client(pkg_transerver(fb_server_pkg_switch, comm_error));
+ fbserv_new_client(pkg_transerver(pkg_switch, communications_error));
max_fd = 8;
once_only = 1;
main_loop();
@@ -448,7 +449,7 @@
/*
* Hang an unending listen for PKG connections
*/
- if ((netfd = pkg_permserver(portname, 0, 0, comm_error)) < 0)
+ if ((netfd = pkg_permserver(portname, 0, 0, communications_error)) < 0)
bu_exit(-1, NULL);
FD_SET(netfd, &select_list);
V_MAX(max_fd, netfd);
@@ -471,13 +472,13 @@
}
init_syslog();
- while ((netfd = pkg_permserver(portname, 0, 0, comm_error)) < 0) {
+ while ((netfd = pkg_permserver(portname, 0, 0, communications_error)) < 0)
{
static int error_count=0;
bu_snooze(BU_SEC2USEC(1));
if (error_count++ < 60) {
continue;
}
- comm_error("Unable to start the stand-alone framebuffer daemon after 60
seconds, giving up.");
+ communications_error("Unable to start the stand-alone framebuffer
daemon after 60 seconds, giving up.");
return 1;
}
@@ -485,7 +486,7 @@
int fbstat;
struct pkg_conn *pcp;
- pcp = pkg_getclient(netfd, fb_server_pkg_switch, comm_error, 0);
+ pcp = pkg_getclient(netfd, pkg_switch, communications_error, 0);
if (pcp == PKC_ERROR)
break; /* continue is unlikely to work */
@@ -496,7 +497,7 @@
/* Create 2nd level child process, "double detach" */
if (fork() == 0) {
/* 2nd level child -- start work! */
- new_client(pcp);
+ fbserv_new_client(pcp);
once_only = 1;
main_loop();
return 0;
@@ -516,7 +517,6 @@
return 2;
}
-
#ifndef _WIN32
/*
* Handles error or log messages from the frame buffer library.
@@ -546,8 +546,8 @@
for (i = MAX_CLIENTS-1; i >= 0; i--) {
if (clients[i] == NULL) continue;
if (pkg_send(MSG_ERROR, outbuf, want, clients[i]) != want) {
- comm_error("pkg_send error in fb_log, message was:\n");
- comm_error(outbuf);
+ communications_error("pkg_send error in fb_log, message was:\n");
+ communications_error(outbuf);
} else {
nsent++;
}
Modified: brlcad/branches/bioh/src/fbserv/server.c
===================================================================
--- brlcad/branches/bioh/src/fbserv/server.c 2020-08-07 14:38:45 UTC (rev
76684)
+++ brlcad/branches/bioh/src/fbserv/server.c 2020-08-07 14:43:24 UTC (rev
76685)
@@ -64,9 +64,9 @@
* which might send the message back across the wire.
*/
static void
-fb_server_got_unknown(struct pkg_conn *pcp, char *buf)
+fb_server_fb_unknown(struct pkg_conn *pcp, char *buf)
{
- fb_log("fb_server_got_unknown: message type %d not part of remote LIBFB
protocol, ignored.\n",
+ fb_log("fb_server_fb_unknown: message type %d not part of remote LIBFB
protocol, ignored.\n",
pcp->pkc_type);
(void)free(buf);
}
@@ -85,8 +85,10 @@
char rbuf[5*NET_LONG_LEN+1];
int want;
- if (buf == NULL) return;
- if (pcp == PKC_NULL) return;
+ if (buf == NULL)
+ return;
+ if (pcp == PKC_NULL)
+ return;
width = pkg_glong(&buf[0*NET_LONG_LEN]);
height = pkg_glong(&buf[1*NET_LONG_LEN]);
@@ -122,7 +124,8 @@
want = 5*NET_LONG_LEN;
if (pkg_send(MSG_RETURN, rbuf, want, pcp) != want)
fprintf(stderr, "pkg_send fb_open reply\n");
- if (buf) (void)free(buf);
+ if (buf)
+ (void)free(buf);
}
@@ -148,7 +151,8 @@
* If communication has broken, other end will know we are gone.
*/
(void)pkg_send(MSG_RETURN, rbuf, NET_LONG_LEN, pcp);
- if (buf) (void)free(buf);
+ if (buf)
+ (void)free(buf);
}
@@ -176,7 +180,8 @@
if (pkg_send(MSG_RETURN, rbuf, NET_LONG_LEN, pcp) != NET_LONG_LEN)
fprintf(stderr, "pkg_send fb_free reply\n");
- if (buf) (void)free(buf);
+ if (buf)
+ (void)free(buf);
fb_server_got_fb_free = 1;
}
@@ -188,8 +193,10 @@
RGBpixel bg;
char rbuf[NET_LONG_LEN+1];
- if (buf == NULL) return;
- if (pcp == PKC_NULL) return;
+ if (buf == NULL)
+ return;
+ if (pcp == PKC_NULL)
+ return;
bg[RED] = buf[0];
bg[GRN] = buf[1];
@@ -198,7 +205,8 @@
(void)pkg_plong(rbuf, fb_clear(fb_server_fbp, bg));
pkg_send(MSG_RETURN, rbuf, NET_LONG_LEN, pcp);
- if (buf) (void)free(buf);
+ if (buf)
+ (void)free(buf);
}
@@ -211,8 +219,10 @@
static unsigned char *scanbuf = NULL;
static size_t buflen = 0;
- if (buf == NULL) return;
- if (pcp == PKC_NULL) return;
+ if (buf == NULL)
+ return;
+ if (pcp == PKC_NULL)
+ return;
x = pkg_glong(&buf[0*NET_LONG_LEN]);
y = pkg_glong(&buf[1*NET_LONG_LEN]);
@@ -226,7 +236,8 @@
if ((scanbuf = (unsigned char *)malloc(buflen)) == NULL) {
fb_log("fb_read: malloc failed!");
- if (buf) (void)free(buf);
+ if (buf)
+ (void)free(buf);
buflen = 0;
return;
}
@@ -237,7 +248,8 @@
/* sending a 0-length package indicates error */
pkg_send(MSG_RETURN, (char *)scanbuf, ret*sizeof(RGBpixel), pcp);
- if (buf) (void)free(buf);
+ if (buf)
+ (void)free(buf);
}
@@ -253,8 +265,10 @@
int ret;
int type;
- if (buf == NULL) return;
- if (pcp == PKC_NULL) return;
+ if (buf == NULL)
+ return;
+ if (pcp == PKC_NULL)
+ return;
x = pkg_glong(&buf[0*NET_LONG_LEN]);
y = pkg_glong(&buf[1*NET_LONG_LEN]);
@@ -266,7 +280,8 @@
(void)pkg_plong(&rbuf[0*NET_LONG_LEN], ret);
pkg_send(MSG_RETURN, rbuf, NET_LONG_LEN, pcp);
}
- if (buf) (void)free(buf);
+ if (buf)
+ (void)free(buf);
}
@@ -280,8 +295,10 @@
static unsigned char *scanbuf = NULL;
static size_t buflen = 0;
- if (buf == NULL) return;
- if (pcp == PKC_NULL) return;
+ if (buf == NULL)
+ return;
+ if (pcp == PKC_NULL)
+ return;
xmin = pkg_glong(&buf[0*NET_LONG_LEN]);
ymin = pkg_glong(&buf[1*NET_LONG_LEN]);
@@ -297,7 +314,8 @@
if ((scanbuf = (unsigned char *)malloc(buflen)) == NULL) {
fb_log("fb_read: malloc failed!");
- if (buf) (void)free(buf);
+ if (buf)
+ (void)free(buf);
buflen = 0;
return;
}
@@ -308,7 +326,8 @@
/* sending a 0-length package indicates error */
pkg_send(MSG_RETURN, (char *)scanbuf, ret*sizeof(RGBpixel), pcp);
- if (buf) (void)free(buf);
+ if (buf)
+ (void)free(buf);
}
@@ -324,8 +343,10 @@
int ret;
int type;
- if (buf == NULL) return;
- if (pcp == PKC_NULL) return;
+ if (buf == NULL)
+ return;
+ if (pcp == PKC_NULL)
+ return;
x = pkg_glong(&buf[0*NET_LONG_LEN]);
y = pkg_glong(&buf[1*NET_LONG_LEN]);
@@ -340,7 +361,8 @@
(void)pkg_plong(&rbuf[0*NET_LONG_LEN], ret);
pkg_send(MSG_RETURN, rbuf, NET_LONG_LEN, pcp);
}
- if (buf) (void)free(buf);
+ if (buf)
+ (void)free(buf);
}
@@ -354,8 +376,10 @@
static unsigned char *scanbuf = NULL;
static size_t buflen = 0;
- if (buf == NULL) return;
- if (pcp == PKC_NULL) return;
+ if (buf == NULL)
+ return;
+ if (pcp == PKC_NULL)
+ return;
xmin = pkg_glong(&buf[0*NET_LONG_LEN]);
ymin = pkg_glong(&buf[1*NET_LONG_LEN]);
@@ -371,7 +395,8 @@
if ((scanbuf = (unsigned char *)malloc(buflen)) == NULL) {
fb_log("fb_bwreadrect: malloc failed!");
- if (buf) (void)free(buf);
+ if (buf)
+ (void)free(buf);
buflen = 0;
return;
}
@@ -382,7 +407,8 @@
/* sending a 0-length package indicates error */
pkg_send(MSG_RETURN, (char *)scanbuf, ret, pcp);
- if (buf) (void)free(buf);
+ if (buf)
+ (void)free(buf);
}
@@ -398,8 +424,10 @@
int ret;
int type;
- if (buf == NULL) return;
- if (pcp == PKC_NULL) return;
+ if (buf == NULL)
+ return;
+ if (pcp == PKC_NULL)
+ return;
x = pkg_glong(&buf[0*NET_LONG_LEN]);
y = pkg_glong(&buf[1*NET_LONG_LEN]);
@@ -416,9 +444,10 @@
} else {
/* No formal return code. Note errors locally */
if (ret < 0) fb_log("fb_server_fb_bwwriterect(%d, %d, %d, %d) error
%d\n",
- x, y, width, height, ret);
+ x, y, width, height, ret);
}
- if (buf) (void)free(buf);
+ if (buf)
+ (void)free(buf);
}
@@ -428,8 +457,10 @@
int mode, x, y;
char rbuf[NET_LONG_LEN+1];
- if (buf == NULL) return;
- if (pcp == PKC_NULL) return;
+ if (buf == NULL)
+ return;
+ if (pcp == PKC_NULL)
+ return;
mode = pkg_glong(&buf[0*NET_LONG_LEN]);
x = pkg_glong(&buf[1*NET_LONG_LEN]);
@@ -437,7 +468,8 @@
(void)pkg_plong(&rbuf[0], fb_cursor(fb_server_fbp, mode, x, y));
pkg_send(MSG_RETURN, rbuf, NET_LONG_LEN, pcp);
- if (buf) (void)free(buf);
+ if (buf)
+ (void)free(buf);
}
@@ -456,7 +488,8 @@
(void)pkg_plong(&rbuf[2*NET_LONG_LEN], x);
(void)pkg_plong(&rbuf[3*NET_LONG_LEN], y);
pkg_send(MSG_RETURN, rbuf, 4*NET_LONG_LEN, pcp);
- if (buf) (void)free(buf);
+ if (buf)
+ (void)free(buf);
}
@@ -468,7 +501,8 @@
int xbits, ybits;
int xorig, yorig;
- if (buf == NULL) return;
+ if (buf == NULL)
+ return;
if (pcp == PKC_NULL) return;
xbits = pkg_glong(&buf[0*NET_LONG_LEN]);
@@ -483,7 +517,8 @@
(void)pkg_plong(&rbuf[0*NET_LONG_LEN], ret);
pkg_send(MSG_RETURN, rbuf, NET_LONG_LEN, pcp);
}
- if (buf) (void)free(buf);
+ if (buf)
+ (void)free(buf);
}
@@ -496,8 +531,10 @@
int mode, x, y;
char rbuf[NET_LONG_LEN+1];
- if (buf == NULL) return;
- if (pcp == PKC_NULL) return;
+ if (buf == NULL)
+ return;
+ if (pcp == PKC_NULL)
+ return;
mode = pkg_glong(&buf[0*NET_LONG_LEN]);
x = pkg_glong(&buf[1*NET_LONG_LEN]);
@@ -505,7 +542,8 @@
(void)pkg_plong(&rbuf[0], fb_scursor(fb_server_fbp, mode, x, y));
pkg_send(MSG_RETURN, rbuf, NET_LONG_LEN, pcp);
- if (buf) (void)free(buf);
+ if (buf)
+ (void)free(buf);
}
@@ -518,8 +556,10 @@
int x, y;
char rbuf[NET_LONG_LEN+1];
- if (buf == NULL) return;
- if (pcp == PKC_NULL) return;
+ if (buf == NULL)
+ return;
+ if (pcp == PKC_NULL)
+ return;
x = pkg_glong(&buf[0*NET_LONG_LEN]);
y = pkg_glong(&buf[1*NET_LONG_LEN]);
@@ -526,7 +566,8 @@
(void)pkg_plong(&rbuf[0], fb_window(fb_server_fbp, x, y));
pkg_send(MSG_RETURN, rbuf, NET_LONG_LEN, pcp);
- if (buf) (void)free(buf);
+ if (buf)
+ (void)free(buf);
}
@@ -539,8 +580,10 @@
int x, y;
char rbuf[NET_LONG_LEN+1];
- if (buf == NULL) return;
- if (pcp == PKC_NULL) return;
+ if (buf == NULL)
+ return;
+ if (pcp == PKC_NULL)
+ return;
x = pkg_glong(&buf[0*NET_LONG_LEN]);
y = pkg_glong(&buf[1*NET_LONG_LEN]);
@@ -547,7 +590,8 @@
(void)pkg_plong(&rbuf[0], fb_zoom(fb_server_fbp, x, y));
pkg_send(MSG_RETURN, rbuf, NET_LONG_LEN, pcp);
- if (buf) (void)free(buf);
+ if (buf)
+ (void)free(buf);
}
@@ -558,8 +602,10 @@
int xcenter, ycenter, xzoom, yzoom;
char rbuf[NET_LONG_LEN+1];
- if (buf == NULL) return;
- if (pcp == PKC_NULL) return;
+ if (buf == NULL)
+ return;
+ if (pcp == PKC_NULL)
+ return;
xcenter = pkg_glong(&buf[0*NET_LONG_LEN]);
ycenter = pkg_glong(&buf[1*NET_LONG_LEN]);
@@ -569,7 +615,8 @@
ret = fb_view(fb_server_fbp, xcenter, ycenter, xzoom, yzoom);
(void)pkg_plong(&rbuf[0], ret);
pkg_send(MSG_RETURN, rbuf, NET_LONG_LEN, pcp);
- if (buf) (void)free(buf);
+ if (buf)
+ (void)free(buf);
}
@@ -589,7 +636,8 @@
(void)pkg_plong(&rbuf[3*NET_LONG_LEN], xzoom);
(void)pkg_plong(&rbuf[4*NET_LONG_LEN], yzoom);
pkg_send(MSG_RETURN, rbuf, 5*NET_LONG_LEN, pcp);
- if (buf) (void)free(buf);
+ if (buf)
+ (void)free(buf);
}
@@ -611,7 +659,8 @@
}
pkg_send(MSG_DATA, (char *)cm, sizeof(cm), pcp);
pkg_send(MSG_RETURN, rbuf, NET_LONG_LEN, pcp);
- if (buf) (void)free(buf);
+ if (buf)
+ (void)free(buf);
}
@@ -629,8 +678,10 @@
long ret;
ColorMap map;
- if (buf == NULL) return;
- if (pcp == PKC_NULL) return;
+ if (buf == NULL)
+ return;
+ if (pcp == PKC_NULL)
+ return;
if (pcp->pkc_len == 0)
ret = fb_wmap(fb_server_fbp, COLORMAP_NULL);
@@ -644,7 +695,8 @@
}
(void)pkg_plong(&rbuf[0], ret);
pkg_send(MSG_RETURN, rbuf, NET_LONG_LEN, pcp);
- if (buf) (void)free(buf);
+ if (buf)
+ (void)free(buf);
}
@@ -663,7 +715,8 @@
pkg_send(MSG_RETURN, rbuf, NET_LONG_LEN, pcp);
}
- if (buf) (void)free(buf);
+ if (buf)
+ (void)free(buf);
}
@@ -673,7 +726,8 @@
if (pcp == PKC_NULL) return;
(void)fb_poll(fb_server_fbp);
- if (buf) (void)free(buf);
+ if (buf)
+ (void)free(buf);
}
@@ -687,8 +741,10 @@
long ret;
char rbuf[NET_LONG_LEN+1];
- if (pcp == PKC_NULL) return;
- if (buf == NULL) return;
+ if (pcp == PKC_NULL)
+ return;
+ if (buf == NULL)
+ return;
(void)pkg_glong(&buf[0*NET_LONG_LEN]);
@@ -695,42 +751,42 @@
ret = fb_help(fb_server_fbp);
(void)pkg_plong(&rbuf[0], ret);
pkg_send(MSG_RETURN, rbuf, NET_LONG_LEN, pcp);
- if (buf) (void)free(buf);
+ if (buf)
+ (void)free(buf);
}
-
-const struct pkg_switch fb_server_pkg_switch[] = {
- { MSG_FBOPEN, fb_server_fb_open, "Open Framebuffer",
NULL },
- { MSG_FBCLOSE, fb_server_fb_close, "Close Framebuffer",
NULL },
- { MSG_FBCLEAR, fb_server_fb_clear, "Clear Framebuffer",
NULL },
- { MSG_FBREAD, fb_server_fb_read, "Read Pixels", NULL },
- { MSG_FBWRITE, fb_server_fb_write, "Write Pixels", NULL },
- { MSG_FBWRITE+MSG_NORETURN, fb_server_fb_write, "Asynch write",
NULL },
- { MSG_FBCURSOR, fb_server_fb_cursor, "Cursor", NULL },
- { MSG_FBGETCURSOR, fb_server_fb_getcursor, "Get Cursor", NULL },
/*NEW*/
- { MSG_FBSCURSOR, fb_server_fb_scursor, "Screen Cursor", NULL
}, /*OLD*/
- { MSG_FBWINDOW, fb_server_fb_window, "Window", NULL },
/*OLD*/
- { MSG_FBZOOM, fb_server_fb_zoom, "Zoom", NULL },
/*OLD*/
- { MSG_FBVIEW, fb_server_fb_view, "View", NULL },
/*NEW*/
- { MSG_FBGETVIEW, fb_server_fb_getview, "Get View", NULL },
/*NEW*/
- { MSG_FBRMAP, fb_server_fb_rmap, "R Map", NULL },
- { MSG_FBWMAP, fb_server_fb_wmap, "W Map", NULL },
- { MSG_FBHELP, fb_server_fb_help, "Help Request", NULL },
- { MSG_ERROR, fb_server_got_unknown, "Error Message", NULL },
- { MSG_CLOSE, fb_server_got_unknown, "Close Connection",
NULL },
- { MSG_FBREADRECT, fb_server_fb_readrect, "Read Rectangle", NULL
},
- { MSG_FBWRITERECT, fb_server_fb_writerect, "Write Rectangle", NULL
},
- { MSG_FBWRITERECT+MSG_NORETURN, fb_server_fb_writerect, "Write
Rectangle", NULL },
- { MSG_FBBWREADRECT, fb_server_fb_bwreadrect, "Read BW
Rectangle", NULL },
- { MSG_FBBWWRITERECT, fb_server_fb_bwwriterect, "Write BW
Rectangle", NULL },
- { MSG_FBBWWRITERECT+MSG_NORETURN, fb_server_fb_bwwriterect, "Write BW
Rectangle", NULL },
- { MSG_FBFLUSH, fb_server_fb_flush, "Flush Output",
NULL },
- { MSG_FBFLUSH + MSG_NORETURN, fb_server_fb_flush, "Flush Output",
NULL },
- { MSG_FBFREE, fb_server_fb_free, "Free
Resources", NULL },
- { MSG_FBPOLL, fb_server_fb_poll, "Handle
Events", NULL },
- { MSG_FBSETCURSOR, fb_server_fb_setcursor, "Set Cursor
Shape", NULL },
- { MSG_FBSETCURSOR + MSG_NORETURN, fb_server_fb_setcursor, "Set Cursor
Shape", NULL },
- { 0, NULL, NULL, NULL }
+const struct pkg_switch pkg_switch[] = {
+ { MSG_FBOPEN, fb_server_fb_open, "Open
Framebuffer", NULL },
+ { MSG_FBCLOSE, fb_server_fb_close, "Close
Framebuffer", NULL },
+ { MSG_FBCLEAR, fb_server_fb_clear, "Clear
Framebuffer", NULL },
+ { MSG_FBREAD, fb_server_fb_read, "Read
Pixels", NULL },
+ { MSG_FBWRITE, fb_server_fb_write, "Write
Pixels", NULL },
+ { MSG_FBWRITE + MSG_NORETURN, fb_server_fb_write, "Asynch
write", NULL },
+ { MSG_FBCURSOR, fb_server_fb_cursor, "Cursor",
NULL },
+ { MSG_FBGETCURSOR, fb_server_fb_getcursor, "Get
Cursor", NULL }, /*NEW*/
+ { MSG_FBSCURSOR, fb_server_fb_scursor, "Screen
Cursor", NULL }, /*OLD*/
+ { MSG_FBWINDOW, fb_server_fb_window, "Window",
NULL }, /*OLD*/
+ { MSG_FBZOOM, fb_server_fb_zoom, "Zoom", NULL
}, /*OLD*/
+ { MSG_FBVIEW, fb_server_fb_view, "View", NULL
}, /*NEW*/
+ { MSG_FBGETVIEW, fb_server_fb_getview, "Get View",
NULL }, /*NEW*/
+ { MSG_FBRMAP, fb_server_fb_rmap, "R Map",
NULL },
+ { MSG_FBWMAP, fb_server_fb_wmap, "W Map",
NULL },
+ { MSG_FBHELP, fb_server_fb_help, "Help
Request", NULL },
+ { MSG_ERROR, fb_server_fb_unknown, "Error
Message", NULL },
+ { MSG_CLOSE, fb_server_fb_unknown, "Close
Connection", NULL },
+ { MSG_FBREADRECT, fb_server_fb_readrect, "Read
Rectangle", NULL },
+ { MSG_FBWRITERECT, fb_server_fb_writerect, "Write
Rectangle", NULL },
+ { MSG_FBWRITERECT + MSG_NORETURN, fb_server_fb_writerect, "Write
Rectangle", NULL },
+ { MSG_FBBWREADRECT, fb_server_fb_bwreadrect, "Read BW
Rectangle", NULL },
+ { MSG_FBBWWRITERECT, fb_server_fb_bwwriterect, "Write BW
Rectangle", NULL },
+ { MSG_FBBWWRITERECT + MSG_NORETURN, fb_server_fb_bwwriterect, "Write BW
Rectangle", NULL },
+ { MSG_FBFLUSH, fb_server_fb_flush, "Flush
Output", NULL },
+ { MSG_FBFLUSH + MSG_NORETURN, fb_server_fb_flush, "Flush
Output", NULL },
+ { MSG_FBFREE, fb_server_fb_free, "Free
Resources", NULL },
+ { MSG_FBPOLL, fb_server_fb_poll, "Handle
Events", NULL },
+ { MSG_FBSETCURSOR, fb_server_fb_setcursor, "Set Cursor
Shape", NULL },
+ { MSG_FBSETCURSOR + MSG_NORETURN, fb_server_fb_setcursor, "Set Cursor
Shape", NULL },
+ { 0, NULL, NULL, NULL }
};
Modified: brlcad/branches/bioh/src/libdm/X/dm-X.c
===================================================================
--- brlcad/branches/bioh/src/libdm/X/dm-X.c 2020-08-07 14:38:45 UTC (rev
76684)
+++ brlcad/branches/bioh/src/libdm/X/dm-X.c 2020-08-07 14:43:24 UTC (rev
76685)
@@ -2121,6 +2121,7 @@
NULL,
0,
1, /* is graphical */
+ "Tk", /* uses Tk graphics system */
0, /* no displaylist */
0, /* no stereo */
PLOTBOUND, /* zoom-in limit */
Modified: brlcad/branches/bioh/src/libdm/dm-generic.c
===================================================================
--- brlcad/branches/bioh/src/libdm/dm-generic.c 2020-08-07 14:38:45 UTC (rev
76684)
+++ brlcad/branches/bioh/src/libdm/dm-generic.c 2020-08-07 14:43:24 UTC (rev
76685)
@@ -178,7 +178,7 @@
}
const char *
-dm_get_dm_name(struct dm *dmp)
+dm_get_dm_name(const struct dm *dmp)
{
if (UNLIKELY(!dmp)) return NULL;
return dmp->i->dm_name;
@@ -401,6 +401,13 @@
return &(dmp->i->dm_dName);
}
+const char *
+dm_get_graphics_system(const struct dm *dmp)
+{
+ if (UNLIKELY(!dmp)) return NULL;
+ return dmp->i->graphics_system;
+}
+
struct bu_vls *
dm_get_tkname(struct dm *dmp)
{
Modified: brlcad/branches/bioh/src/libdm/dm_plugins.cpp
===================================================================
--- brlcad/branches/bioh/src/libdm/dm_plugins.cpp 2020-08-07 14:38:45 UTC
(rev 76684)
+++ brlcad/branches/bioh/src/libdm/dm_plugins.cpp 2020-08-07 14:43:24 UTC
(rev 76685)
@@ -78,6 +78,24 @@
return ret;
}
+extern "C" const char *
+dm_graphics_system(const char *dmtype)
+{
+ const char *ret = NULL;
+ std::map<std::string, const struct dm *> *dmb = (std::map<std::string,
const struct dm *> *)dm_backends;
+ std::map<std::string, const struct dm *>::iterator d_it;
+ for (d_it = dmb->begin(); d_it != dmb->end(); d_it++) {
+ std::string key = d_it->first;
+ const struct dm *d = d_it->second;
+ const char *dname = dm_get_dm_name(d);
+ if (BU_STR_EQUIV(dmtype, dname)) {
+ ret = dm_get_graphics_system(d);
+ break;
+ }
+ }
+ return ret;
+}
+
extern "C" void
dm_list_types(struct bu_vls *list, const char *separator)
{
Modified: brlcad/branches/bioh/src/libdm/glx/dm-ogl.c
===================================================================
--- brlcad/branches/bioh/src/libdm/glx/dm-ogl.c 2020-08-07 14:38:45 UTC (rev
76684)
+++ brlcad/branches/bioh/src/libdm/glx/dm-ogl.c 2020-08-07 14:43:24 UTC (rev
76685)
@@ -3059,6 +3059,7 @@
ogl_share_dlist,
0,
1, /* is graphical */
+ "Tk", /* uses Tk graphics system */
1, /* has displaylist */
0, /* no stereo by default */
1.0, /* zoom-in limit */
Modified: brlcad/branches/bioh/src/libdm/include/calltable.h
===================================================================
--- brlcad/branches/bioh/src/libdm/include/calltable.h 2020-08-07 14:38:45 UTC
(rev 76684)
+++ brlcad/branches/bioh/src/libdm/include/calltable.h 2020-08-07 14:43:24 UTC
(rev 76685)
@@ -110,6 +110,7 @@
int (*dm_share_dlist)(struct dm *dmp1, struct dm *dmp2);
unsigned long dm_id; /**< @brief window id */
int dm_graphical; /**< @brief !0 means device supports
interactive graphics */
+ const char *graphics_system; /**< @brief String identifying the drawing
layer assumed */
int dm_displaylist; /**< @brief !0 means device has
displaylist */
int dm_stereo; /**< @brief stereo flag */
double dm_bound; /**< @brief zoom-in limit */
Modified: brlcad/branches/bioh/src/libdm/null/dm-Null.c
===================================================================
--- brlcad/branches/bioh/src/libdm/null/dm-Null.c 2020-08-07 14:38:45 UTC
(rev 76684)
+++ brlcad/branches/bioh/src/libdm/null/dm-Null.c 2020-08-07 14:43:24 UTC
(rev 76685)
@@ -360,6 +360,7 @@
NULL,
0,
0, /* not graphical */
+ NULL, /* not graphical */
0, /* no displaylist */
0, /* no stereo */
0.0, /* zoom-in limit */
Modified: brlcad/branches/bioh/src/libdm/osgl/dm-osgl.cpp
===================================================================
--- brlcad/branches/bioh/src/libdm/osgl/dm-osgl.cpp 2020-08-07 14:38:45 UTC
(rev 76684)
+++ brlcad/branches/bioh/src/libdm/osgl/dm-osgl.cpp 2020-08-07 14:43:24 UTC
(rev 76685)
@@ -2709,6 +2709,7 @@
NULL,
0,
1, /* is graphical */
+ "Tk", /* uses Tk graphics system */
1, /* has displaylist */
0, /* no stereo by default */
1.0, /* zoom-in limit */
Modified: brlcad/branches/bioh/src/libdm/plot/dm-plot.c
===================================================================
--- brlcad/branches/bioh/src/libdm/plot/dm-plot.c 2020-08-07 14:38:45 UTC
(rev 76684)
+++ brlcad/branches/bioh/src/libdm/plot/dm-plot.c 2020-08-07 14:43:24 UTC
(rev 76685)
@@ -718,6 +718,7 @@
NULL,
0,
0, /* not graphical */
+ NULL, /* not graphical */
0, /* no displaylist */
0, /* no stereo */
PLOTBOUND, /* zoom-in limit */
Modified: brlcad/branches/bioh/src/libdm/postscript/dm-ps.c
===================================================================
--- brlcad/branches/bioh/src/libdm/postscript/dm-ps.c 2020-08-07 14:38:45 UTC
(rev 76684)
+++ brlcad/branches/bioh/src/libdm/postscript/dm-ps.c 2020-08-07 14:43:24 UTC
(rev 76685)
@@ -787,6 +787,7 @@
NULL,
0,
0, /* not graphical */
+ NULL, /* not graphical */
0, /* no displaylist */
0, /* no stereo */
PLOTBOUND, /* zoom-in limit */
Modified: brlcad/branches/bioh/src/libdm/qt/dm-qt.cpp
===================================================================
--- brlcad/branches/bioh/src/libdm/qt/dm-qt.cpp 2020-08-07 14:38:45 UTC (rev
76684)
+++ brlcad/branches/bioh/src/libdm/qt/dm-qt.cpp 2020-08-07 14:43:24 UTC (rev
76685)
@@ -1361,6 +1361,7 @@
NULL,
0,
1, /* is graphical */
+ "Qt", /* uses Qt graphics system */
0, /* no displaylist */
0, /* no stereo */
0.0, /* zoom-in limit */
Modified: brlcad/branches/bioh/src/libdm/tk/dm-tk.c
===================================================================
--- brlcad/branches/bioh/src/libdm/tk/dm-tk.c 2020-08-07 14:38:45 UTC (rev
76684)
+++ brlcad/branches/bioh/src/libdm/tk/dm-tk.c 2020-08-07 14:43:24 UTC (rev
76685)
@@ -1160,6 +1160,7 @@
NULL,
0,
1, /* is graphical */
+ "Tk", /* uses Tk graphics system */
0, /* no displaylist */
0, /* no stereo */
PLOTBOUND, /* zoom-in limit */
Modified: brlcad/branches/bioh/src/libdm/txt/dm-txt.c
===================================================================
--- brlcad/branches/bioh/src/libdm/txt/dm-txt.c 2020-08-07 14:38:45 UTC (rev
76684)
+++ brlcad/branches/bioh/src/libdm/txt/dm-txt.c 2020-08-07 14:43:24 UTC (rev
76685)
@@ -411,6 +411,7 @@
NULL,
0,
0, /* not graphical */
+ NULL, /* not graphical */
0, /* no displaylist */
0, /* no stereo */
0.0, /* zoom-in limit */
Modified: brlcad/branches/bioh/src/libdm/wgl/dm-wgl.c
===================================================================
--- brlcad/branches/bioh/src/libdm/wgl/dm-wgl.c 2020-08-07 14:38:45 UTC (rev
76684)
+++ brlcad/branches/bioh/src/libdm/wgl/dm-wgl.c 2020-08-07 14:43:24 UTC (rev
76685)
@@ -2345,6 +2345,7 @@
wgl_share_dlist,
0,
1, /* is graphical */
+ "Tk", /* uses Tk graphics system */
1, /* has displaylist */
0, /* no stereo by default */
1.0, /* zoom-in limit */
Modified: brlcad/branches/bioh/src/mged/CMakeLists.txt
===================================================================
--- brlcad/branches/bioh/src/mged/CMakeLists.txt 2020-08-07 14:38:45 UTC
(rev 76684)
+++ brlcad/branches/bioh/src/mged/CMakeLists.txt 2020-08-07 14:43:24 UTC
(rev 76685)
@@ -106,7 +106,6 @@
comb_bool.h
comb_bool_parse.y
comb_bool_scan.l
- fbserv.h
htmlLibraryUi.h
menu.h
mged.h
Modified: brlcad/branches/bioh/src/mged/attach.c
===================================================================
--- brlcad/branches/bioh/src/mged/attach.c 2020-08-07 14:38:45 UTC (rev
76684)
+++ brlcad/branches/bioh/src/mged/attach.c 2020-08-07 14:43:24 UTC (rev
76685)
@@ -51,15 +51,6 @@
#include "./sedit.h"
#include "./mged_dm.h"
-#define NEED_GUI(_name) (\
- BU_STR_EQUIV(_name, "wgl") || \
- BU_STR_EQUIV(_name, "ogl") || \
- BU_STR_EQUIV(_name, "osgl") || \
- BU_STR_EQUIV(_name, "tk") || \
- BU_STR_EQUIV(_name, "X") || \
- BU_STR_EQUIV(_name, "txt") || \
- BU_STR_EQUIV(_name, "qt"))
-
extern void share_dlist(struct dm_list *dlp2); /* defined in share.c */
extern struct _color_scheme default_color_scheme;
@@ -402,7 +393,7 @@
predictor_init();
/* Only need to do this once */
- if (tkwin == NULL && NEED_GUI(wp_name)) {
+ if (tkwin == NULL && BU_STR_EQUIV(dm_graphics_system(wp_name), "Tk")) {
struct dm *tmp_dmp;
struct bu_vls tmp_vls = BU_VLS_INIT_ZERO;
Modified: brlcad/branches/bioh/src/mged/fbserv.c
===================================================================
--- brlcad/branches/bioh/src/mged/fbserv.c 2020-08-07 14:38:45 UTC (rev
76684)
+++ brlcad/branches/bioh/src/mged/fbserv.c 2020-08-07 14:43:24 UTC (rev
76685)
@@ -40,15 +40,14 @@
#include "./mged.h"
#include "./mged_dm.h"
-#include "./fbserv.h"
-
#define NET_LONG_LEN 4 /* # bytes to network long */
+extern const struct pkg_switch pkg_switch[];
/*
* Communication error. An error occurred on the PKG link.
*/
-HIDDEN void
+static void
communications_error(const char *str)
{
bu_log("%s", str);
@@ -55,7 +54,7 @@
}
-HIDDEN void
+static void
fbserv_setup_socket(int fd)
{
int on = 1;
@@ -89,7 +88,7 @@
}
-HIDDEN void
+static void
fbserv_drop_client(int sub)
{
if (clients[sub].c_pkg != PKC_NULL) {
@@ -115,7 +114,7 @@
/*
* Process arrivals from existing clients.
*/
-HIDDEN void
+static void
fbserv_existing_client_handler(ClientData clientData, int UNUSED(mask))
{
int i;
@@ -170,9 +169,9 @@
#if defined(_WIN32) && !defined(__CYGWIN__)
-HIDDEN struct pkg_conn *fbserv_makeconn(int fd, const struct pkg_switch
*switchp);
+static struct pkg_conn *fbserv_makeconn(int fd, const struct pkg_switch
*switchp);
-HIDDEN void
+static void
fbserv_new_client(struct pkg_conn *pcp,
Tcl_Channel chan)
@@ -205,7 +204,7 @@
}
-HIDDEN void
+static void
fbserv_new_client_handler(ClientData clientData,
Tcl_Channel chan,
char *host,
@@ -309,7 +308,7 @@
}
-HIDDEN struct pkg_conn *
+static struct pkg_conn *
fbserv_makeconn(int fd,
const struct pkg_switch *switchp)
{
@@ -350,7 +349,7 @@
#else /* defined(_WIN32) && !defined(__CYGWIN__) */
-HIDDEN void
+static void
fbserv_new_client(struct pkg_conn *pcp)
{
int i;
@@ -381,7 +380,7 @@
/*
* Accept any new client connections.
*/
-HIDDEN void
+static void
fbserv_new_client_handler(ClientData clientData, int UNUSED(mask))
{
uintptr_t datafd = (uintptr_t)clientData;
@@ -471,10 +470,10 @@
* This is where we go for message types we don't understand.
*/
void
-rfbunknown(struct pkg_conn *pcp, char *buf)
+fb_server_fb_unknown(struct pkg_conn *pcp, char *buf)
{
if (buf == NULL) {
- bu_log("rfbunknown: null buffer\n");
+ bu_log("fb_server_fb_unknown: null buffer\n");
return;
}
@@ -485,14 +484,14 @@
/******** Here's where the hooks lead *********/
-void
-rfbopen(struct pkg_conn *pcp, char *buf)
+static void
+fb_server_fb_open(struct pkg_conn *pcp, char *buf)
{
char rbuf[5*NET_LONG_LEN+1];
int want;
if (buf == NULL) {
- bu_log("rfbopen: null buffer\n");
+ bu_log("fb_server_fb_open: null buffer\n");
return;
}
@@ -511,8 +510,8 @@
}
-void
-rfbclose(struct pkg_conn *pcp, char *buf)
+static void
+fb_server_fb_close(struct pkg_conn *pcp, char *buf)
{
char rbuf[NET_LONG_LEN+1];
@@ -528,14 +527,13 @@
* communication has broken, other end will know we are gone.
*/
(void)pkg_send(MSG_RETURN, rbuf, NET_LONG_LEN, pcp);
-
if (buf)
(void)free(buf);
}
-void
-rfbfree(struct pkg_conn *pcp, char *buf)
+static void
+fb_server_fb_free(struct pkg_conn *pcp, char *buf)
{
char rbuf[NET_LONG_LEN+1];
@@ -548,14 +546,14 @@
}
-void
-rfbclear(struct pkg_conn *pcp, char *buf)
+static void
+fb_server_fb_clear(struct pkg_conn *pcp, char *buf)
{
RGBpixel bg;
char rbuf[NET_LONG_LEN+1];
if (buf == NULL) {
- bu_log("rfbwindow: null buffer\n");
+ bu_log("fb_server_fb_window: null buffer\n");
return;
}
@@ -566,12 +564,13 @@
(void)pkg_plong(rbuf, fb_clear(fbp, bg));
pkg_send(MSG_RETURN, rbuf, NET_LONG_LEN, pcp);
- (void)free(buf);
+ if (buf)
+ (void)free(buf);
}
-void
-rfbread(struct pkg_conn *pcp, char *buf)
+static void
+fb_server_fb_read(struct pkg_conn *pcp, char *buf)
{
int x, y;
size_t num;
@@ -580,7 +579,7 @@
static size_t buflen = 0;
if (buf == NULL) {
- bu_log("rfbreadrect: null buffer\n");
+ bu_log("fb_server_fb_readrect: null buffer\n");
return;
}
@@ -596,7 +595,8 @@
buflen = 1024*sizeof(RGBpixel);
if ((scanbuf = (unsigned char *)malloc(buflen)) == NULL) {
fb_log("fb_read: malloc failed!");
- (void)free(buf);
+ if (buf)
+ (void)free(buf);
buflen = 0;
return;
}
@@ -606,12 +606,13 @@
if (ret < 0) ret = 0; /* map error indications */
/* sending a 0-length package indicates error */
pkg_send(MSG_RETURN, (char *)scanbuf, ret*sizeof(RGBpixel), pcp);
- (void)free(buf);
+ if (buf)
+ (void)free(buf);
}
-void
-rfbwrite(struct pkg_conn *pcp, char *buf)
+static void
+fb_server_fb_write(struct pkg_conn *pcp, char *buf)
{
int x, y, num;
char rbuf[NET_LONG_LEN+1];
@@ -619,7 +620,7 @@
int type;
if (buf == NULL) {
- bu_log("rfbreadrect: null buffer\n");
+ bu_log("fb_server_fb_readrect: null buffer\n");
return;
}
@@ -633,12 +634,13 @@
(void)pkg_plong(&rbuf[0*NET_LONG_LEN], ret);
pkg_send(MSG_RETURN, rbuf, NET_LONG_LEN, pcp);
}
- (void)free(buf);
+ if (buf)
+ (void)free(buf);
}
-void
-rfbreadrect(struct pkg_conn *pcp, char *buf)
+static void
+fb_server_fb_readrect(struct pkg_conn *pcp, char *buf)
{
int xmin, ymin;
int width, height;
@@ -648,7 +650,7 @@
static size_t buflen = 0;
if (buf == NULL) {
- bu_log("rfbreadrect: null buffer\n");
+ bu_log("fb_server_fb_readrect: null buffer\n");
return;
}
@@ -666,7 +668,8 @@
buflen = 1024*sizeof(RGBpixel);
if ((scanbuf = (unsigned char *)malloc(buflen)) == NULL) {
fb_log("fb_read: malloc failed!");
- (void)free(buf);
+ if (buf)
+ (void)free(buf);
buflen = 0;
return;
}
@@ -676,12 +679,13 @@
if (ret < 0) ret = 0; /* map error indications */
/* sending a 0-length package indicates error */
pkg_send(MSG_RETURN, (char *)scanbuf, ret*sizeof(RGBpixel), pcp);
- (void)free(buf);
+ if (buf)
+ (void)free(buf);
}
-void
-rfbwriterect(struct pkg_conn *pcp, char *buf)
+static void
+fb_server_fb_writerect(struct pkg_conn *pcp, char *buf)
{
int x, y;
int width, height;
@@ -690,7 +694,7 @@
int type;
if (buf == NULL) {
- bu_log("rfbreadrect: null buffer\n");
+ bu_log("fb_server_fb_readrect: null buffer\n");
return;
}
@@ -707,12 +711,13 @@
(void)pkg_plong(&rbuf[0*NET_LONG_LEN], ret);
pkg_send(MSG_RETURN, rbuf, NET_LONG_LEN, pcp);
}
- (void)free(buf);
+ if (buf)
+ (void)free(buf);
}
-void
-rfbbwreadrect(struct pkg_conn *pcp, char *buf)
+static void
+fb_server_fb_bwreadrect(struct pkg_conn *pcp, char *buf)
{
int xmin, ymin;
int width, height;
@@ -722,7 +727,7 @@
static int buflen = 0;
if (buf == NULL) {
- bu_log("rfbbwreadrect: null buffer\n");
+ bu_log("fb_server_fb_bwreadrect: null buffer\n");
return;
}
@@ -739,7 +744,7 @@
if (buflen < 1024)
buflen = 1024;
if ((scanbuf = (unsigned char *)malloc(buflen)) == NULL) {
- fb_log("rfbbwreadrect: malloc failed!");
+ fb_log("fb_server_fb_bwreadrect: malloc failed!");
(void)free(buf);
buflen = 0;
return;
@@ -754,8 +759,11 @@
}
-void
-rfbbwwriterect(struct pkg_conn *pcp, char *buf)
+/*
+ * A whole rectangle of monochrome pixels at once, probably large.
+ */
+static void
+fb_server_fb_bwwriterect(struct pkg_conn *pcp, char *buf)
{
int x, y;
int width, height;
@@ -781,18 +789,19 @@
(void)pkg_plong(&rbuf[0*NET_LONG_LEN], ret);
pkg_send(MSG_RETURN, rbuf, NET_LONG_LEN, pcp);
}
- (void)free(buf);
+ if (buf)
+ (void)free(buf);
}
-void
-rfbcursor(struct pkg_conn *pcp, char *buf)
+static void
+fb_server_fb_cursor(struct pkg_conn *pcp, char *buf)
{
int mode, x, y;
char rbuf[NET_LONG_LEN+1];
if (buf == NULL) {
- bu_log("rfbwindow: null buffer\n");
+ bu_log("fb_server_fb_window: null buffer\n");
return;
}
@@ -802,12 +811,13 @@
(void)pkg_plong(&rbuf[0], fb_cursor(fbp, mode, x, y));
pkg_send(MSG_RETURN, rbuf, NET_LONG_LEN, pcp);
- (void)free(buf);
+ if (buf)
+ (void)free(buf);
}
-void
-rfbgetcursor(struct pkg_conn *pcp, char *buf)
+static void
+fb_server_fb_getcursor(struct pkg_conn *pcp, char *buf)
{
int ret;
int mode, x, y;
@@ -819,12 +829,13 @@
(void)pkg_plong(&rbuf[2*NET_LONG_LEN], x);
(void)pkg_plong(&rbuf[3*NET_LONG_LEN], y);
pkg_send(MSG_RETURN, rbuf, 4*NET_LONG_LEN, pcp);
- if (buf) (void)free(buf);
+ if (buf)
+ (void)free(buf);
}
-void
-rfbsetcursor(struct pkg_conn *pcp, char *buf)
+static void
+fb_server_fb_setcursor(struct pkg_conn *pcp, char *buf)
{
char rbuf[NET_LONG_LEN+1];
int ret;
@@ -832,7 +843,7 @@
int xorig, yorig;
if (buf == NULL) {
- bu_log("rfbreadrect: null buffer\n");
+ bu_log("fb_server_fb_readrect: null buffer\n");
return;
}
@@ -848,19 +859,22 @@
(void)pkg_plong(&rbuf[0*NET_LONG_LEN], ret);
pkg_send(MSG_RETURN, rbuf, NET_LONG_LEN, pcp);
}
- (void)free(buf);
+ if (buf)
+ (void)free(buf);
}
-/*OLD*/
-void
-rfbscursor(struct pkg_conn *pcp, char *buf)
+/*
+ * An OLD interface. Retained so old clients can still be served.
+ */
+static void
+fb_server_fb_scursor(struct pkg_conn *pcp, char *buf)
{
int mode, x, y;
char rbuf[NET_LONG_LEN+1];
if (buf == NULL) {
- bu_log("rfbopen: null buffer\n");
+ bu_log("fb_server_fb_open: null buffer\n");
return;
}
@@ -874,15 +888,17 @@
}
-/*OLD*/
-void
-rfbwindow(struct pkg_conn *pcp, char *buf)
+/*
+ * An OLD interface. Retained so old clients can still be served.
+ */
+static void
+fb_server_fb_window(struct pkg_conn *pcp, char *buf)
{
int x, y;
char rbuf[NET_LONG_LEN+1];
if (buf == NULL) {
- bu_log("rfbwindow: null buffer\n");
+ bu_log("fb_server_fb_window: null buffer\n");
return;
}
@@ -891,19 +907,22 @@
(void)pkg_plong(&rbuf[0], fb_window(fbp, x, y));
pkg_send(MSG_RETURN, rbuf, NET_LONG_LEN, pcp);
- (void)free(buf);
+ if (buf)
+ (void)free(buf);
}
-/*OLD*/
-void
-rfbzoom(struct pkg_conn *pcp, char *buf)
+/*
+ * An OLD interface. Retained so old clients can still be served.
+ */
+static void
+fb_server_fb_zoom(struct pkg_conn *pcp, char *buf)
{
int x, y;
char rbuf[NET_LONG_LEN+1];
if (buf == NULL) {
- bu_log("rfbreadrect: null buffer\n");
+ bu_log("fb_server_fb_readrect: null buffer\n");
return;
}
@@ -912,12 +931,13 @@
(void)pkg_plong(&rbuf[0], fb_zoom(fbp, x, y));
pkg_send(MSG_RETURN, rbuf, NET_LONG_LEN, pcp);
- (void)free(buf);
+ if (buf)
+ (void)free(buf);
}
-void
-rfbview(struct pkg_conn *pcp, char *buf)
+static void
+fb_server_fb_view(struct pkg_conn *pcp, char *buf)
{
int ret;
int xcenter, ycenter, xzoom, yzoom;
@@ -924,7 +944,7 @@
char rbuf[NET_LONG_LEN+1];
if (buf == NULL) {
- bu_log("rfbreadrect: null buffer\n");
+ bu_log("fb_server_fb_readrect: null buffer\n");
return;
}
@@ -936,12 +956,13 @@
ret = fb_view(fbp, xcenter, ycenter, xzoom, yzoom);
(void)pkg_plong(&rbuf[0], ret);
pkg_send(MSG_RETURN, rbuf, NET_LONG_LEN, pcp);
- (void)free(buf);
+ if (buf)
+ (void)free(buf);
}
-void
-rfbgetview(struct pkg_conn *pcp, char *buf)
+static void
+fb_server_fb_getview(struct pkg_conn *pcp, char *buf)
{
int ret;
int xcenter, ycenter, xzoom, yzoom;
@@ -954,12 +975,13 @@
(void)pkg_plong(&rbuf[3*NET_LONG_LEN], xzoom);
(void)pkg_plong(&rbuf[4*NET_LONG_LEN], yzoom);
pkg_send(MSG_RETURN, rbuf, 5*NET_LONG_LEN, pcp);
- if (buf) (void)free(buf);
+ if (buf)
+ (void)free(buf);
}
-void
-rfbrmap(struct pkg_conn *pcp, char *buf)
+static void
+fb_server_fb_rmap(struct pkg_conn *pcp, char *buf)
{
int i;
char rbuf[NET_LONG_LEN+1];
@@ -974,7 +996,8 @@
}
pkg_send(MSG_DATA, (char *)cm, sizeof(cm), pcp);
pkg_send(MSG_RETURN, rbuf, NET_LONG_LEN, pcp);
- if (buf) (void)free(buf);
+ if (buf)
+ (void)free(buf);
}
@@ -984,8 +1007,8 @@
* (IBM) order 2-byte short, 256 red shorts, followed by 256 green and
* 256 blue, for a total of 3*256*2 bytes.
*/
-void
-rfbwmap(struct pkg_conn *pcp, char *buf)
+static void
+fb_server_fb_wmap(struct pkg_conn *pcp, char *buf)
{
int i;
char rbuf[NET_LONG_LEN+1];
@@ -993,7 +1016,7 @@
ColorMap map;
if (buf == NULL) {
- bu_log("rfbwmap: null buffer\n");
+ bu_log("fb_server_fb_wmap: null buffer\n");
return;
}
@@ -1009,12 +1032,13 @@
}
(void)pkg_plong(&rbuf[0], ret);
pkg_send(MSG_RETURN, rbuf, NET_LONG_LEN, pcp);
- (void)free(buf);
+ if (buf)
+ (void)free(buf);
}
-void
-rfbflush(struct pkg_conn *pcp, char *buf)
+static void
+fb_server_fb_flush(struct pkg_conn *pcp, char *buf)
{
int ret;
char rbuf[NET_LONG_LEN+1];
@@ -1025,12 +1049,14 @@
(void)pkg_plong(rbuf, ret);
pkg_send(MSG_RETURN, rbuf, NET_LONG_LEN, pcp);
}
- if (buf) (void)free(buf);
+
+ if (buf)
+ (void)free(buf);
}
-void
-rfbpoll(struct pkg_conn *pcp, char *buf)
+static void
+fb_server_fb_poll(struct pkg_conn *pcp, char *buf)
{
if (!pcp) return;
(void)fb_poll(fbp);
@@ -1042,14 +1068,14 @@
* At one time at least we couldn't send a zero length PKG message
* back and forth, so we receive a dummy long here.
*/
-void
-rfbhelp(struct pkg_conn *pcp, char *buf)
+static void
+fb_server_fb_help(struct pkg_conn *pcp, char *buf)
{
long ret;
char rbuf[NET_LONG_LEN+1];
if (buf == NULL) {
- bu_log("rfbwindow: null buffer\n");
+ bu_log("fb_server_fb_window: null buffer\n");
return;
}
@@ -1058,10 +1084,45 @@
ret = fb_help(fbp);
(void)pkg_plong(&rbuf[0], ret);
pkg_send(MSG_RETURN, rbuf, NET_LONG_LEN, pcp);
- (void)free(buf);
+ if (buf)
+ (void)free(buf);
}
+const struct pkg_switch pkg_switch[] = {
+ { MSG_FBOPEN, fb_server_fb_open, "Open
Framebuffer", NULL },
+ { MSG_FBCLOSE, fb_server_fb_close, "Close
Framebuffer", NULL },
+ { MSG_FBCLEAR, fb_server_fb_clear, "Clear
Framebuffer", NULL },
+ { MSG_FBREAD, fb_server_fb_read, "Read
Pixels", NULL },
+ { MSG_FBWRITE, fb_server_fb_write, "Write
Pixels", NULL },
+ { MSG_FBWRITE + MSG_NORETURN, fb_server_fb_write, "Asynch
write", NULL },
+ { MSG_FBCURSOR, fb_server_fb_cursor, "Cursor",
NULL },
+ { MSG_FBGETCURSOR, fb_server_fb_getcursor, "Get
Cursor", NULL }, /*NEW*/
+ { MSG_FBSCURSOR, fb_server_fb_scursor, "Screen
Cursor", NULL }, /*OLD*/
+ { MSG_FBWINDOW, fb_server_fb_window, "Window",
NULL }, /*OLD*/
+ { MSG_FBZOOM, fb_server_fb_zoom, "Zoom", NULL
}, /*OLD*/
+ { MSG_FBVIEW, fb_server_fb_view, "View", NULL
}, /*NEW*/
+ { MSG_FBGETVIEW, fb_server_fb_getview, "Get View",
NULL }, /*NEW*/
+ { MSG_FBRMAP, fb_server_fb_rmap, "R Map",
NULL },
+ { MSG_FBWMAP, fb_server_fb_wmap, "W Map",
NULL },
+ { MSG_FBHELP, fb_server_fb_help, "Help
Request", NULL },
+ { MSG_ERROR, fb_server_fb_unknown, "Error
Message", NULL },
+ { MSG_CLOSE, fb_server_fb_unknown, "Close
Connection", NULL },
+ { MSG_FBREADRECT, fb_server_fb_readrect, "Read
Rectangle", NULL },
+ { MSG_FBWRITERECT, fb_server_fb_writerect, "Write
Rectangle", NULL },
+ { MSG_FBWRITERECT + MSG_NORETURN, fb_server_fb_writerect, "Write
Rectangle", NULL },
+ { MSG_FBBWREADRECT, fb_server_fb_bwreadrect, "Read BW
Rectangle", NULL },
+ { MSG_FBBWWRITERECT, fb_server_fb_bwwriterect, "Write BW
Rectangle", NULL },
+ { MSG_FBBWWRITERECT + MSG_NORETURN, fb_server_fb_bwwriterect, "Write BW
Rectangle", NULL },
+ { MSG_FBFLUSH, fb_server_fb_flush, "Flush
Output", NULL },
+ { MSG_FBFLUSH + MSG_NORETURN, fb_server_fb_flush, "Flush
Output", NULL },
+ { MSG_FBFREE, fb_server_fb_free, "Free
Resources", NULL },
+ { MSG_FBPOLL, fb_server_fb_poll, "Handle
Events", NULL },
+ { MSG_FBSETCURSOR, fb_server_fb_setcursor, "Set Cursor
Shape", NULL },
+ { MSG_FBSETCURSOR + MSG_NORETURN, fb_server_fb_setcursor, "Set Cursor
Shape", NULL },
+ { 0, NULL, NULL, NULL }
+};
+
/*
* Local Variables:
* mode: C
Deleted: brlcad/branches/bioh/src/mged/fbserv.h
===================================================================
--- brlcad/branches/bioh/src/mged/fbserv.h 2020-08-07 14:38:45 UTC (rev
76684)
+++ brlcad/branches/bioh/src/mged/fbserv.h 2020-08-07 14:43:24 UTC (rev
76685)
@@ -1,85 +0,0 @@
-/* F B S E R V . H
- * BRL-CAD
- *
- * Copyright (c) 2004-2020 United States Government as represented by
- * the U.S. Army Research Laboratory.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * version 2.1 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this file; see the file named COPYING for more
- * information.
- */
-/** @file mged/fbserv.h
- * Package Handlers.
- */
-#ifndef MGED_FBSERV_H
-#define MGED_FBSERV_H
-
-#include "dm.h"
-
-void rfbopen(struct pkg_conn *pcp, char *buf), rfbclose(struct pkg_conn *pcp,
char *buf), rfbclear(struct pkg_conn *pcp, char *buf), rfbread(struct pkg_conn
*pcp, char *buf), rfbwrite(struct pkg_conn *pcp, char *buf);
-void rfbcursor(struct pkg_conn *pcp, char *buf), rfbgetcursor(struct pkg_conn
*pcp, char *buf);
-void rfbrmap(struct pkg_conn *pcp, char *buf), rfbwmap(struct pkg_conn *pcp,
char *buf);
-void rfbhelp(struct pkg_conn *pcp, char *buf);
-void rfbreadrect(struct pkg_conn *pcp, char *buf), rfbwriterect(struct
pkg_conn *pcp, char *buf);
-void rfbbwreadrect(struct pkg_conn *pcp, char *buf), rfbbwwriterect(struct
pkg_conn *pcp, char *buf);
-void rfbpoll(struct pkg_conn *pcp, char *buf), rfbflush(struct pkg_conn *pcp,
char *buf), rfbfree(struct pkg_conn *pcp, char *buf);
-void rfbview(struct pkg_conn *pcp, char *buf), rfbgetview(struct pkg_conn
*pcp, char *buf);
-void rfbsetcursor(struct pkg_conn *pcp, char *buf);
-void rfbunknown(struct pkg_conn *pcp, char *buf);
-/* Old Routines */
-void rfbscursor(struct pkg_conn *pcp, char *buf), rfbwindow(struct pkg_conn
*pcp, char *buf), rfbzoom(struct pkg_conn *pcp, char *buf);
-
-static struct pkg_switch pkg_switch[] = {
- { MSG_FBOPEN, rfbopen, "Open Framebuffer",
NULL },
- { MSG_FBCLOSE, rfbclose, "Close Framebuffer",
NULL },
- { MSG_FBCLEAR, rfbclear, "Clear Framebuffer",
NULL },
- { MSG_FBREAD, rfbread, "Read Pixels", NULL },
- { MSG_FBWRITE, rfbwrite, "Write Pixels", NULL },
- { MSG_FBWRITE + MSG_NORETURN, rfbwrite, "Asynch write", NULL },
- { MSG_FBCURSOR, rfbcursor, "Cursor", NULL },
- { MSG_FBGETCURSOR, rfbgetcursor, "Get Cursor", NULL },
/*NEW*/
- { MSG_FBSCURSOR, rfbscursor, "Screen Cursor", NULL
}, /*OLD*/
- { MSG_FBWINDOW, rfbwindow, "Window", NULL },
/*OLD*/
- { MSG_FBZOOM, rfbzoom, "Zoom", NULL },
/*OLD*/
- { MSG_FBVIEW, rfbview, "View", NULL },
/*NEW*/
- { MSG_FBGETVIEW, rfbgetview, "Get View", NULL },
/*NEW*/
- { MSG_FBRMAP, rfbrmap, "R Map", NULL },
- { MSG_FBWMAP, rfbwmap, "W Map", NULL },
- { MSG_FBHELP, rfbhelp, "Help Request", NULL },
- { MSG_ERROR, rfbunknown, "Error Message", NULL },
- { MSG_CLOSE, rfbunknown, "Close Connection",
NULL },
- { MSG_FBREADRECT, rfbreadrect, "Read Rectangle", NULL
},
- { MSG_FBWRITERECT, rfbwriterect, "Write Rectangle", NULL
},
- { MSG_FBWRITERECT + MSG_NORETURN, rfbwriterect, "Write Rectangle", NULL
},
- { MSG_FBBWREADRECT, rfbbwreadrect, "Read BW Rectangle",
NULL },
- { MSG_FBBWWRITERECT, rfbbwwriterect, "Write BW Rectangle",
NULL },
- { MSG_FBBWWRITERECT + MSG_NORETURN, rfbbwwriterect, "Write BW
Rectangle", NULL },
- { MSG_FBFLUSH, rfbflush, "Flush Output", NULL },
- { MSG_FBFLUSH + MSG_NORETURN, rfbflush, "Flush Output", NULL },
- { MSG_FBFREE, rfbfree, "Free Resources", NULL
},
- { MSG_FBPOLL, rfbpoll, "Handle Events", NULL },
- { MSG_FBSETCURSOR, rfbsetcursor, "Set Cursor Shape",
NULL },
- { MSG_FBSETCURSOR + MSG_NORETURN, rfbsetcursor, "Set Cursor Shape",
NULL },
- { 0, NULL, NULL, NULL }
-};
-
-
-#endif /* MGED_FBSERV_H */
-/*
- * Local Variables:
- * mode: C
- * tab-width: 8
- * indent-tabs-mode: t
- * c-file-style: "stroustrup"
- * End:
- * ex: shiftwidth=4 tabstop=8
- */
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