[master] 84cf249 - Fix for issue #253: Remove xdbe support

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.commit  ]
 
Previous Message ]Next Message ]

[master] 84cf249 - Fix for issue #253: Remove xdbe support "ManoloFLTK" 06:17 Nov 26 top right image
 
commit 84cf24948245d893cde9b3ef8c9eee614191de80
Author:     ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>
AuthorDate: Fri Nov 26 15:01:36 2021 +0100
Commit:     ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>
CommitDate: Fri Nov 26 15:01:54 2021 +0100

    Fix for issue #253: Remove xdbe support

 CMake/options.cmake                      | 12 -----
 CMake/resources.cmake                    |  3 +-
 FL/Fl_Double_Window.H                    | 10 +----
 README.CMake.txt                         |  1 -
 configh.cmake.in                         | 16 -------
 configh.in                               | 16 -------
 configure.ac                             | 17 --------
 src/Fl_visual.cxx                        |  7 ---
 src/Fl_x.cxx                             |  3 --
 src/drivers/X11/Fl_X11_Screen_Driver.cxx | 23 ----------
 src/drivers/X11/Fl_X11_Window_Driver.H   |  6 +--
 src/drivers/X11/Fl_X11_Window_Driver.cxx | 75 +-------------------------------
 test/doublebuffer.cxx                    |  2 -
 test/list_visuals.cxx                    | 25 -----------
 14 files changed, 5 insertions(+), 211 deletions(-)

diff --git CMake/options.cmake CMake/options.cmake
index e9e7a1d..ccb2535 100644
--- CMake/options.cmake
+++ CMake/options.cmake
@@ -596,18 +596,6 @@ else(OPTION_USE_XRENDER)
 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)
   set (FL_NO_PRINT_SUPPORT TRUE)
diff --git CMake/resources.cmake CMake/resources.cmake
index 7ea839d..23d84a7 100644
--- CMake/resources.cmake
+++ 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 FL/Fl_Double_Window.H FL/Fl_Double_Window.H
index 7ba197f..b3396c4 100644
--- FL/Fl_Double_Window.H
+++ 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 README.CMake.txt README.CMake.txt
index 40dfc5b..9eeda3e 100644
--- README.CMake.txt
+++ 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 configh.cmake.in configh.cmake.in
index 61bcfdb..db536f9 100644
--- configh.cmake.in
+++ configh.cmake.in
@@ -110,22 +110,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:
  *
  * Do we have the X fixes extension?
diff --git configh.in configh.in
index 8dc3448..a7d6bfa 100644
--- configh.in
+++ configh.in
@@ -109,22 +109,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:
  *
  * Do we have the X fixes extension?
diff --git configure.ac configure.ac
index 68ca0a5..2b32918 100644
--- configure.ac
+++ 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 src/Fl_visual.cxx src/Fl_visual.cxx
index da088cb..8058e0b 100644
--- src/Fl_visual.cxx
+++ 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 src/Fl_x.cxx src/Fl_x.cxx
index 4d30cc2..a573162 100644
--- src/Fl_x.cxx
+++ 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 src/drivers/X11/Fl_X11_Screen_Driver.cxx src/drivers/X11/Fl_X11_Screen_Driver.cxx
index 4fd36ed..ed8c54d 100644
--- src/drivers/X11/Fl_X11_Screen_Driver.cxx
+++ 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>
@@ -146,32 +142,13 @@ static int test_visual(XVisualInfo& v, int flags) {
   // 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;
 }
 
 
 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 src/drivers/X11/Fl_X11_Window_Driver.H src/drivers/X11/Fl_X11_Window_Driver.H
index 098808c..08e7514 100644
--- src/drivers/X11/Fl_X11_Window_Driver.H
+++ 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 src/drivers/X11/Fl_X11_Window_Driver.cxx src/drivers/X11/Fl_X11_Window_Driver.cxx
index 5dea0fb..b0db151 100644
--- src/drivers/X11/Fl_X11_Window_Driver.cxx
+++ 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 test/doublebuffer.cxx test/doublebuffer.cxx
index 805a6e4..aa5d1d4 100644
--- test/doublebuffer.cxx
+++ test/doublebuffer.cxx
@@ -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);
diff --git test/list_visuals.cxx test/list_visuals.cxx
index 8d66c30..77dce30 100644
--- test/list_visuals.cxx
+++ 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 ]
 
bottom left image   bottom right image
Previous Message ]Next Message ]
 
 

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