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
This commit is contained in:
Manolo Gouy 2016-04-18 17:02:44 +00:00
parent e790ac9653
commit c0f14ca2f0
14 changed files with 32 additions and 36 deletions

View File

@ -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. */

View File

@ -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

View File

@ -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;

1
FL/x.H
View File

@ -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;

View File

@ -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();

View File

@ -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;
}

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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();
}

View File

@ -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()) {

View File

@ -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()) {

View File

@ -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();
}

View File

@ -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);
}