summaryrefslogtreecommitdiff
path: root/src/Fl_Double_Window.cxx
diff options
context:
space:
mode:
authorMatthias Melcher <fltk@matthiasm.com>2016-03-07 21:15:25 +0000
committerMatthias Melcher <fltk@matthiasm.com>2016-03-07 21:15:25 +0000
commit12eef8e64d2518c140770529ce6e03f046b33ecf (patch)
tree7c71d0d214f396e1daf3e14424293f3aea93cf59 /src/Fl_Double_Window.cxx
parentb6b99d84e9513405ee381dbf93572914d195fc75 (diff)
Separating Fl_X and Fl_Window_Driver in Fl_Window.
This was needed because Fl_X only exists if a window is mapped, but we need the driver from the very beginning. Adding Fl_X in the ctor would create hidden bugs. Strategy is now to remove system specific stuff from Fl_X and move it one-by-one to Fl_Window_Driver while maintaining a working code base. X11 and WIN32 fixups will follow in 15 minutes. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11308 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/Fl_Double_Window.cxx')
-rw-r--r--src/Fl_Double_Window.cxx31
1 files changed, 17 insertions, 14 deletions
diff --git a/src/Fl_Double_Window.cxx b/src/Fl_Double_Window.cxx
index be9b016cc..b517be2c3 100644
--- a/src/Fl_Double_Window.cxx
+++ b/src/Fl_Double_Window.cxx
@@ -81,9 +81,9 @@ void Fl_Double_Window::flush() {flush(0);}
void Fl_Double_Window::flush(int eraseoverlay) {
if (!shown()) return;
make_current(); // make sure fl_gc is non-zero
- Fl_Window_Driver *myi = (Fl_Window_Driver*)Fl_X::i(this);
+ Fl_X *myi = Fl_X::i(this);
if (!myi) return; // window not yet created
- int retval = myi->double_flush(eraseoverlay);
+ int retval = driver()->double_flush(eraseoverlay);
if (retval) return;
if (eraseoverlay) fl_clip_region(0);
// on Irix (at least) it is faster to reduce the area copied to
@@ -102,13 +102,15 @@ int Fl_Window_Driver::double_flush(int eraseoverlay) {
Fl_Overlay_Window's which fall back on this implementation.
- on Xlib, it is reimplemented if the Xdbe extension is available.
*/
- if (!other_xid) {
- other_xid = fl_create_offscreen(w->w(), w->h());
- w->clear_damage(FL_DAMAGE_ALL);
+ Fl_X *i = Fl_X::i(pWindow);
+
+ if (!i->other_xid) {
+ i->other_xid = fl_create_offscreen(pWindow->w(), pWindow->h());
+ pWindow->clear_damage(FL_DAMAGE_ALL);
}
- if (w->damage() & ~FL_DAMAGE_EXPOSE) {
- fl_clip_region(region); region = 0;
- fl_begin_offscreen(other_xid);
+ if (pWindow->damage() & ~FL_DAMAGE_EXPOSE) {
+ fl_clip_region(i->region); i->region = 0;
+ fl_begin_offscreen(i->other_xid);
fl_graphics_driver->clip_region( 0 );
draw();
fl_end_offscreen();
@@ -120,26 +122,27 @@ void Fl_Double_Window::resize(int X,int Y,int W,int H) {
int ow = w();
int oh = h();
Fl_Window::resize(X,Y,W,H);
- Fl_Window_Driver *myi = (Fl_Window_Driver*)Fl_X::i(this);
+ Fl_X *myi = Fl_X::i(this);
if (myi && myi->other_xid && (ow < w() || oh < h()))
- myi->destroy_double_buffer();
+ driver()->destroy_double_buffer();
}
void Fl_Double_Window::hide() {
- Fl_Window_Driver *myi = (Fl_Window_Driver*)Fl_X::i(this);
+ Fl_X *myi = Fl_X::i(this);
if (myi && myi->other_xid) {
- myi->destroy_double_buffer();
+ driver()->destroy_double_buffer();
}
Fl_Window::hide();
}
void Fl_Window_Driver::destroy_double_buffer() {
+ Fl_X *i = Fl_X::i(pWindow);
/* This is a working, platform-independent implementation.
Some platforms may re-implement it for their own logic:
- on Xlib, it is reimplemented if the Xdbe extension is available.
*/
- fl_delete_offscreen(other_xid);
- other_xid = 0;
+ fl_delete_offscreen(i->other_xid);
+ i->other_xid = 0;
}