[master] eb8b016 - Fix for issue #254: remove hardware overlay 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] eb8b016 - Fix for issue #254: remove hardware overlay support . "ManoloFLTK" 06:17 Nov 26 top right image
 
commit eb8b016fabee89d77009b269c3d6e6b999592881
Author:     ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>
AuthorDate: Fri Nov 26 15:16:15 2021 +0100
Commit:     ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>
CommitDate: Fri Nov 26 15:16:15 2021 +0100

    Fix for issue #254: remove hardware overlay support .

 FL/Fl_Menu_Window.H                                |  11 --
 configh.cmake.in                                   |  13 +--
 configh.in                                         |  13 +--
 configure.ac                                       |  18 ---
 src/Fl_Menu.cxx                                    |   2 -
 src/Fl_Menu_Window.cxx                             |  21 ----
 src/Fl_Window_Driver.H                             |   3 -
 src/Fl_Window_Driver.cxx                           |   2 -
 src/drivers/X11/Fl_X11_Gl_Window_Driver.cxx        | 122 ---------------------
 src/drivers/X11/Fl_X11_Window_Driver.H             |   5 -
 src/drivers/X11/Fl_X11_Window_Driver.cxx           | 122 ---------------------
 src/drivers/Xlib/Fl_Xlib_Graphics_Driver_color.cxx |  37 +------
 12 files changed, 3 insertions(+), 366 deletions(-)

diff --git FL/Fl_Menu_Window.H FL/Fl_Menu_Window.H
index deae888..dbd9cae 100644
--- FL/Fl_Menu_Window.H
+++ FL/Fl_Menu_Window.H
@@ -30,17 +30,6 @@
 */
 class FL_EXPORT Fl_Menu_Window : public Fl_Single_Window {
 public:
-  void show();
-  void erase();
-  void flush();
-  void hide();
-  /** Tells if hardware overlay mode is set */
-  unsigned int overlay() {return !(flags()&NO_OVERLAY);}
-  /** Tells FLTK to use hardware overlay planes if they are available.  */
-  void set_overlay() {clear_flag(NO_OVERLAY);}
-  /** Tells FLTK to use normal drawing planes instead of overlay planes.
-      This is usually necessary if your menu contains multi-color pixmaps. */
-  void clear_overlay() {set_flag(NO_OVERLAY);}
   ~Fl_Menu_Window();
   /** Creates a new Fl_Menu_Window widget using the given size, and label string. */
   Fl_Menu_Window(int W, int H, const char *l = 0);
diff --git configh.cmake.in configh.cmake.in
index db536f9..d208619 100644
--- configh.cmake.in
+++ configh.cmake.in
@@ -171,24 +171,13 @@
 #cmakedefine USE_SDL 1
 
 /*
- * HAVE_OVERLAY:
- *
- * Use the X overlay extension?  FLTK will try to use an overlay
- * visual for Fl_Overlay_Window, the Gl_Window overlay, and for the
- * menus.  Setting this to zero will remove a substantial amount of
- * code from FLTK.  Overlays have only been tested on SGI servers!
- */
-
-#define HAVE_OVERLAY 0
-
-/*
  * HAVE_GL_OVERLAY:
  *
  * It is possible your GL has an overlay even if X does not.  If so,
  * set this to 1.
  */
 
-#define HAVE_GL_OVERLAY HAVE_OVERLAY
+#define HAVE_GL_OVERLAY 0
 
 /*
  * WORDS_BIGENDIAN:
diff --git configh.in configh.in
index a7d6bfa..8d52f34 100644
--- configh.in
+++ configh.in
@@ -171,24 +171,13 @@
 #undef USE_SDL
 
 /*
- * HAVE_OVERLAY:
- *
- * Use the X overlay extension?  FLTK will try to use an overlay
- * visual for Fl_Overlay_Window, the Gl_Window overlay, and for the
- * menus.  Setting this to zero will remove a substantial amount of
- * code from FLTK.  Overlays have only been tested on SGI servers!
- */
-
-#define HAVE_OVERLAY 0
-
-/*
  * HAVE_GL_OVERLAY:
  *
  * It is possible your GL has an overlay even if X does not.  If so,
  * set this to 1.
  */
 
-#define HAVE_GL_OVERLAY HAVE_OVERLAY
+#define HAVE_GL_OVERLAY 0
 
 /*
  * WORDS_BIGENDIAN:
diff --git configure.ac configure.ac
index 2b32918..c448b22 100644
--- configure.ac
+++ configure.ac
@@ -1193,24 +1193,6 @@ AS_CASE([$host_os_gui], [cygwin* | mingw*], [
         AC_DEFINE([HAVE_X11_XREGION_H])
     ], [], [#include <X11/Xlib.h>])
 
-    dnl Check for overlay visuals...
-    AC_PATH_PROG([XPROP], [xprop])
-    AC_CACHE_CHECK([for X overlay visuals], [ac_cv_have_overlay], [
-        AS_IF([test "x$XPROP" != x], [
-            AS_IF([$XPROP -root 2>/dev/null | grep -c "SERVER_OVERLAY_VISUALS" >/dev/null], [
-                ac_cv_have_overlay=yes
-            ], [
-                ac_cv_have_overlay=no
-            ])
-        ], [
-            ac_cv_have_overlay=no
-        ])
-    ])
-
-    AS_IF([test x$ac_cv_have_overlay = xyes], [
-        AC_DEFINE([HAVE_OVERLAY])
-    ])
-
     # Make symlinks since UNIX/Linux is case sensitive,
     # but Cygwin in general not.
     AS_CASE([$host_os], [cygwin*], [
diff --git src/Fl_Menu.cxx src/Fl_Menu.cxx
index 0274501..a9fe732 100644
--- src/Fl_Menu.cxx
+++ src/Fl_Menu.cxx
@@ -283,7 +283,6 @@ menutitle::menutitle(int X, int Y, int W, int H, const Fl_Menu_Item* L) :
   clear_border();
   set_menu_window();
   menu = L;
-  if (L->labelcolor_ || Fl::scheme() || L->labeltype_ > FL_NO_LABEL) clear_overlay();
 }
 
 menuwindow::menuwindow(const Fl_Menu_Item* m, int X, int Y, int Wp, int Hp,
@@ -363,7 +362,6 @@ menuwindow::menuwindow(const Fl_Menu_Item* m, int X, int Y, int Wp, int Hp,
         }
       }
     }
-    if (m->labelcolor_ || Fl::scheme() || m->labeltype_ > FL_NO_LABEL) clear_overlay();
   }
   shortcutWidth = hotKeysw;
   if (selected >= 0 && !Wp) X -= W/2;
diff --git src/Fl_Menu_Window.cxx src/Fl_Menu_Window.cxx
index 559dbe5..3bc916c 100644
--- src/Fl_Menu_Window.cxx
+++ src/Fl_Menu_Window.cxx
@@ -24,27 +24,6 @@
 #include <FL/Fl_Menu_Window.H>
 #include "Fl_Window_Driver.H"
 
-void Fl_Menu_Window::show() {
-  Fl_Window_Driver::driver(this)->show_menu();
-}
-
-void Fl_Menu_Window::flush() {
-  if (!shown()) return;
-  Fl_Window_Driver::driver(this)->flush_menu();
-}
-
-/** Erases the window, does nothing if HAVE_OVERLAY is not defined in config.h */
-void Fl_Menu_Window::erase() {
-  Fl_Window_Driver::driver(this)->erase_menu();
-}
-
-// Fix the colormap flashing on Maximum Impact Graphics by erasing the
-// menu before unmapping it:
-void Fl_Menu_Window::hide() {
-  erase();
-  Fl_Single_Window::hide();
-}
-
 /**  Destroys the window and all of its children.*/
 Fl_Menu_Window::~Fl_Menu_Window() {
   hide();
diff --git src/Fl_Window_Driver.H src/Fl_Window_Driver.H
index aa1a62b..048a428 100644
--- src/Fl_Window_Driver.H
+++ src/Fl_Window_Driver.H
@@ -134,8 +134,6 @@ public:
   virtual void flush(); // the default implementation may be enough
   virtual void flush_double();
   virtual void flush_overlay();
-  virtual void flush_menu();
-  virtual void erase_menu() {}
   /** Usable for platform-specific code executed before the platform-independent part of Fl_Window::draw() */
   virtual void draw_begin();
   /** Usable for platform-specific code executed after the platform-independent part of Fl_Window::draw() */
@@ -148,7 +146,6 @@ public:
   virtual void wait_for_expose();
   virtual void destroy_double_buffer();
   virtual void show();
-  virtual void show_menu();
   virtual void resize(int X,int Y,int W,int H) {}
   virtual void hide() {}
   int hide_common();
diff --git src/Fl_Window_Driver.cxx src/Fl_Window_Driver.cxx
index b9da6e0..d781fce 100644
--- src/Fl_Window_Driver.cxx
+++ src/Fl_Window_Driver.cxx
@@ -72,7 +72,6 @@ unsigned char Fl_Window_Driver::size_range_set() {return pWindow->size_range_set
 
 void Fl_Window_Driver::flush_Fl_Window() { pWindow->Fl_Window::flush(); }
 
-void Fl_Window_Driver::flush_menu() { pWindow->Fl_Window::flush(); }
 
 /**
  Draw the window content.
@@ -92,7 +91,6 @@ void Fl_Window_Driver::make_current() { }
  */
 void Fl_Window_Driver::show() { }
 
-void Fl_Window_Driver::show_menu() { pWindow->Fl_Window::show(); }
 
 /**
  Change the window title.
diff --git src/drivers/X11/Fl_X11_Gl_Window_Driver.cxx src/drivers/X11/Fl_X11_Gl_Window_Driver.cxx
index ac7041f..c70a6dd 100644
--- src/drivers/X11/Fl_X11_Gl_Window_Driver.cxx
+++ src/drivers/X11/Fl_X11_Gl_Window_Driver.cxx
@@ -35,18 +35,11 @@ class Fl_X11_Gl_Window_Driver : public Fl_Gl_Window_Driver {
   virtual void before_show(int& need_after);
   virtual int mode_(int m, const int *a);
   virtual void swap_buffers();
-  virtual void resize(int is_a_resize, int w, int h);
   virtual char swap_type();
   virtual Fl_Gl_Choice *find(int m, const int *alistp);
   virtual GLContext create_gl_context(Fl_Window* window, const Fl_Gl_Choice* g, int layer = 0);
   virtual void set_gl_context(Fl_Window* w, GLContext context);
   virtual void delete_gl_context(GLContext);
-#if HAVE_GL_OVERLAY
-  virtual void make_overlay(void *&o);
-  virtual int can_do_overlay();
-  virtual void hide_overlay();
-  virtual int overlay_color(Fl_Color i);
-#endif
   virtual void make_overlay_current();
   virtual void redraw_overlay();
   virtual void waitGL();
@@ -357,122 +350,13 @@ void Fl_X11_Gl_Window_Driver::delete_gl_context(GLContext context) {
 
 
 void Fl_X11_Gl_Window_Driver::make_overlay_current() {
-#if HAVE_GL_OVERLAY
-  if (overlay() != pWindow) {
-    ((Fl_Gl_Window*)overlay())->make_current();
-  } else
-#endif
     glDrawBuffer(GL_FRONT);
 }
 
 void Fl_X11_Gl_Window_Driver::redraw_overlay() {
-  if (overlay() != pWindow)
-    ((Fl_Gl_Window*)overlay())->redraw();
-  else
     pWindow->damage(FL_DAMAGE_OVERLAY);
 }
 
-#if HAVE_GL_OVERLAY
-
-// Methods on Fl_Gl_Window_Driver that create an overlay window.
-
-// Under X this is done by creating another window, of class _Fl_Gl_Overlay
-// which is a subclass of Fl_Gl_Window except it uses the overlay planes.
-// A pointer to this is stored in the "overlay" pointer of the Fl_Gl_Window.
-
-// If overlay hardware is unavailable, the overlay is
-// "faked" by drawing into the main layers.  This is indicated by
-// setting overlay == this.
-
-extern XVisualInfo *fl_find_overlay_visual();
-extern XVisualInfo *fl_overlay_visual;
-extern Colormap fl_overlay_colormap;
-extern unsigned long fl_transparent_pixel;
-//extern uchar fl_overlay;
-
-int Fl_X11_Gl_Window_Driver::overlay_color(Fl_Color i) {
-  if (Fl_Xlib_Graphics_Driver::fl_overlay) {glIndexi(int(fl_xpixel(i))); return 1;}
-  return 0;
-}
-
-
-class _Fl_Gl_Overlay : public Fl_Gl_Window {
-  void flush();
-  void draw();
-public:
-  void show();
-  _Fl_Gl_Overlay(int x, int y, int w, int h) :
-    Fl_Gl_Window(x,y,w,h) {
-    set_flag(INACTIVE);
-  }
-};
-
-void _Fl_Gl_Overlay::flush() {
-  make_current();
-#ifdef BOXX_BUGS
-  // The BoXX overlay is broken and you must not call swap-buffers. This
-  // code will make it work, but we lose because machines that do support
-  // double-buffered overlays will blink when they don't have to
-  glDrawBuffer(GL_FRONT);
-  draw();
-#else
-  draw();
-  swap_buffers();
-#endif
-  glFlush();
-  valid(1);
-}
-
-void _Fl_Gl_Overlay::draw() {
-  if (!valid()) glClearIndex((GLfloat)fl_transparent_pixel);
-  if (damage() != FL_DAMAGE_EXPOSE) glClear(GL_COLOR_BUFFER_BIT);
-  Fl_Gl_Window *w = (Fl_Gl_Window *)parent();
-  uchar save_valid = w->valid();
-  w->valid(valid());
-  Fl_Xlib_Graphics_Driver::fl_overlay = 1;
-  Fl_Gl_Window_Driver::driver(w)->draw_overlay();
-  Fl_Xlib_Graphics_Driver::fl_overlay = 0;
-  valid(w->valid());
-  w->valid(save_valid);
-}
-
-void _Fl_Gl_Overlay::show() {
-  if (!shown()) {
-    fl_background_pixel = int(fl_transparent_pixel);
-    Fl_X::make_xid(this, fl_overlay_visual, fl_overlay_colormap);
-    fl_background_pixel = -1;
-    // find the outermost window to tell wm about the colormap:
-    Fl_Window *w = window();
-    for (;;) {Fl_Window *w1 = w->window(); if (!w1) break; w = w1;}
-    XSetWMColormapWindows(fl_display, fl_xid(w), &(Fl_X::i(this)->xid), 1);
-    context(Fl_X11_Gl_Window_Driver::create_gl_context(fl_overlay_visual), 1);
-    valid(0);
-  }
-  Fl_Gl_Window::show();
-}
-
-void Fl_X11_Gl_Window_Driver::hide_overlay() {
-  if (overlay() && overlay() != pWindow) ((Fl_Gl_Window*)overlay())->hide();
-}
-
-int Fl_X11_Gl_Window_Driver::can_do_overlay() {
-  return fl_find_overlay_visual() != 0;
-}
-
-
-void Fl_X11_Gl_Window_Driver::make_overlay(void *&current) {
-  if (current) return;
-  if (can_do_overlay()) {
-    _Fl_Gl_Overlay* o = new _Fl_Gl_Overlay(0, 0, pWindow->w(), pWindow->h());
-    current = o;
-    pWindow->add(*o);
-    o->show();
-  } else {
-    current = pWindow; // fake the overlay
-  }
-}
-#endif // HAVE_GL_OVERLAY
-
 
 Fl_Gl_Window_Driver *Fl_Gl_Window_Driver::newGlWindowDriver(Fl_Gl_Window *w)
 {
@@ -482,7 +366,6 @@ Fl_Gl_Window_Driver *Fl_Gl_Window_Driver::newGlWindowDriver(Fl_Gl_Window *w)
 void Fl_X11_Gl_Window_Driver::before_show(int&) {
   Fl_X11_Gl_Choice *g = (Fl_X11_Gl_Choice*)this->g();
   Fl_X::make_xid(pWindow, g->vis, g->colormap);
-  if (overlay() && overlay() != pWindow) ((Fl_Gl_Window*)overlay())->show();
 }
 
 float Fl_X11_Gl_Window_Driver::pixels_per_unit()
@@ -523,11 +406,6 @@ void Fl_X11_Gl_Window_Driver::swap_buffers() {
   glXSwapBuffers(fl_display, fl_xid(pWindow));
 }
 
-void Fl_X11_Gl_Window_Driver::resize(int is_a_resize, int W, int H) {
-  if (is_a_resize && !pWindow->resizable() && overlay() && overlay() != pWindow) {
-    ((Fl_Gl_Window*)overlay())->resize(0,0,W,H);
-  }
-}
 
 char Fl_X11_Gl_Window_Driver::swap_type() {return copy;}
 
diff --git src/drivers/X11/Fl_X11_Window_Driver.H src/drivers/X11/Fl_X11_Window_Driver.H
index 08e7514..71370d1 100644
--- src/drivers/X11/Fl_X11_Window_Driver.H
+++ src/drivers/X11/Fl_X11_Window_Driver.H
@@ -100,12 +100,9 @@ public:
   virtual void take_focus();
   virtual void flush_double();
   virtual void flush_overlay();
-  virtual void flush_menu();
-  virtual void erase_menu();
   virtual void draw_begin();
   virtual void make_current();
   virtual void show();
-  virtual void show_menu();
   virtual void resize(int X,int Y,int W,int H);
   virtual void label(const char *name, const char *mininame);
   virtual void destroy_double_buffer();
@@ -131,8 +128,6 @@ public:
   virtual void free_icons();
   void set_icons(); // driver-internal support function
   virtual void capture_titlebar_and_borders(Fl_RGB_Image*& top, Fl_RGB_Image*& left, Fl_RGB_Image*& bottom, Fl_RGB_Image*& right);
-  virtual int can_do_overlay();
-  virtual void redraw_overlay();
   virtual int scroll(int src_x, int src_y, int src_w, int src_h, int dest_x, int dest_y, void (*draw_area)(void*, int,int,int,int), void* data);
 };
 
diff --git src/drivers/X11/Fl_X11_Window_Driver.cxx src/drivers/X11/Fl_X11_Window_Driver.cxx
index b0db151..fc583bd 100644
--- src/drivers/X11/Fl_X11_Window_Driver.cxx
+++ src/drivers/X11/Fl_X11_Window_Driver.cxx
@@ -35,13 +35,6 @@
 #define ShapeBounding                   0
 #define ShapeSet                        0
 
-#if HAVE_OVERLAY
-extern XVisualInfo *fl_find_overlay_visual();
-extern XVisualInfo *fl_overlay_visual;
-extern Colormap fl_overlay_colormap;
-extern unsigned long fl_transparent_pixel;
-#endif
-
 Window fl_window;
 
 
@@ -392,20 +385,6 @@ void Fl_X11_Window_Driver::make_current() {
 }
 
 
-void Fl_X11_Window_Driver::show_menu()
-{
-#if HAVE_OVERLAY
-  if (!shown() && ((Fl_Menu_Window*)pWindow)->overlay() && fl_find_overlay_visual()) {
-    XInstallColormap(fl_display, fl_overlay_colormap);
-    fl_background_pixel = int(fl_transparent_pixel);
-    Fl_X::make_xid(pWindow, fl_overlay_visual, fl_overlay_colormap);
-    fl_background_pixel = -1;
-  } else
-#endif
-    pWindow->Fl_Window::show();
-}
-
-
 void Fl_X11_Window_Driver::hide() {
   Fl_X* ip = Fl_X::i(pWindow);
   if (hide_common()) return;
@@ -499,107 +478,6 @@ void Fl_X11_Window_Driver::show_with_args_end(int argc, char **argv) {
   }
 }
 
-
-#if HAVE_OVERLAY
-
-class _Fl_Overlay : public Fl_Window {
-  friend class Fl_Overlay_Window;
-  void flush();
-  void show();
-public:
-  _Fl_Overlay(int x, int y, int w, int h) : Fl_Window(x,y,w,h) {
-    set_flag(INACTIVE);
-  }
-};
-
-/*int Fl_Overlay_Window::can_do_overlay() {
- return fl_find_overlay_visual() != 0;
- }*/
-
-void _Fl_Overlay::show() {
-  if (shown()) {Fl_Window::show(); return;}
-  fl_background_pixel = int(fl_transparent_pixel);
-  Fl_X::make_xid(this, fl_overlay_visual, fl_overlay_colormap);
-  fl_background_pixel = -1;
-  // find the outermost window to tell wm about the colormap:
-  Fl_Window *w = window();
-  for (;;) {Fl_Window *w1 = w->window(); if (!w1) break; w = w1;}
-  XSetWMColormapWindows(fl_display, fl_xid(w), &(Fl_X::i(this)->xid), 1);
-}
-
-void _Fl_Overlay::flush() {
-  fl_window = fl_xid(this);
-#if defined(FLTK_USE_CAIRO)
-  if (Fl::cairo_autolink_context()) Fl::cairo_make_current(this); // capture gc changes automatically to update the cairo context adequately
-#endif
-  Fl_Xlib_Graphics_Driver::fl_overlay = 1;
-  Fl_Overlay_Window *w = (Fl_Overlay_Window *)parent();
-  Fl_X *myi = Fl_X::i(this);
-  if (damage() != FL_DAMAGE_EXPOSE) XClearWindow(fl_display, fl_xid(this));
-  fl_clip_region(myi->region); myi->region = 0;
-  w->draw_overlay();
-  Fl_Xlib_Graphics_Driver::fl_overlay = 0;
-}
-#endif // HAVE_OVERLAY
-
-
-int Fl_X11_Window_Driver::can_do_overlay() {
-#if HAVE_OVERLAY
-  return fl_find_overlay_visual() != 0;
-#endif
-  return Fl_Window_Driver::can_do_overlay();
-}
-
-void Fl_X11_Window_Driver::redraw_overlay() {
-#if HAVE_OVERLAY
-  if (!fl_display) return; // this prevents fluid -c from opening display
-  if (!overlay()) {
-    if (can_do_overlay()) {
-      Fl_Group::current(pWindow);
-      overlay(new _Fl_Overlay(0,0,w(),h()));
-      Fl_Group::current(0);
-    } else {
-      overlay(pWindow); // fake the overlay
-    }
-  }
-  if (shown()) {
-    if (overlay() == pWindow) {
-      pWindow->clear_damage(pWindow->damage()|FL_DAMAGE_OVERLAY);
-      Fl::damage(FL_DAMAGE_CHILD);
-    } else if (!overlay()->shown())
-      overlay()->show();
-    else
-      overlay()->redraw();
-  }
-  return;
-#endif
-  Fl_Window_Driver::redraw_overlay();
-}
-
-void Fl_X11_Window_Driver::flush_menu() {
-#if HAVE_OVERLAY
-   if (!fl_overlay_visual || !overlay()) {flush_Fl_Window(); return;}
-   Fl_X *myi = Fl_X::i(pWindow);
-   fl_window = myi->xid;
-# if defined(FLTK_USE_CAIRO)
-   // capture gc changes automatically to update the cairo context adequately
-   if(Fl::autolink_context()) Fl::cairo_make_current(fl_graphics_driver->gc());
-# endif
-  Fl_Xlib_Graphics_Driver::fl_overlay = 1;
-   fl_clip_region(myi->region); myi->region = 0; current(pWindow);
-   draw();
-  Fl_Xlib_Graphics_Driver::fl_overlay = 0;
-#else
-   flush_Fl_Window();
-#endif
-}
-
-void Fl_X11_Window_Driver::erase_menu() {
-#if HAVE_OVERLAY
-  if (pWindow->shown())  XClearWindow(fl_display, fl_xid(pWindow));
-#endif
-}
-
 int Fl_X11_Window_Driver::scroll(int src_x, int src_y, int src_w, int src_h, int dest_x, int dest_y,
                                  void (*draw_area)(void*, int,int,int,int), void* data)
 {
diff --git src/drivers/Xlib/Fl_Xlib_Graphics_Driver_color.cxx src/drivers/Xlib/Fl_Xlib_Graphics_Driver_color.cxx
index 9106817..b6297da 100644
--- src/drivers/Xlib/Fl_Xlib_Graphics_Driver_color.cxx
+++ src/drivers/Xlib/Fl_Xlib_Graphics_Driver_color.cxx
@@ -93,16 +93,7 @@ static void figure_out_visual() {
 
 }
 
-#  if HAVE_OVERLAY
-/** HAVE_OVERLAY determines whether fl_xmap is one or two planes */
-Fl_XColor fl_xmap[2][256];
-Colormap fl_overlay_colormap;
-XVisualInfo* fl_overlay_visual;
-ulong fl_transparent_pixel;
-#  else
-/** HAVE_OVERLAY determines whether fl_xmap is one or two planes */
 Fl_XColor fl_xmap[1][256];
-#  endif
 
 void Fl_Xlib_Graphics_Driver::color(Fl_Color i) {
   if (i & 0xffffff00) {
@@ -204,9 +195,6 @@ ulong fl_xpixel(Fl_Color i) {
 
 #  if USE_COLORMAP
   Colormap colormap = fl_colormap;
-#    if HAVE_OVERLAY
-  if (Fl_Xlib_Graphics_Driver::fl_overlay) colormap = fl_overlay_colormap; else
-#    endif
   if (fl_redmask) {
 #  endif
     // return color for a truecolor visual:
@@ -221,15 +209,8 @@ ulong fl_xpixel(Fl_Color i) {
        ) >> fl_extrashift;
 #  if USE_COLORMAP
   }
-#    if HAVE_OVERLAY
-  static XColor* ac[2];
-  XColor*& allcolors = ac[Fl_Xlib_Graphics_Driver::fl_overlay];
-  static int nc[2];
-  int& numcolors = nc[Fl_Xlib_Graphics_Driver::fl_overlay];
-#    else
   static XColor *allcolors;
   static int numcolors;
-#    endif
 
   // I don't try to allocate colors with XAllocColor once it fails
   // with any color.  It is possible that it will work, since a color
@@ -249,10 +230,7 @@ ulong fl_xpixel(Fl_Color i) {
     // I only read the colormap once.  Again this is due to the slowness
     // of round-trips to the X server, even though other programs may alter
     // the colormap after this and make decisions here wrong.
-#    if HAVE_OVERLAY
-    if (Fl_Xlib_Graphics_Driver::fl_overlay) numcolors = fl_overlay_visual->colormap_size; else
-#    endif
-      numcolors = fl_visual->colormap_size;
+    numcolors = fl_visual->colormap_size;
     if (!allcolors) allcolors = new XColor[numcolors];
     for (int p = numcolors; p--;) allcolors[p].pixel = p;
     XQueryColors(fl_display, colormap, allcolors, numcolors);
@@ -262,9 +240,6 @@ ulong fl_xpixel(Fl_Color i) {
   int mindist = 0x7FFFFFFF;
   unsigned int bestmatch = 0;
   for (unsigned int n = numcolors; n--;) {
-#    if HAVE_OVERLAY
-    if (Fl_Xlib_Graphics_Driver::fl_overlay && n == fl_transparent_pixel) continue;
-#    endif
     XColor &a = allcolors[n];
     int d, t;
     t = int(r)-int(a.red>>8); d = t*t;
@@ -303,17 +278,10 @@ ulong fl_xpixel(Fl_Color i) {
   \param[in] overlay 0 for normal, 1 for overlay color
 */
 void Fl_Xlib_Graphics_Driver::free_color(Fl_Color i, int overlay) {
-#  if HAVE_OVERLAY
-#  else
   if (overlay) return;
-#  endif
   if (fl_xmap[overlay][i].mapped) {
 #  if USE_COLORMAP
-#    if HAVE_OVERLAY
-    Colormap colormap = overlay ? fl_overlay_colormap : fl_colormap;
-#    else
     Colormap colormap = fl_colormap;
-#    endif
     if (fl_xmap[overlay][i].mapped == 1)
       XFreeColors(fl_display, colormap, &(fl_xmap[overlay][i].pixel), 1, 0);
 #  endif
@@ -329,9 +297,6 @@ void Fl_Xlib_Graphics_Driver::free_color(Fl_Color i, int overlay) {
 void Fl_Xlib_Graphics_Driver::set_color(Fl_Color i, unsigned c) {
   if (fl_cmap[i] != c) {
     free_color(i,0);
-#  if HAVE_OVERLAY
-    free_color(i,1);
-#  endif
     fl_cmap[i] = c;
   }
 }
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'.