Fix for issue #253: Remove xdbe support

This commit is contained in:
ManoloFLTK 2021-11-26 15:01:36 +01:00
parent 2b400f6abc
commit 84cf249482
14 changed files with 5 additions and 211 deletions

View File

@ -595,18 +595,6 @@ else(OPTION_USE_XRENDER)
set (FLTK_XRENDER_FOUND FALSE)
endif (OPTION_USE_XRENDER)
#######################################################################
if (X11_FOUND)
option (OPTION_USE_XDBE "use lib Xdbe" ON)
endif (X11_FOUND)
if (OPTION_USE_XDBE AND HAVE_XDBE_H)
set (HAVE_XDBE 1)
set (FLTK_XDBE_FOUND TRUE)
else()
set (FLTK_XDBE_FOUND FALSE)
endif (OPTION_USE_XDBE AND HAVE_XDBE_H)
#######################################################################
set (FL_NO_PRINT_SUPPORT FALSE)
if (X11_FOUND AND NOT OPTION_PRINT_SUPPORT)

View File

@ -62,7 +62,6 @@ fl_find_header (HAVE_SYS_SELECT_H sys/select.h)
fl_find_header (HAVE_SYS_STDTYPES_H sys/stdtypes.h)
fl_find_header (HAVE_X11_XREGION_H "X11/Xlib.h;X11/Xregion.h")
fl_find_header (HAVE_XDBE_H "X11/Xlib.h;X11/extensions/Xdbe.h")
if (WIN32 AND NOT CYGWIN)
# we don't use pthreads on Windows (except for Cygwin, see options.cmake)
@ -154,7 +153,7 @@ mark_as_advanced (HAVE_OPENGL_GLU_H HAVE_PNG_H)
mark_as_advanced (HAVE_PTHREAD_H HAVE_PTHREAD_MUTEX_RECURSIVE)
mark_as_advanced (HAVE_STDIO_H HAVE_STRINGS_H HAVE_SYS_DIR_H)
mark_as_advanced (HAVE_SYS_NDIR_H HAVE_SYS_SELECT_H)
mark_as_advanced (HAVE_SYS_STDTYPES_H HAVE_XDBE_H)
mark_as_advanced (HAVE_SYS_STDTYPES_H)
mark_as_advanced (HAVE_X11_XREGION_H)
#----------------------------------------------------------------------

View File

@ -24,16 +24,8 @@
/**
The Fl_Double_Window provides a double-buffered window.
If possible this will use the X double buffering extension (Xdbe). If
not, it will draw the window data into an off-screen pixmap, and then
It will draw the window data into an off-screen pixmap, and then
copy it to the on-screen window.
<P>It is highly recommended that you put the following code before the
first show() of <I>any</I> window in your program: </P>
\code
Fl::visual(FL_DOUBLE|FL_INDEX)
\endcode
This makes sure you can use Xdbe on servers where double buffering
does not exist for every visual.
*/
class FL_EXPORT Fl_Double_Window : public Fl_Window
{

View File

@ -153,7 +153,6 @@ OPTION_USE_SVG - default ON
OPTION_USE_XINERAMA - default ON
OPTION_USE_XFT - default ON
OPTION_USE_XDBE - default ON
OPTION_USE_XCURSOR - default ON
OPTION_USE_XRENDER - default ON
These are X11 extended libraries. These libs are used if found on the

View File

@ -109,22 +109,6 @@
#cmakedefine01 USE_PANGO
/*
* HAVE_XDBE:
*
* Do we have the X double-buffer extension?
*/
#cmakedefine01 HAVE_XDBE
/*
* USE_XDBE:
*
* Actually try to use the double-buffer extension?
*/
#define USE_XDBE HAVE_XDBE
/*
* HAVE_XFIXES:
*

View File

@ -108,22 +108,6 @@
#define USE_PANGO 0
/*
* HAVE_XDBE:
*
* Do we have the X double-buffer extension?
*/
#define HAVE_XDBE 0
/*
* USE_XDBE:
*
* Actually try to use the double-buffer extension?
*/
#define USE_XDBE HAVE_XDBE
/*
* HAVE_XFIXES:
*

View File

@ -127,8 +127,6 @@ AC_ARG_ENABLE([x11], AS_HELP_STRING([--enable-x11], [use X11 with Cygwin or macO
AC_ARG_ENABLE([xcursor], AS_HELP_STRING([--disable-xcursor], [turn off Xcursor support]))
AC_ARG_ENABLE([xdbe], AS_HELP_STRING([--disable-xdbe], [turn off Xdbe support]))
AC_ARG_ENABLE([xfixes], AS_HELP_STRING([--disable-xfixes], [turn off Xfixes support]))
AC_ARG_ENABLE([xft], AS_HELP_STRING([--disable-xft], [turn off Xft support]))
@ -1154,18 +1152,6 @@ AS_CASE([$host_os_gui], [cygwin* | mingw*], [
])
])
dnl Check for the Xdbe extension unless disabled...
xdbe_found=no
AS_IF([test x$enable_xdbe != xno], [
AC_CHECK_HEADER([X11/extensions/Xdbe.h], [
AC_CHECK_LIB([Xext], [XdbeQueryExtension], [
AC_DEFINE([HAVE_XDBE])
LIBS="-lXext $LIBS"
xdbe_found=yes
])
], [], [#include <X11/Xlib.h>])
])
dnl Check for the Xfixes extension unless disabled...
xfixes_found=no
AS_IF([test x$enable_xfixes != xno], [
@ -1564,9 +1550,6 @@ AS_CASE([$host_os_gui], [cygwin* | mingw*], [
AS_IF([test x$xft_found = xyes], [
graphics="$graphics + Xft"
])
AS_IF([test x$xdbe_found = xyes], [
graphics="$graphics + Xdbe"
])
AS_IF([test x$xfixes_found = xyes], [
graphics="$graphics + Xfixes"
])

View File

@ -40,13 +40,6 @@
less-than-24 bit deep visual. This call fails if 24 bits are not
available.
<BR>&nbsp; </LI>
<LI>Fl::visual(FL_DOUBLE|FL_INDEX)
<BR>Hardware double buffering. Call this if you are going to use
Fl_Double_Window.
<BR>&nbsp; </LI>
<LI>Fl::visual(FL_DOUBLE|FL_RGB)</LI>
<LI>Fl::visual(FL_DOUBLE|FL_RGB8)
<BR>Hardware double buffering and full color.
</UL>
<P>This returns true if the system has the capabilities by default or

View File

@ -2489,9 +2489,6 @@ Fl_X* Fl_X::set_xid(Fl_Window* win, Window winxid) {
xp->next = Fl_X::first;
xp->region = 0;
Fl_Window_Driver::driver(win)->wait_for_expose_value = 1;
#ifdef USE_XDBE
Fl_X11_Window_Driver::driver(win)->backbuffer_bad = 1;
#endif
Fl_X::first = xp;
if (win->modal()) {Fl::modal_ = win; fl_fix_focus();}
return xp;

View File

@ -35,10 +35,6 @@
# include <X11/extensions/Xinerama.h>
#endif
#if USE_XDBE
#include <X11/extensions/Xdbe.h>
#endif
# include <X11/Xutil.h>
# ifdef __sgi
# include <X11/extensions/readdisplay.h>
@ -145,23 +141,6 @@ static int test_visual(XVisualInfo& v, int flags) {
#else
// simpler if we can't use colormapped visuals at all:
if (v.c_class != StaticColor && v.c_class != TrueColor) return 0;
#endif
#if USE_XDBE
if (flags & FL_DOUBLE) {
static XdbeScreenVisualInfo *xdbejunk;
if (!xdbejunk) {
int event_base, error_base;
if (!XdbeQueryExtension(fl_display, &event_base, &error_base)) return 0;
Drawable root = RootWindow(fl_display,fl_screen);
int numscreens = 1;
xdbejunk = XdbeGetVisualInfo(fl_display,&root,&numscreens);
if (!xdbejunk) return 0;
}
for (int j = 0; ; j++) {
if (j >= xdbejunk->count) return 0;
if (xdbejunk->visinfo[j].visual == v.visualid) break;
}
}
#endif
return 1;
}
@ -169,9 +148,7 @@ static int test_visual(XVisualInfo& v, int flags) {
int Fl_X11_Screen_Driver::visual(int flags)
{
#if USE_XDBE == 0
if (flags & FL_DOUBLE) return 0;
#endif
open_display();
// always use default if possible:
if (test_visual(*fl_visual, flags)) return 1;

View File

@ -24,7 +24,7 @@
#define FL_X11_WINDOW_DRIVER_H
#include "../../Fl_Window_Driver.H"
#include <config.h> // for USE_XDBE
#include <config.h>
#include <FL/platform.H> // for Cursor
class Fl_Bitmap;
@ -80,10 +80,6 @@ private:
void flush_double(int erase_overlay);
void sendxjunk();
void activate_window();
#ifdef USE_XDBE
char backbuffer_bad;
void flush_double_dbe(int erase_overlay);
#endif
public:
Fl_X11_Window_Driver(Fl_Window*);

View File

@ -44,74 +44,9 @@ extern unsigned long fl_transparent_pixel;
Window fl_window;
#if USE_XDBE
#include <X11/extensions/Xdbe.h>
// whether the Xdbe extension is usable.
// DO NOT call this if the window is not mapped, because we do not want fluid to open the display.
static int can_xdbe()
{
static int tried = 0;
static int use_xdbe = 0;
if (!tried) {
tried = 1;
int event_base, error_base;
if (!XdbeQueryExtension(fl_display, &event_base, &error_base)) return 0;
Drawable root = RootWindow(fl_display,fl_screen);
int numscreens = 1;
XdbeScreenVisualInfo *a = XdbeGetVisualInfo(fl_display,&root,&numscreens);
if (!a) return 0;
for (int j = 0; j < a->count; j++) {
if (a->visinfo[j].visual == fl_visual->visualid) {
use_xdbe = 1; break;
}
}
XdbeFreeVisualInfo(a);
}
return use_xdbe;
}
void Fl_X11_Window_Driver::flush_double_dbe(int erase_overlay)
{
pWindow->make_current(); // make sure fl_gc is non-zero
Fl_X *i = Fl_X::i(pWindow);
if (!other_xid) {
other_xid = XdbeAllocateBackBufferName(fl_display, fl_xid(pWindow), XdbeCopied);
backbuffer_bad = 1;
pWindow->clear_damage(FL_DAMAGE_ALL);
}
if (backbuffer_bad || erase_overlay) {
// Make sure we do a complete redraw...
if (i->region) {Fl_Graphics_Driver::default_driver().XDestroyRegion(i->region); i->region = 0;}
pWindow->clear_damage(FL_DAMAGE_ALL);
backbuffer_bad = 0;
}
// Redraw as needed...
if (pWindow->damage()) {
fl_clip_region(i->region); i->region = 0;
fl_window = other_xid;
draw();
fl_window = i->xid;
}
// Copy contents of back buffer to window...
XdbeSwapInfo s;
s.swap_window = fl_xid(pWindow);
s.swap_action = XdbeCopied;
XdbeSwapBuffers(fl_display, &s, 1);
}
#endif // USE_XDBE
void Fl_X11_Window_Driver::destroy_double_buffer() {
#if USE_XDBE
if (can_xdbe()) {
XdbeDeallocateBackBufferName(fl_display, other_xid);
}
else
#endif // USE_XDBE
fl_delete_offscreen(other_xid);
fl_delete_offscreen(other_xid);
other_xid = 0;
}
@ -219,10 +154,7 @@ void Fl_X11_Window_Driver::draw_begin()
void Fl_X11_Window_Driver::flush_double()
{
if (!shown()) return;
#if USE_XDBE
if (can_xdbe()) flush_double_dbe(0); else
#endif
flush_double(0);
flush_double(0);
}
void Fl_X11_Window_Driver::flush_double(int erase_overlay)
@ -251,9 +183,6 @@ void Fl_X11_Window_Driver::flush_overlay()
if (!shown()) return;
int erase_overlay = (pWindow->damage()&FL_DAMAGE_OVERLAY) | (overlay() == pWindow);
pWindow->clear_damage((uchar)(pWindow->damage()&~FL_DAMAGE_OVERLAY));
#if USE_XDBE
if (can_xdbe()) flush_double_dbe(erase_overlay); else
#endif
flush_double(erase_overlay);
Fl_Overlay_Window *oWindow = pWindow->as_overlay_window();
if (overlay() == oWindow) oWindow->draw_overlay();

View File

@ -83,8 +83,6 @@ public:
};
int main(int argc, char **argv) {
if (!Fl::visual(FL_DOUBLE))
printf("Xdbe not supported, faking double buffer with pixmaps.\n");
Fl_Window w01(420,420,"Fl_Single_Window"); w01.box(FL_FLAT_BOX);
single_blink_window w1(10,10,400,400,"Fl_Single_Window");
w1.box(FL_FLAT_BOX); w1.color(FL_BLACK); //w1.position(100,200);

View File

@ -77,10 +77,6 @@ typedef struct _OverlayInfo {
#include <X11/extensions/multibuf.h>
#endif
#if HAVE_XDBE
#include <X11/extensions/Xdbe.h>
#endif
static void print_mask(XVisualInfo* p) {
int n = 0;
int what = 0;
@ -144,22 +140,6 @@ void list_visuals() {
}
#endif
#if HAVE_XDBE
int event_base, error_base;
int numdouble = 0;
XdbeVisualInfo *dbe = 0;
if (XdbeQueryExtension(fl_display, &event_base, &error_base)) {
Drawable root = RootWindow(fl_display,fl_screen);
int numscreens = 1;
XdbeScreenVisualInfo *a = XdbeGetVisualInfo(fl_display,&root,&numscreens);
if (!a) printf("error getting double buffer visuals\n");
else {
dbe = a->visinfo;
numdouble = a->count;
}
}
#endif
for (int i=0; i<num; i++) {
XVisualInfo *p = visualList+i;
@ -200,11 +180,6 @@ void list_visuals() {
}
#endif
#if HAVE_XDBE
for (j = 0; j < numdouble; j++) if (dbe[j].visual == p->visualid)
printf(" doublebuf(perflevel %d)",dbe[j].perflevel);
#endif
if (p->visualid==XVisualIDFromVisual(DefaultVisual(fl_display,fl_screen)))
printf(" (default visual)");