remove XCB code (HAS_XCB=1 macro), align find_gl_fb_attachment() prototype declaration to match other functions, avoiding warning in dep_add()

This commit is contained in:
Stefan Frederik 2022-01-17 17:40:07 +01:00
parent 6b97846985
commit 2d6a0fea52
5 changed files with 1 additions and 118 deletions

View File

@ -1,6 +1,6 @@
int find_gl(const char *name, int logdepth, int fatal);
int find_gl_vao(const char *name, int logdepth, int fatal);
int find_gl_fb_attachment(const char *name, int logdepth, int fatal, const char *call, const char *arg);
int find_gl_fb_attachment(const char *name, int logdepth, int fatal);
int find_glu(const char *name, int logdepth, int fatal);
int find_glut(const char *name, int logdepth, int fatal);

View File

@ -130,13 +130,6 @@ Visual *visual;
XRenderPictFormat *render_format;
#endif
#if HAS_XCB==1
xcb_connection_t *xcbconn;
xcb_render_pictforminfo_t format_rgb, format_rgba;
xcb_screen_t *screen_xcb;
xcb_visualtype_t *visual_xcb;
#endif /*HAS_XCB */
/* ---------------------------------------------- */
/* These variables are mirrored in tcl code */
/* ---------------------------------------------- */

View File

@ -1152,9 +1152,6 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
#ifdef HAS_CAIRO
my_snprintf(res, S(res), "HAS_CAIRO=%d\n", HAS_CAIRO); Tcl_AppendResult(interp, res, NULL);
#endif
#ifdef HAS_XCB
my_snprintf(res, S(res), "HAS_XCB=%d\n", HAS_XCB); Tcl_AppendResult(interp, res, NULL);
#endif
#ifdef XSCHEM_SHAREDIR
my_snprintf(res, S(res), "XSCHEM_SHAREDIR=%s\n", XSCHEM_SHAREDIR); Tcl_AppendResult(interp, res, NULL);
#endif

View File

@ -871,28 +871,6 @@ void tclexit(ClientData s)
if(init_done) xwin_exit();
}
#if HAS_XCB==1
/* from xcb.freedesktop.org -- don't ask me what it does... 20171125 */
static xcb_visualtype_t *find_visual(xcb_connection_t *xcbconn, xcb_visualid_t visual)
{
xcb_screen_iterator_t screen_iter = xcb_setup_roots_iterator(xcb_get_setup(xcbconn));
for (; screen_iter.rem; xcb_screen_next(&screen_iter)) {
xcb_depth_iterator_t depth_iter = xcb_screen_allowed_depths_iterator(screen_iter.data);
for (; depth_iter.rem; xcb_depth_next(&depth_iter)) {
xcb_visualtype_iterator_t visual_iter = xcb_depth_visuals_iterator(depth_iter.data);
for (; visual_iter.rem; xcb_visualtype_next(&visual_iter)) {
if (visual == visual_iter.data->visual_id) {
return visual_iter.data;
}
}
}
}
return NULL;
}
#endif /*HAS_XCB */
int source_tcl_file(char *s)
{
char tmp[1024];
@ -1510,13 +1488,8 @@ void resetcairo(int create, int clear, int force_or_resize)
if(create && force_or_resize) {
/***** Create Cairo save buffer drawing area *****/
#if HAS_XRENDER==1
#if HAS_XCB==1
xctx->cairo_save_sfc = cairo_xcb_surface_create_with_xrender_format(xcbconn, screen_xcb, xctx->save_pixmap,
&format_rgb, xctx->xrect[0].width, xctx->xrect[0].height);
#else
xctx->cairo_save_sfc = cairo_xlib_surface_create_with_xrender_format(display, xctx->save_pixmap,
DefaultScreenOfDisplay(display), render_format, xctx->xrect[0].width, xctx->xrect[0].height);
#endif /* HAS_XCB */
#else
xctx->cairo_save_sfc =
cairo_xlib_surface_create(display, xctx->save_pixmap, visual, xctx->xrect[0].width, xctx->xrect[0].height);
@ -1533,15 +1506,9 @@ void resetcairo(int create, int clear, int force_or_resize)
cairo_set_line_cap(xctx->cairo_save_ctx, CAIRO_LINE_CAP_ROUND);
/***** Create Cairo main drawing window structures *****/
#if HAS_XRENDER==1
#if HAS_XCB==1
dbg(1, "create_cairo_surface: w=%d, h=%d\n", xctx->xrect[0].width, xctx->xrect[0].height);
xctx->cairo_sfc = cairo_xcb_surface_create_with_xrender_format(xcbconn,
screen_xcb, xctx->window, &format_rgb, xctx->xrect[0].width, xctx->xrect[0].height);
#else
xctx->cairo_sfc = cairo_xlib_surface_create_with_xrender_format (display,
xctx->window, DefaultScreenOfDisplay(display), render_format,
xctx->xrect[0].width, xctx->xrect[0].height);
#endif /* HAS_XCB */
#else
xctx->cairo_sfc = cairo_xlib_surface_create(display, xctx->window, visual,
xctx->xrect[0].width, xctx->xrect[0].height);
@ -1556,13 +1523,6 @@ void resetcairo(int create, int clear, int force_or_resize)
cairo_set_line_width(xctx->cairo_ctx, 1);
cairo_set_line_join(xctx->cairo_ctx, CAIRO_LINE_JOIN_ROUND);
cairo_set_line_cap(xctx->cairo_ctx, CAIRO_LINE_CAP_ROUND);
#if 0
* #if HAS_XCB==1 && HAS_XRENDER==1
* cairo_xcb_surface_set_size(xctx->cairo_sfc, xctx->xrect[0].width, xctx->xrect[0].height);
* #else
* cairo_xlib_surface_set_size(xctx->cairo_sfc, xctx->xrect[0].width, xctx->xrect[0].height);
* #endif /* HAS_XCB && HAS_XRENDER */
#endif
}
#endif /* HAS_CAIRO */
}
@ -1664,15 +1624,6 @@ int Tcl_AppInit(Tcl_Interp *inter)
int running_in_src_dir;
int fs;
/* XVisualInfo vinfo; */
#if HAS_XCB==1
#if HAS_XRENDER==1
xcb_render_query_pict_formats_reply_t *formats_reply;
xcb_render_pictforminfo_t *formats;
xcb_render_query_pict_formats_cookie_t formats_cookie;
#endif
#endif
/* get PWD and HOME */
if(!getcwd(pwd_dir, PATH_MAX)) {
fprintf(errfp, "Tcl_AppInit(): getcwd() failed\n");
@ -2075,47 +2026,6 @@ int Tcl_AppInit(Tcl_Interp *inter)
dbg(1, "Tcl_AppInit(): top window ID=0x%lx\n",topwindow);
dbg(1, "Tcl_AppInit(): done tkinit()\n");
#if HAS_XCB==1
/* grab an existing xlib connection 20171125 */
xcbconn = XGetXCBConnection(display);
if(xcb_connection_has_error(xcbconn)) {
fprintf(errfp, "Could not connect to X11 server");
return 1;
}
screen_xcb = xcb_setup_roots_iterator(xcb_get_setup(xcbconn)).data;
visual_xcb = find_visual(xcbconn, screen_xcb->root_visual);
if(!visual_xcb) {
fprintf(errfp, "got NULL (xcb_visualtype_t)visual");
return 1;
}
#if HAS_XRENDER==1
/*/--------------------------Xrender xcb stuff------- */
formats_cookie = xcb_render_query_pict_formats(xcbconn);
formats_reply = xcb_render_query_pict_formats_reply(xcbconn, formats_cookie, 0);
formats = xcb_render_query_pict_formats_formats(formats_reply);
for (i = 0; i < formats_reply->num_formats; i++) {
/* fprintf(errfp, "i=%d depth=%d type=%d red_shift=%d\n", i,
formats[i].depth, formats[i].type, formats[i].direct.red_shift); */
if (formats[i].direct.red_mask != 0xff &&
formats[i].direct.red_shift != 16)
continue;
if (formats[i].type == XCB_RENDER_PICT_TYPE_DIRECT &&
formats[i].depth == 24 && formats[i].direct.red_shift == 16)
format_rgb = formats[i];
if (formats[i].type == XCB_RENDER_PICT_TYPE_DIRECT &&
formats[i].depth == 32 &&
formats[i].direct.alpha_mask == 0xff &&
formats[i].direct.alpha_shift == 24)
format_rgba = formats[i];
}
free(formats_reply); /* can not use my_free() since not allocated by my_* allocator wrappers */
formats_reply = NULL;
#endif /* HAS_XRENDER */
/*/---------------------------------------------------- */
/* /20171125 */
#endif /*HAS_XCB */
screen_number = Tk_ScreenNumber(mainwindow);
colormap = Tk_Colormap(mainwindow);
screendepth = Tk_Depth(mainwindow);

View File

@ -105,18 +105,10 @@ extern char win_temp_dir[PATH_MAX];
#endif
#if HAS_XCB==1
#include <xcb/render.h>
#include <X11/Xlib-xcb.h>
#endif
#if HAS_CAIRO==1
#include <cairo.h>
#include <cairo-xlib.h>
#include "cairo-xlib-xrender.h"
#if HAS_XCB==1
#include <cairo-xcb.h>
#endif
#endif
#include <tcl.h>
@ -946,15 +938,6 @@ extern Visual *visual;
#if HAS_XRENDER==1
extern XRenderPictFormat *render_format;
#endif
#if HAS_XCB==1
extern xcb_connection_t *xcbconn;
extern xcb_screen_t *screen_xcb;
#if HAS_XRENDER==1
extern xcb_render_pictforminfo_t format_rgb, format_rgba;
#endif
extern xcb_visualtype_t *visual_xcb;
#endif /* HAS_XCB */
/*********** These variables are mirrored in tcl code ***********/
extern int cadlayers;
extern int has_x;