Skip to content

Commit

Permalink
Move other_xid member variable from class Fl_X to class F_Window_Driver.
Browse files Browse the repository at this point in the history
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11654 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
  • Loading branch information
Manolo Gouy authored and Manolo Gouy committed Apr 18, 2016
1 parent e790ac9 commit c0f14ca
Show file tree
Hide file tree
Showing 14 changed files with 32 additions and 36 deletions.
1 change: 1 addition & 0 deletions FL/Fl_Window_Driver.H
Expand Up @@ -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. */
Expand Down
1 change: 0 additions & 1 deletion FL/mac.H
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion FL/win32.H
Expand Up @@ -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;
Expand Down
1 change: 0 additions & 1 deletion FL/x.H
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/Fl_Double_Window.cxx
Expand Up @@ -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();
Expand Down
5 changes: 2 additions & 3 deletions src/Fl_Window_Driver.cxx
Expand Up @@ -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;
}


Expand Down
2 changes: 1 addition & 1 deletion src/Fl_cocoa.mm
Expand Up @@ -2944,7 +2944,7 @@ - (NSInteger)windowLevel {
}

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;
Expand Down
2 changes: 1 addition & 1 deletion src/Fl_win32.cxx
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/Fl_x.cxx
Expand Up @@ -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;
Expand Down
10 changes: 5 additions & 5 deletions src/drivers/Cocoa/Fl_Cocoa_Window_Driver.cxx
Expand Up @@ -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();
Expand All @@ -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();
}
Expand Down
2 changes: 1 addition & 1 deletion src/drivers/PicoAndroid/Fl_PicoAndroid_Window_Driver.cxx
Expand Up @@ -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()) {
Expand Down
2 changes: 1 addition & 1 deletion src/drivers/PicoSDL/Fl_PicoSDL_Window_Driver.cxx
Expand Up @@ -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()) {
Expand Down
16 changes: 8 additions & 8 deletions src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx
Expand Up @@ -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);
}


Expand All @@ -297,21 +297,21 @@ 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();
}

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();
}
Expand Down
19 changes: 9 additions & 10 deletions src/drivers/X11/Fl_X11_Window_Driver.cxx
Expand Up @@ -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);
}
Expand 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;
}
Expand All @@ -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
Expand Down Expand Up @@ -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);
}


Expand Down

0 comments on commit c0f14ca

Please sign in to comment.