summaryrefslogtreecommitdiff
path: root/src/Fl_Device.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'src/Fl_Device.cxx')
-rw-r--r--src/Fl_Device.cxx4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/Fl_Device.cxx b/src/Fl_Device.cxx
index 430aa2bf5..9f0b6292c 100644
--- a/src/Fl_Device.cxx
+++ b/src/Fl_Device.cxx
@@ -48,14 +48,17 @@ TODO:
*/
+Fl_Surface_Device *Fl_Surface_Device::pre_surface_ = NULL;
/** \brief Make this surface the current drawing surface.
This surface will receive all future graphics requests. */
void Fl_Surface_Device::set_current(void)
{
+ if (pre_surface_) pre_surface_->end_current_();
fl_graphics_driver = pGraphicsDriver;
_surface = this;
pGraphicsDriver->global_gc();
+ pre_surface_ = this;
}
Fl_Surface_Device* Fl_Surface_Device::_surface; // the current target surface of graphics operations
@@ -63,6 +66,7 @@ Fl_Surface_Device* Fl_Surface_Device::_surface; // the current target surface of
Fl_Surface_Device::~Fl_Surface_Device()
{
+ if (pre_surface_ == this) pre_surface_ = NULL;
}