diff options
Diffstat (limited to 'src/drivers/X11')
| -rw-r--r-- | src/drivers/X11/Fl_X11_Gl_Window_Driver.cxx | 122 | ||||
| -rw-r--r-- | src/drivers/X11/Fl_X11_Window_Driver.H | 5 | ||||
| -rw-r--r-- | src/drivers/X11/Fl_X11_Window_Driver.cxx | 122 |
3 files changed, 0 insertions, 249 deletions
diff --git a/src/drivers/X11/Fl_X11_Gl_Window_Driver.cxx b/src/drivers/X11/Fl_X11_Gl_Window_Driver.cxx index ac7041f19..c70a6dda0 100644 --- a/src/drivers/X11/Fl_X11_Gl_Window_Driver.cxx +++ b/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 *¤t) { - 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 a/src/drivers/X11/Fl_X11_Window_Driver.H b/src/drivers/X11/Fl_X11_Window_Driver.H index 08e7514bd..71370d13a 100644 --- a/src/drivers/X11/Fl_X11_Window_Driver.H +++ b/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 a/src/drivers/X11/Fl_X11_Window_Driver.cxx b/src/drivers/X11/Fl_X11_Window_Driver.cxx index b0db15194..fc583bd83 100644 --- a/src/drivers/X11/Fl_X11_Window_Driver.cxx +++ b/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) { |
