summaryrefslogtreecommitdiff
path: root/src/Fl_Double_Window.cxx
diff options
context:
space:
mode:
authorMatthias Melcher <fltk@matthiasm.com>2001-12-06 00:17:47 +0000
committerMatthias Melcher <fltk@matthiasm.com>2001-12-06 00:17:47 +0000
commite07200c4e847ddff8a46ea9fdc23e17437d74c15 (patch)
treed894e182e410b76b62fdeefbb4122ab4ac8665b6 /src/Fl_Double_Window.cxx
parent39109694e1873fce011df470f2edd57a0028e0a3 (diff)
Implemeted 95% of all Mac OS X support. Makefiles still need modifications.
Almost all test applications run out of the box (->Makefile). See more information in README.mac . Changes: - message handling - access to opaque port structures - image, bitmap, pixmap support - most OpenGL stuff - window styles git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@1812 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/Fl_Double_Window.cxx')
-rw-r--r--src/Fl_Double_Window.cxx25
1 files changed, 18 insertions, 7 deletions
diff --git a/src/Fl_Double_Window.cxx b/src/Fl_Double_Window.cxx
index 8145dfdf1..9bf615e2d 100644
--- a/src/Fl_Double_Window.cxx
+++ b/src/Fl_Double_Window.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_Double_Window.cxx,v 1.12.2.4.2.2 2001/12/04 03:03:17 matthiaswm Exp $"
+// "$Id: Fl_Double_Window.cxx,v 1.12.2.4.2.3 2001/12/06 00:17:47 matthiaswm Exp $"
//
// Double-buffered window code for the Fast Light Tool Kit (FLTK).
//
@@ -103,7 +103,7 @@ GWorldPtr fl_create_offscreen(int w, int h) {
GWorldPtr gw;
Rect bounds;
bounds.left=0; bounds.right=w; bounds.top=0; bounds.bottom=h;
- QDErr err = NewGWorld(&gw, 0, &bounds, 0L, 0L, useTempMem);
+ QDErr err = NewGWorld(&gw, 0, &bounds, 0L, 0L, 0); // 'useTempMem' should not be used (says the Carbon port manual)
if ( err == -108 )
{ }
// fl_message( "The application memory is low. Please increase the initial memory assignment.\n" );
@@ -116,6 +116,7 @@ GWorldPtr fl_create_offscreen(int w, int h) {
*/
void fl_copy_offscreen(int x,int y,int w,int h,GWorldPtr gWorld,int srcx,int srcy) {
Rect src;
+ if ( !gWorld ) return;
src.top = srcy; src.left = srcx; src.bottom = srcy+h; src.right = srcx+w;
Rect dst;
GrafPtr dstPort; GetPort(&dstPort);
@@ -145,11 +146,10 @@ void fl_begin_offscreen(GWorldPtr gWorld) {
GetGWorld( &prevPort, &prevGD );
if ( gWorld )
{
- SetGWorld( gWorld, 0L );
+ SetGWorld( gWorld, 0L ); // sets the correct port
PixMapHandle pm = GetGWorldPixMap(gWorld);
LockPixels(pm);
- fl_window = (Window)prevPort;
- SetPort( GetWindowPort(fl_window) );
+ fl_window = GetWindowFromPort( gWorld );
}
fl_push_no_clip();
}
@@ -164,8 +164,8 @@ void fl_end_offscreen() {
fl_pop_clip();
PixMapHandle pm = GetGWorldPixMap(currPort);
UnlockPixels(pm);
- fl_window = (Window)prevPort;
SetGWorld( prevPort, prevGD );
+ fl_window = GetWindowFromPort( prevPort );
}
extern void fl_restore_clip();
@@ -187,7 +187,14 @@ void Fl_Double_Window::flush(int eraseoverlay) {
XdbeAllocateBackBufferName(fl_display, fl_xid(this), XdbeUndefined);
else
#endif
+#ifdef __APPLE__
+ // the Apple OS X window manager double buffers ALL windows anyway, so there is no need to waste memory and time
+ // BTW: Windows2000 and later also forces doublebuffering if transparent windows are beeing used (alpha channel)
+ if ( !QDIsPortBuffered( GetWindowPort(myi->xid) ) )
myi->other_xid = fl_create_offscreen(w(), h());
+#else
+ myi->other_xid = fl_create_offscreen(w(), h());
+#endif
clear_damage(FL_DAMAGE_ALL);
}
#if USE_XDBE
@@ -242,7 +249,11 @@ void Fl_Double_Window::flush(int eraseoverlay) {
// 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,w(),h(),X,Y,W,H);
+#ifdef __APPLE__
+ if (myi->other_xid) fl_copy_offscreen(X, Y, W, H, myi->other_xid, X, Y);
+#else
fl_copy_offscreen(X, Y, W, H, myi->other_xid, X, Y);
+#endif
}
void Fl_Double_Window::resize(int X,int Y,int W,int H) {
@@ -275,5 +286,5 @@ Fl_Double_Window::~Fl_Double_Window() {
}
//
-// End of "$Id: Fl_Double_Window.cxx,v 1.12.2.4.2.2 2001/12/04 03:03:17 matthiaswm Exp $".
+// End of "$Id: Fl_Double_Window.cxx,v 1.12.2.4.2.3 2001/12/06 00:17:47 matthiaswm Exp $".
//