FLTK logo

[fltk.coredev] Fix issue #253: Remove xdbe support (X11)

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.coredev  ]
 
Previous Message ]New Message | Reply ]Next Message ]

Fix issue #253: Remove xdbe support (X11) Manolo Nov 25, 2021  
 
I propose the series of modifications given in the attached patch
to fix for 1.4 issue #253: remove Xdbe support.
This would remove one milestone item for Release 1.4

Any opposition?

--
You received this message because you are subscribed to the Google Groups "fltk.coredev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fltkcoredev+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fltkcoredev/50991404-b3b4-41e5-992e-4c6a911ac39en%40googlegroups.com.
diff --git a/CMake/options.cmake b/CMake/options.cmake
index e9e7a1db0..ccb253522 100644
--- a/CMake/options.cmake
+++ b/CMake/options.cmake
@@ -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)
diff --git a/CMake/resources.cmake b/CMake/resources.cmake
index 7ea839d1f..23d84a787 100644
--- a/CMake/resources.cmake
+++ b/CMake/resources.cmake
@@ -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)
 
 #----------------------------------------------------------------------
diff --git a/FL/Fl_Double_Window.H b/FL/Fl_Double_Window.H
index 7ba197f8b..b3396c431 100644
--- a/FL/Fl_Double_Window.H
+++ b/FL/Fl_Double_Window.H
@@ -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
 {
diff --git a/README.CMake.txt b/README.CMake.txt
index 40dfc5b74..9eeda3e16 100644
--- a/README.CMake.txt
+++ b/README.CMake.txt
@@ -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
diff --git a/configh.cmake.in b/configh.cmake.in
index 61bcfdb64..db536f98c 100644
--- a/configh.cmake.in
+++ b/configh.cmake.in
@@ -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:
  *
diff --git a/configh.in b/configh.in
index 8dc34486b..a7d6bfa13 100644
--- a/configh.in
+++ b/configh.in
@@ -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:
  *
diff --git a/configure.ac b/configure.ac
index 68ca0a5ab..2b32918e4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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"
     ])
diff --git a/src/Fl_visual.cxx b/src/Fl_visual.cxx
index da088cb17..8058e0b10 100644
--- a/src/Fl_visual.cxx
+++ b/src/Fl_visual.cxx
@@ -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
diff --git a/src/Fl_x.cxx b/src/Fl_x.cxx
index 4d30cc2e3..a57316207 100644
--- a/src/Fl_x.cxx
+++ b/src/Fl_x.cxx
@@ -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;
diff --git a/src/drivers/X11/Fl_X11_Screen_Driver.cxx b/src/drivers/X11/Fl_X11_Screen_Driver.cxx
index 4fd36edb6..ed8c54dfa 100644
--- a/src/drivers/X11/Fl_X11_Screen_Driver.cxx
+++ b/src/drivers/X11/Fl_X11_Screen_Driver.cxx
@@ -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;
diff --git a/src/drivers/X11/Fl_X11_Window_Driver.H b/src/drivers/X11/Fl_X11_Window_Driver.H
index 098808c72..08e7514bd 100644
--- a/src/drivers/X11/Fl_X11_Window_Driver.H
+++ b/src/drivers/X11/Fl_X11_Window_Driver.H
@@ -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*);
diff --git a/src/drivers/X11/Fl_X11_Window_Driver.cxx b/src/drivers/X11/Fl_X11_Window_Driver.cxx
index 5dea0fb29..b0db15194 100644
--- a/src/drivers/X11/Fl_X11_Window_Driver.cxx
+++ b/src/drivers/X11/Fl_X11_Window_Driver.cxx
@@ -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();
diff --git a/test/doublebuffer.cxx b/test/doublebuffer.cxx
index 805a6e4b6..98ffbd880 100644
--- a/test/doublebuffer.cxx
+++ b/test/doublebuffer.cxx
@@ -84,7 +84,7 @@ public:
 
 int main(int argc, char **argv) {
   if (!Fl::visual(FL_DOUBLE))
-    printf("Xdbe not supported, faking double buffer with pixmaps.\n");
+    printf("Xdbe not used, handling 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);
diff --git a/test/list_visuals.cxx b/test/list_visuals.cxx
index 8d66c3012..77dce30d3 100644
--- a/test/list_visuals.cxx
+++ b/test/list_visuals.cxx
@@ -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)");
 
Direct Link to Message ]
 
     
Previous Message ]New Message | Reply ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.