From e042966ae7a13b8bf6e26a09025ba47c026559a8 Mon Sep 17 00:00:00 2001 From: Manolo Gouy Date: Thu, 10 Jan 2013 08:57:19 +0000 Subject: About the fix for a problem apparent with the "cube" test program: if the cube window is moved around rapidly, the GL pixels leak away from where they should be. This problem no longer occurs with Mac OS 10.7 and above. The fix is thus made effective only when OS < 10.7. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@9790 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- src/Fl_cocoa.mm | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/Fl_cocoa.mm b/src/Fl_cocoa.mm index acf03ca6b..4d0732106 100644 --- a/src/Fl_cocoa.mm +++ b/src/Fl_cocoa.mm @@ -629,8 +629,13 @@ void Fl::remove_timeout(Fl_Timeout_Handler cb, void* data) contentRect:(NSRect)rect styleMask:(NSUInteger)windowStyle; - (Fl_Window *)getFl_Window; +/* These two functions allow to check if a window contains OpenGL-subwindows. + This is useful only for Mac OS < 10.7 to repair a problem apparent with the "cube" test program: + if the cube window is moved around rapidly (with OS < 10.7), the GL pixels leak away from where they should be. + The repair is performed by [FLWindowDelegate windowDidMove:], only if OS < 10.7. + */ - (BOOL)containsGLsubwindow; -- (void)setContainsGLsubwindow:(BOOL)contains; +- (void)containsGLsubwindow:(BOOL)contains; @end @implementation FLWindow @@ -653,7 +658,7 @@ void Fl::remove_timeout(Fl_Timeout_Handler cb, void* data) { return containsGLsubwindow; } -- (void)setContainsGLsubwindow:(BOOL)contains +- (void)containsGLsubwindow:(BOOL)contains { containsGLsubwindow = contains; } @@ -1030,8 +1035,8 @@ void fl_open_callback(void (*cb)(const char *)) { update_e_xy_and_e_xy_root(nsw); resize_from_system = window; window->position((int)pt2.x, (int)(main_screen_height - pt2.y)); - if ([nsw containsGLsubwindow] ) { - [nsw display];// redraw window after moving if it contains OpenGL subwindows + if ([nsw containsGLsubwindow] && fl_mac_os_version < 100700) { + [nsw display];// with OS < 10.7, redraw window after moving if it contains OpenGL subwindows } fl_unlock_function(); } @@ -2123,7 +2128,7 @@ void Fl_X::make(Fl_Window* w) } if (w->as_gl_window()) { // if creating a sub-GL-window while (win->window()) win = win->window(); - [Fl_X::i(win)->xid setContainsGLsubwindow:YES]; + [Fl_X::i(win)->xid containsGLsubwindow:YES]; } fl_show_iconic = 0; } -- cgit v1.2.3