MacOS Mojave: restore support of gl_start()/gl_finish().

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@13107 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Manolo Gouy
2018-11-01 21:01:41 +00:00
parent fa89042fac
commit 04e782d946
3 changed files with 18 additions and 4 deletions
+1
View File
@@ -197,6 +197,7 @@ public:
static void GLcontext_release(NSOpenGLContext*);
static void GLcontext_makecurrent(NSOpenGLContext*);
static void GL_cleardrawable(void);
static void gl_start(NSOpenGLContext*);
void destroy(void);
void map(void);
void unmap(void);
+16 -3
View File
@@ -2425,9 +2425,11 @@ static CGContextRef prepare_bitmap_for_layer(int w, int h ) {
Fl_X::q_release_context();
through_drawRect = NO;
window->clear_damage();
CGImageRef cgimg = CGBitmapContextCreateImage(layer_gc); // requires 10.4
layer.contents = (id)cgimg;
CGImageRelease(cgimg);
if (layer_gc) {
CGImageRef cgimg = CGBitmapContextCreateImage(layer_gc); // requires 10.4
layer.contents = (id)cgimg;
CGImageRelease(cgimg);
}
}
}
-(void)viewFrameDidChange
@@ -4808,6 +4810,17 @@ void Fl_Paged_Device::print_window(Fl_Window *win, int x_offset, int y_offset)
this->print_widget(win, x_offset, y_offset + bt); // print the window inner part
}
void Fl_X::gl_start(NSOpenGLContext *ctxt) {
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_8
if (views_use_CA) {
Fl_X::q_release_context();
[(FLView*)[fl_window contentView] viewFrameDidChange];
[(FLView*)[fl_window contentView] layer].contentsScale = 1.;
}
#endif
[ctxt update]; // supports window resizing
}
/* Returns the address of a Carbon function after dynamically loading the Carbon library if needed.
Supports old Mac OS X versions that may use a couple of Carbon calls:
+1 -1
View File
@@ -68,7 +68,7 @@ void gl_start() {
}
fl_set_gl_context(Fl_Window::current(), context);
#ifdef __APPLE__
Fl_X::GLcontext_update(context); // supports window resizing
Fl_X::gl_start(context);
#elif !defined(WIN32)
glXWaitX();
#endif