From c0f14ca2f00b1ea026298b0efa91c8b6afb13244 Mon Sep 17 00:00:00 2001 From: Manolo Gouy Date: Mon, 18 Apr 2016 17:02:44 +0000 Subject: [PATCH] Move other_xid member variable from class Fl_X to class F_Window_Driver. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11654 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- FL/Fl_Window_Driver.H | 1 + FL/mac.H | 1 - FL/win32.H | 1 - FL/x.H | 1 - src/Fl_Double_Window.cxx | 4 ++-- src/Fl_Window_Driver.cxx | 5 ++--- src/Fl_cocoa.mm | 2 +- src/Fl_win32.cxx | 2 +- src/Fl_x.cxx | 2 +- src/drivers/Cocoa/Fl_Cocoa_Window_Driver.cxx | 10 +++++----- .../Fl_PicoAndroid_Window_Driver.cxx | 2 +- .../PicoSDL/Fl_PicoSDL_Window_Driver.cxx | 2 +- .../WinAPI/Fl_WinAPI_Window_Driver.cxx | 16 ++++++++-------- src/drivers/X11/Fl_X11_Window_Driver.cxx | 19 +++++++++---------- 14 files changed, 32 insertions(+), 36 deletions(-) diff --git a/FL/Fl_Window_Driver.H b/FL/Fl_Window_Driver.H index 61f5abc8f..67fc2dfb3 100644 --- a/FL/Fl_Window_Driver.H +++ b/FL/Fl_Window_Driver.H @@ -53,6 +53,7 @@ public: virtual ~Fl_Window_Driver(); static Fl_Window_Driver *newWindowDriver(Fl_Window *); int wait_for_expose_value; + Fl_Offscreen other_xid; // offscreen bitmap (overlay and double-buffered windows) // --- frequently used accessors to public window data /** returns the x coordinate of the window. */ diff --git a/FL/mac.H b/FL/mac.H index b1a40ee11..95a20f767 100644 --- a/FL/mac.H +++ b/FL/mac.H @@ -124,7 +124,6 @@ extern NSCursor *fl_default_cursor; class Fl_X { public: Window xid; // pointer to the Cocoa window object (FLWindow*) - Fl_Offscreen other_xid; // pointer for offscreen bitmaps (overlay window) Fl_Window *w; // FLTK window for Fl_Region region; Fl_X *next; // chain of mapped windows diff --git a/FL/win32.H b/FL/win32.H index 4b28dd245..0e31dc3ab 100644 --- a/FL/win32.H +++ b/FL/win32.H @@ -50,7 +50,6 @@ class FL_EXPORT Fl_X { public: // member variables - add new variables only at the end of this block Window xid; - HBITMAP other_xid; // for double-buffered windows Fl_Window* w; Fl_Region region; Fl_X *next; diff --git a/FL/x.H b/FL/x.H index b90964108..5bf928afe 100644 --- a/FL/x.H +++ b/FL/x.H @@ -113,7 +113,6 @@ extern FL_EXPORT Fl_XFont_On_Demand fl_xfont; class FL_EXPORT Fl_X { public: Window xid; - Window other_xid; Fl_Window *w; Fl_Region region; Fl_X *next; diff --git a/src/Fl_Double_Window.cxx b/src/Fl_Double_Window.cxx index 00aca01ee..825c78720 100644 --- a/src/Fl_Double_Window.cxx +++ b/src/Fl_Double_Window.cxx @@ -56,14 +56,14 @@ void Fl_Double_Window::resize(int X,int Y,int W,int H) { int oh = h(); Fl_Window::resize(X,Y,W,H); Fl_X *myi = Fl_X::i(this); - if (myi && myi->other_xid && (ow < w() || oh < h())) + if (myi && driver()->other_xid && (ow < w() || oh < h())) driver()->destroy_double_buffer(); } void Fl_Double_Window::hide() { Fl_X *myi = Fl_X::i(this); - if (myi && myi->other_xid) { + if (myi && driver()->other_xid) { driver()->destroy_double_buffer(); } Fl_Window::hide(); diff --git a/src/Fl_Window_Driver.cxx b/src/Fl_Window_Driver.cxx index 13a90f8f0..0399f7fff 100644 --- a/src/Fl_Window_Driver.cxx +++ b/src/Fl_Window_Driver.cxx @@ -104,9 +104,8 @@ void Fl_Window_Driver::draw_end() void Fl_Window_Driver::destroy_double_buffer() { - Fl_X *i = Fl_X::i(pWindow); - fl_delete_offscreen(i->other_xid); - i->other_xid = 0; + fl_delete_offscreen(other_xid); + other_xid = 0; } diff --git a/src/Fl_cocoa.mm b/src/Fl_cocoa.mm index c345c9f85..51d1efaaa 100644 --- a/src/Fl_cocoa.mm +++ b/src/Fl_cocoa.mm @@ -2944,7 +2944,7 @@ void Fl_X::make(Fl_Window* w) } Fl_X *x = new Fl_X; - x->other_xid = 0; // room for doublebuffering image map. On OS X this is only used by overlay windows + w->driver()->other_xid = 0; // room for doublebuffering image map. On OS X this is only used by overlay windows x->region = 0; x->subRect(0); ((Fl_Cocoa_Window_Driver*)w->pWindowDriver)->gc = 0; diff --git a/src/Fl_win32.cxx b/src/Fl_win32.cxx index fd79cc437..535656d69 100644 --- a/src/Fl_win32.cxx +++ b/src/Fl_win32.cxx @@ -1796,7 +1796,7 @@ Fl_X* Fl_X::make(Fl_Window* w) { } Fl_X *x = new Fl_X; - x->other_xid = 0; + w->driver()->other_xid = 0; x->w = w; w->i = x; x->region = 0; x->private_dc = 0; diff --git a/src/Fl_x.cxx b/src/Fl_x.cxx index 334e44158..b8c5a2cc2 100644 --- a/src/Fl_x.cxx +++ b/src/Fl_x.cxx @@ -2216,7 +2216,7 @@ void fl_fix_focus(); // in Fl.cxx Fl_X* Fl_X::set_xid(Fl_Window* win, Window winxid) { Fl_X *xp = new Fl_X; xp->xid = winxid; - xp->other_xid = 0; + win->driver()->other_xid = 0; xp->w = win; win->i = xp; xp->next = Fl_X::first; xp->region = 0; diff --git a/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.cxx b/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.cxx index 47fb70242..68389bae9 100644 --- a/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.cxx +++ b/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.cxx @@ -73,14 +73,14 @@ void Fl_Cocoa_Window_Driver::flush_overlay() pWindow->make_current(); // make sure fl_gc is non-zero Fl_X *myi = Fl_X::i(pWindow); if (!myi) return; // window not yet created - if (!myi->other_xid) { - myi->other_xid = fl_create_offscreen(oWindow->w(), oWindow->h()); + if (!other_xid) { + other_xid = fl_create_offscreen(oWindow->w(), oWindow->h()); oWindow->clear_damage(FL_DAMAGE_ALL); } if (oWindow->damage() & ~FL_DAMAGE_EXPOSE) { fl_clip_region(myi->region); myi->region = 0; - if ( myi->other_xid ) { - fl_begin_offscreen( myi->other_xid ); + if ( other_xid ) { + fl_begin_offscreen( other_xid ); fl_clip_region( 0 ); draw(); fl_end_offscreen(); @@ -92,7 +92,7 @@ void Fl_Cocoa_Window_Driver::flush_overlay() // on Irix (at least) it is faster to reduce the area copied to // the current clip region: int X,Y,W,H; fl_clip_box(0,0,oWindow->w(),oWindow->h(),X,Y,W,H); - if (myi->other_xid) fl_copy_offscreen(X, Y, W, H, myi->other_xid, X, Y); + if (other_xid) fl_copy_offscreen(X, Y, W, H, other_xid, X, Y); if (overlay() == oWindow) oWindow->draw_overlay(); } diff --git a/src/drivers/PicoAndroid/Fl_PicoAndroid_Window_Driver.cxx b/src/drivers/PicoAndroid/Fl_PicoAndroid_Window_Driver.cxx index ef0501ad5..7da770170 100644 --- a/src/drivers/PicoAndroid/Fl_PicoAndroid_Window_Driver.cxx +++ b/src/drivers/PicoAndroid/Fl_PicoAndroid_Window_Driver.cxx @@ -69,7 +69,7 @@ Fl_X *Fl_PicoAndroid_Window_Driver::makeWindow() parent = 0; } Fl_X *x = new Fl_X; - x->other_xid = 0; + other_xid = 0; x->w = pWindow; x->region = 0; if (!pWindow->force_position()) { diff --git a/src/drivers/PicoSDL/Fl_PicoSDL_Window_Driver.cxx b/src/drivers/PicoSDL/Fl_PicoSDL_Window_Driver.cxx index bba11e520..96c52a459 100644 --- a/src/drivers/PicoSDL/Fl_PicoSDL_Window_Driver.cxx +++ b/src/drivers/PicoSDL/Fl_PicoSDL_Window_Driver.cxx @@ -67,7 +67,7 @@ Fl_X *Fl_PicoSDL_Window_Driver::makeWindow() parent = 0; } Fl_X *x = new Fl_X; - x->other_xid = 0; + other_xid = 0; x->w = pWindow; x->region = 0; if (!pWindow->force_position()) { diff --git a/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx b/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx index 366a4c6ef..b72a6d7a4 100644 --- a/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx +++ b/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx @@ -268,20 +268,20 @@ void Fl_WinAPI_Window_Driver::flush_double() Fl_X *i = Fl_X::i(pWindow); if (!i) return; // window not yet created - if (!i->other_xid) { - i->other_xid = fl_create_offscreen(w(), h()); + if (!other_xid) { + other_xid = fl_create_offscreen(w(), h()); pWindow->clear_damage(FL_DAMAGE_ALL); } if (pWindow->damage() & ~FL_DAMAGE_EXPOSE) { fl_clip_region(i->region); i->region = 0; - fl_begin_offscreen(i->other_xid); + fl_begin_offscreen(other_xid); fl_graphics_driver->clip_region( 0 ); draw(); fl_end_offscreen(); } int X,Y,W,H; fl_clip_box(0,0,w(),h(),X,Y,W,H); - if (i->other_xid) fl_copy_offscreen(X, Y, W, H, i->other_xid, X, Y); + if (other_xid) fl_copy_offscreen(X, Y, W, H, other_xid, X, Y); } @@ -297,13 +297,13 @@ void Fl_WinAPI_Window_Driver::flush_overlay() int eraseoverlay = (pWindow->damage()&FL_DAMAGE_OVERLAY); pWindow->clear_damage((uchar)(pWindow->damage()&~FL_DAMAGE_OVERLAY)); - if (!i->other_xid) { - i->other_xid = fl_create_offscreen(w(), h()); + if (!other_xid) { + other_xid = fl_create_offscreen(w(), h()); pWindow->clear_damage(FL_DAMAGE_ALL); } if (pWindow->damage() & ~FL_DAMAGE_EXPOSE) { fl_clip_region(i->region); i->region = 0; - fl_begin_offscreen(i->other_xid); + fl_begin_offscreen(other_xid); fl_graphics_driver->clip_region(0); draw(); fl_end_offscreen(); @@ -311,7 +311,7 @@ void Fl_WinAPI_Window_Driver::flush_overlay() if (eraseoverlay) fl_clip_region(0); int X, Y, W, H; fl_clip_box(0, 0, w(), h(), X, Y, W, H); - if (i->other_xid) fl_copy_offscreen(X, Y, W, H, i->other_xid, X, Y); + if (other_xid) fl_copy_offscreen(X, Y, W, H, other_xid, X, Y); if (overlay() == oWindow) oWindow->draw_overlay(); } diff --git a/src/drivers/X11/Fl_X11_Window_Driver.cxx b/src/drivers/X11/Fl_X11_Window_Driver.cxx index b468cd60d..bb952b7bd 100644 --- a/src/drivers/X11/Fl_X11_Window_Driver.cxx +++ b/src/drivers/X11/Fl_X11_Window_Driver.cxx @@ -80,8 +80,8 @@ void Fl_X11_Window_Driver::flush_double_dbe(int erase_overlay) { pWindow->make_current(); // make sure fl_gc is non-zero Fl_X *i = Fl_X::i(pWindow); - if (!i->other_xid) { - i->other_xid = XdbeAllocateBackBufferName(fl_display, fl_xid(pWindow), XdbeCopied); + if (!other_xid) { + other_xid = XdbeAllocateBackBufferName(fl_display, fl_xid(pWindow), XdbeCopied); backbuffer_bad = 1; pWindow->clear_damage(FL_DAMAGE_ALL); } @@ -94,7 +94,7 @@ void Fl_X11_Window_Driver::flush_double_dbe(int erase_overlay) // Redraw as needed... if (pWindow->damage()) { fl_clip_region(i->region); i->region = 0; - fl_window = i->other_xid; + fl_window = other_xid; draw(); fl_window = i->xid; } @@ -111,9 +111,8 @@ void Fl_X11_Window_Driver::flush_double_dbe(int erase_overlay) void Fl_X11_Window_Driver::destroy_double_buffer() { #if USE_XDBE if (can_xdbe()) { - Fl_X *i = Fl_X::i(pWindow); - XdbeDeallocateBackBufferName(fl_display, i->other_xid); - i->other_xid = 0; + XdbeDeallocateBackBufferName(fl_display, other_xid); + other_xid = 0; } else #endif // USE_XDBE @@ -218,19 +217,19 @@ void Fl_X11_Window_Driver::flush_double(int erase_overlay) { pWindow->make_current(); // make sure fl_gc is non-zero Fl_X *i = Fl_X::i(pWindow); - if (!i->other_xid) { - i->other_xid = fl_create_offscreen(w(), h()); + if (!other_xid) { + other_xid = fl_create_offscreen(w(), h()); pWindow->clear_damage(FL_DAMAGE_ALL); } if (pWindow->damage() & ~FL_DAMAGE_EXPOSE) { fl_clip_region(i->region); i->region = 0; - fl_window = i->other_xid; + fl_window = other_xid; draw(); fl_window = i->xid; } if (erase_overlay) fl_clip_region(0); int X,Y,W,H; fl_clip_box(0,0,w(),h(),X,Y,W,H); - if (i->other_xid) fl_copy_offscreen(X, Y, W, H, i->other_xid, X, Y); + if (other_xid) fl_copy_offscreen(X, Y, W, H, other_xid, X, Y); }