diff options
| author | Manolo Gouy <Manolo> | 2016-03-27 07:47:52 +0000 |
|---|---|---|
| committer | Manolo Gouy <Manolo> | 2016-03-27 07:47:52 +0000 |
| commit | 2fd4dde9f5d682898b7fc387bb364fff2febf8fb (patch) | |
| tree | 1d3ccbc3c7bea37356c6c54df8784d68c1f618a5 | |
| parent | 5f14fc3e9b81d082966665209c4246cbdfee0005 (diff) | |
Rewrite Fl_Menu_Window class under the driver model.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11441 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
| -rw-r--r-- | FL/Fl_Window_Driver.H | 19 | ||||
| -rw-r--r-- | src/Fl_Menu_Window.cxx | 37 | ||||
| -rw-r--r-- | src/Fl_Window_Driver.cxx | 4 | ||||
| -rw-r--r-- | src/drivers/X11/Fl_X11_Window_Driver.H | 2 | ||||
| -rw-r--r-- | src/drivers/X11/Fl_X11_Window_Driver.cxx | 24 |
5 files changed, 44 insertions, 42 deletions
diff --git a/FL/Fl_Window_Driver.H b/FL/Fl_Window_Driver.H index 02c4679b2..0bcc5eca1 100644 --- a/FL/Fl_Window_Driver.H +++ b/FL/Fl_Window_Driver.H @@ -72,14 +72,6 @@ public: int shown() const { return pWindow->shown(); } /** returns the parent of the window. */ Fl_Group *parent() const { return pWindow->parent(); } - /** for an Fl_Overlay_Window, returns the value of its overlay_ member variable */ - Fl_Window *overlay() { - return pWindow->as_overlay_window() ? pWindow->as_overlay_window()->overlay_ : NULL; - } - /** for an Fl_Overlay_Window, sets the value of its overlay_ member variable */ - void overlay(Fl_Window *o) { - if (pWindow->as_overlay_window()) pWindow->as_overlay_window()->overlay_ = o; - } // --- accessors to private window data int minw(); @@ -94,6 +86,15 @@ public: void force_position(int c); void x(int X); void y(int Y); + void current(Fl_Window *c); + /** for an Fl_Overlay_Window, returns the value of its overlay_ member variable */ + Fl_Window *overlay() { + return pWindow->as_overlay_window() ? pWindow->as_overlay_window()->overlay_ : NULL; + } + /** for an Fl_Overlay_Window, sets the value of its overlay_ member variable */ + void overlay(Fl_Window *o) { + if (pWindow->as_overlay_window()) pWindow->as_overlay_window()->overlay_ = o; + } // --- window data virtual int decorated_w() = 0; @@ -104,6 +105,8 @@ public: virtual void flush_double(); virtual void flush_overlay(); virtual void flush_single(); + virtual void flush_menu(); + virtual void erase_menu() {} virtual void draw_begin(); virtual void draw_end(); void draw(); diff --git a/src/Fl_Menu_Window.cxx b/src/Fl_Menu_Window.cxx index 44098817b..fd0ec6ed0 100644 --- a/src/Fl_Menu_Window.cxx +++ b/src/Fl_Menu_Window.cxx @@ -23,52 +23,21 @@ // which are used so that clicks outside the program's windows // can be used to dismiss the menus. -#include <config.h> -#include <FL/Fl.H> -#include <FL/fl_draw.H> #include <FL/Fl_Menu_Window.H> #include <FL/Fl_Window_Driver.H> -// WIN32 note: HAVE_OVERLAY is false -#if HAVE_OVERLAY -#include <FL/x.H> -extern XVisualInfo *fl_overlay_visual; -extern uchar fl_overlay; // changes how fl_color(x) works -#endif - -#include <stdio.h> - void Fl_Menu_Window::show() { driver()->show_menu(); } void Fl_Menu_Window::flush() { if (!shown()) return; -#if HAVE_OVERLAY - if (!fl_overlay_visual || !overlay()) {Fl_Single_Window::flush(); return;} - Fl_X *myi = Fl_X::i(this); - 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_overlay = 1; - fl_clip_region(myi->region); myi->region = 0; current_ = this; - draw(); - fl_overlay = 0; -#else - Fl_Single_Window::flush(); -#endif + driver()->flush_menu(); } -/** Erases the window, does nothing if HAVE_OVERLAY is not defined config.h */ +/** Erases the window, does nothing if HAVE_OVERLAY is not defined in config.h */ void Fl_Menu_Window::erase() { -#if HAVE_OVERLAY - if (!shown()) return; -//XSetForeground(fl_display, gc, 0); -//XFillRectangle(fl_display, fl_xid(this), gc, 0, 0, w(), h()); - XClearWindow(fl_display, fl_xid(this)); -#endif + driver()->erase_menu(); } // Fix the colormap flashing on Maximum Impact Graphics by erasing the diff --git a/src/Fl_Window_Driver.cxx b/src/Fl_Window_Driver.cxx index 7cb42cbba..acb00712c 100644 --- a/src/Fl_Window_Driver.cxx +++ b/src/Fl_Window_Driver.cxx @@ -49,12 +49,16 @@ int Fl_Window_Driver::fullscreen_screen_top() {return pWindow->fullscreen_screen int Fl_Window_Driver::fullscreen_screen_bottom() {return pWindow->fullscreen_screen_bottom;} int Fl_Window_Driver::fullscreen_screen_left() {return pWindow->fullscreen_screen_left;} int Fl_Window_Driver::fullscreen_screen_right() {return pWindow->fullscreen_screen_right;} +void Fl_Window_Driver::current(Fl_Window *c) {pWindow->current_ = c;} + unsigned char Fl_Window_Driver::size_range_set() {return pWindow->size_range_set;} void Fl_Window_Driver::flush_single() { pWindow->Fl_Window::flush(); } +void Fl_Window_Driver::flush_menu() { pWindow->Fl_Window::flush(); } + void Fl_Window_Driver::draw() { pWindow->draw(); } void Fl_Window_Driver::make_current() { } diff --git a/src/drivers/X11/Fl_X11_Window_Driver.H b/src/drivers/X11/Fl_X11_Window_Driver.H index ea6e3d649..2c4c432aa 100644 --- a/src/drivers/X11/Fl_X11_Window_Driver.H +++ b/src/drivers/X11/Fl_X11_Window_Driver.H @@ -84,6 +84,8 @@ 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(); diff --git a/src/drivers/X11/Fl_X11_Window_Driver.cxx b/src/drivers/X11/Fl_X11_Window_Driver.cxx index 861aaf972..43cff28e9 100644 --- a/src/drivers/X11/Fl_X11_Window_Driver.cxx +++ b/src/drivers/X11/Fl_X11_Window_Driver.cxx @@ -633,6 +633,30 @@ void Fl_X11_Window_Driver::redraw_overlay() { Fl_Window_Driver::redraw_overlay(); } +void Fl_X11_Window_Driver::flush_menu() { +#if HAVE_OVERLAY + if (!fl_overlay_visual || !overlay()) {flush_single(); 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_overlay = 1; + fl_clip_region(myi->region); myi->region = 0; current(pWindow); + draw(); + fl_overlay = 0; +#else + flush_single(); +#endif +} + +void Fl_X11_Window_Driver::erase_menu() { +#if HAVE_OVERLAY + if (pWindow->shown()) XClearWindow(fl_display, fl_xid(pWindow)); +#endif +} + // // End of "$Id$". // |
