Advancing Albrecht's plan for the Fl_Window_Driver class.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11387 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
parent
c2067d81be
commit
51030530f2
@ -60,7 +60,6 @@ public:
|
||||
|
||||
// --- window management
|
||||
virtual void take_focus();
|
||||
virtual void flush_single();
|
||||
virtual void flush_double();
|
||||
virtual void flush_overlay();
|
||||
virtual void draw_begin();
|
||||
|
@ -437,7 +437,10 @@ int Fl_Window::decorated_h()
|
||||
|
||||
void Fl_Window::flush()
|
||||
{
|
||||
driver()->flush_single();
|
||||
if (!shown()) return;
|
||||
make_current();
|
||||
fl_clip_region(i->region); i->region = 0;
|
||||
draw();
|
||||
}
|
||||
|
||||
|
||||
|
@ -18,11 +18,8 @@
|
||||
//
|
||||
|
||||
|
||||
#include <config.h>
|
||||
#include "config_lib.h"
|
||||
#include <FL/Fl_Window_Driver.H>
|
||||
#include <FL/Fl.H>
|
||||
#include <FL/Fl_Overlay_Window.H>
|
||||
#include <FL/fl_draw.H>
|
||||
|
||||
|
||||
@ -44,25 +41,13 @@ void Fl_Window_Driver::take_focus()
|
||||
}
|
||||
|
||||
|
||||
void Fl_Window_Driver::flush_single()
|
||||
{
|
||||
Fl_X *i = Fl_X::i(pWindow);
|
||||
if (!i) return;
|
||||
fl_clip_region(i->region);
|
||||
i->region = 0;
|
||||
pWindow->draw();
|
||||
}
|
||||
|
||||
|
||||
void Fl_Window_Driver::flush_double()
|
||||
{
|
||||
flush_single();
|
||||
}
|
||||
|
||||
|
||||
void Fl_Window_Driver::flush_overlay()
|
||||
{
|
||||
flush_single();
|
||||
}
|
||||
|
||||
|
||||
@ -81,10 +66,6 @@ void Fl_Window_Driver::draw_end()
|
||||
|
||||
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(i->other_xid);
|
||||
i->other_xid = 0;
|
||||
}
|
||||
|
@ -69,7 +69,6 @@ public:
|
||||
|
||||
// --- window management
|
||||
virtual void take_focus();
|
||||
virtual void flush_single();
|
||||
virtual void flush_double();
|
||||
virtual void flush_overlay();
|
||||
virtual void draw_begin();
|
||||
|
@ -55,61 +55,42 @@ void Fl_Cocoa_Window_Driver::take_focus()
|
||||
}
|
||||
|
||||
|
||||
void Fl_Cocoa_Window_Driver::flush_single()
|
||||
{
|
||||
if (!pWindow->shown()) return;
|
||||
pWindow->make_current();
|
||||
Fl_X *i = Fl_X::i(pWindow);
|
||||
if (!i) return; // window not yet created
|
||||
fl_clip_region(i->region); i->region = 0;
|
||||
pWindow->draw();
|
||||
}
|
||||
|
||||
|
||||
void Fl_Cocoa_Window_Driver::flush_double()
|
||||
{
|
||||
if (!pWindow->shown()) return;
|
||||
pWindow->make_current();
|
||||
Fl_X *i = Fl_X::i(pWindow);
|
||||
if (!i) return; // window not yet created
|
||||
fl_clip_region(i->region); i->region = 0;
|
||||
pWindow->draw();
|
||||
void Fl_Cocoa_Window_Driver::flush_double() {
|
||||
pWindow->Fl_Window::flush();
|
||||
}
|
||||
|
||||
|
||||
void Fl_Cocoa_Window_Driver::flush_overlay()
|
||||
{
|
||||
Fl_Overlay_Window *oWindow = pWindow->as_overlay_window();
|
||||
if (!oWindow) return flush_single();
|
||||
|
||||
if (!pWindow->shown()) return;
|
||||
pWindow->make_current(); // make sure fl_gc is non-zero
|
||||
Fl_X *i = Fl_X::i(pWindow);
|
||||
if (!i) return; // window not yet created
|
||||
|
||||
int erase_overlay = (pWindow->damage()&FL_DAMAGE_OVERLAY);
|
||||
int erase_overlay = (pWindow->damage()&FL_DAMAGE_OVERLAY) | (oWindow->overlay_ == oWindow);
|
||||
pWindow->clear_damage((uchar)(pWindow->damage()&~FL_DAMAGE_OVERLAY));
|
||||
|
||||
if (!i->other_xid) {
|
||||
i->other_xid = fl_create_offscreen(pWindow->w(), pWindow->h());
|
||||
pWindow->clear_damage(FL_DAMAGE_ALL);
|
||||
if (!oWindow->shown()) return;
|
||||
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());
|
||||
oWindow->clear_damage(FL_DAMAGE_ALL);
|
||||
}
|
||||
if (pWindow->damage() & ~FL_DAMAGE_EXPOSE) {
|
||||
fl_clip_region(i->region); i->region = 0;
|
||||
if ( i->other_xid ) {
|
||||
fl_begin_offscreen( i->other_xid );
|
||||
fl_clip_region( 0 );
|
||||
pWindow->draw();
|
||||
fl_end_offscreen();
|
||||
} else {
|
||||
pWindow->draw();
|
||||
if (oWindow->damage() & ~FL_DAMAGE_EXPOSE) {
|
||||
fl_clip_region(myi->region); myi->region = 0;
|
||||
if ( myi->other_xid ) {
|
||||
fl_begin_offscreen( myi->other_xid );
|
||||
fl_clip_region( 0 );
|
||||
oWindow->draw();
|
||||
fl_end_offscreen();
|
||||
} else {
|
||||
oWindow->draw();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (erase_overlay) fl_clip_region(0);
|
||||
// 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);
|
||||
|
||||
int X,Y,W,H; fl_clip_box(0,0,pWindow->w(),pWindow->h(),X,Y,W,H);
|
||||
if (i->other_xid) fl_copy_offscreen(X, Y, W, H, i->other_xid, X, Y);
|
||||
|
||||
if (oWindow->overlay_ == oWindow) oWindow->draw_overlay();
|
||||
}
|
||||
|
||||
|
@ -73,7 +73,6 @@ public:
|
||||
virtual int decorated_h();
|
||||
|
||||
// --- window management
|
||||
virtual void flush_single();
|
||||
virtual void flush_double();
|
||||
virtual void flush_overlay();
|
||||
virtual void draw_begin();
|
||||
|
@ -255,18 +255,6 @@ void Fl_WinAPI_Window_Driver::draw_begin()
|
||||
}
|
||||
|
||||
|
||||
void Fl_WinAPI_Window_Driver::flush_single()
|
||||
{
|
||||
if (!pWindow->shown()) return;
|
||||
pWindow->make_current(); // make sure fl_gc is non-zero
|
||||
Fl_X *i = Fl_X::i(pWindow);
|
||||
if (!i) return;
|
||||
fl_clip_region(i->region);
|
||||
i->region = 0;
|
||||
pWindow->draw();
|
||||
}
|
||||
|
||||
|
||||
void Fl_WinAPI_Window_Driver::flush_double()
|
||||
{
|
||||
if (!pWindow->shown()) return;
|
||||
@ -294,7 +282,6 @@ void Fl_WinAPI_Window_Driver::flush_double()
|
||||
void Fl_WinAPI_Window_Driver::flush_overlay()
|
||||
{
|
||||
Fl_Overlay_Window *oWindow = pWindow->as_overlay_window();
|
||||
if (!oWindow) return flush_single();
|
||||
|
||||
if (!pWindow->shown()) return;
|
||||
pWindow->make_current(); // make sure fl_gc is non-zero
|
||||
|
@ -77,7 +77,6 @@ public:
|
||||
|
||||
// --- window management
|
||||
virtual void take_focus();
|
||||
virtual void flush_single();
|
||||
virtual void flush_double();
|
||||
virtual void flush_overlay();
|
||||
virtual void draw_begin();
|
||||
@ -89,6 +88,7 @@ public:
|
||||
virtual void free_icons();
|
||||
virtual void capture_titlebar_and_borders(Fl_Shared_Image*& top, Fl_Shared_Image*& left, Fl_Shared_Image*& bottom, Fl_Shared_Image*& right);
|
||||
virtual void wait_for_expose();
|
||||
virtual void destroy_double_buffer();
|
||||
};
|
||||
|
||||
|
||||
|
@ -148,18 +148,6 @@ void Fl_X11_Window_Driver::draw_begin()
|
||||
}
|
||||
|
||||
|
||||
void Fl_X11_Window_Driver::flush_single()
|
||||
{
|
||||
if (!pWindow->shown()) return;
|
||||
pWindow->make_current(); // make sure fl_gc is non-zero
|
||||
Fl_X *i = Fl_X::i(pWindow);
|
||||
if (!i) return;
|
||||
fl_clip_region(i->region);
|
||||
i->region = 0;
|
||||
pWindow->draw();
|
||||
}
|
||||
|
||||
|
||||
void Fl_X11_Window_Driver::flush_double()
|
||||
{
|
||||
if (!pWindow->shown()) return;
|
||||
@ -215,7 +203,6 @@ void Fl_X11_Window_Driver::flush_double()
|
||||
void Fl_X11_Window_Driver::flush_overlay()
|
||||
{
|
||||
Fl_Overlay_Window *oWindow = pWindow->as_overlay_window();
|
||||
if (!oWindow) return flush_single();
|
||||
|
||||
if (!pWindow->shown()) return;
|
||||
pWindow->make_current(); // make sure fl_gc is non-zero
|
||||
@ -289,15 +276,16 @@ void Fl_X11_Window_Driver::flush_overlay()
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Fl_X11_Window_Driver::destroy_double_buffer() {
|
||||
#if USE_XDBE
|
||||
|
||||
//void Fl_X11_Dbe_Window_Driver::destroy_double_buffer() {
|
||||
// Fl_X *i = Fl_X::i(pWindow);
|
||||
// XdbeDeallocateBackBufferName(fl_display, i->other_xid);
|
||||
// i->other_xid = 0;
|
||||
//}
|
||||
if (can_xdbe()) {
|
||||
Fl_X *i = Fl_X::i(pWindow);
|
||||
XdbeDeallocateBackBufferName(fl_display, i->other_xid);
|
||||
i->other_xid = 0;
|
||||
} else
|
||||
#endif // USE_XDBE
|
||||
Fl_Window_Driver::destroy_double_buffer();
|
||||
}
|
||||
|
||||
|
||||
void Fl_X11_Window_Driver::shape_bitmap_(Fl_Image* b) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user