mirror of
https://github.com/fltk/fltk.git
synced 2026-05-25 09:09:48 +08:00
Avoid dependence of Fl_cocoa.mm from libfltk_gl
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@13102 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
@@ -550,6 +550,15 @@ int Fl_Gl_Window::gl_plugin_linkage() {
|
||||
return fl_gl_load_plugin;
|
||||
}
|
||||
|
||||
#ifdef __APPLE__
|
||||
extern "C" {
|
||||
void *fl_mac_gl_window_context(Fl_Gl_Window *);
|
||||
}
|
||||
void *fl_mac_gl_window_context(Fl_Gl_Window *glwin) {
|
||||
return glwin->context();
|
||||
}
|
||||
#endif
|
||||
|
||||
//
|
||||
// End of "$Id$".
|
||||
//
|
||||
|
||||
+6
-2
@@ -40,7 +40,6 @@ extern "C" {
|
||||
#include <FL/Fl.H>
|
||||
#include <FL/x.H>
|
||||
#include <FL/Fl_Window.H>
|
||||
#include <FL/Fl_Gl_Window.H>
|
||||
#include <FL/Fl_Tooltip.H>
|
||||
#include <FL/Fl_Printer.H>
|
||||
#include <FL/Fl_Copy_Surface.H>
|
||||
@@ -2374,7 +2373,12 @@ static CGContextRef prepare_bitmap_for_layer(int w, int h ) {
|
||||
if (i->wait_for_expose) {
|
||||
// 1st drawing of GL window
|
||||
[self did_view_resolution_change];
|
||||
[(NSOpenGLContext*)window->as_gl_window()->context() update]; // GL window is empty without this
|
||||
typedef NSOpenGLContext* (*ftype)(Fl_Gl_Window*);
|
||||
static ftype f = (ftype)dlsym(RTLD_SELF, "fl_mac_gl_window_context");
|
||||
if (f) { // that function is implemented in Fl_Gl_Window.cxx from libftk_gl
|
||||
NSOpenGLContext *ctxt = f(window->as_gl_window());
|
||||
[ctxt update]; // GL window may be empty without this
|
||||
}
|
||||
i->wait_for_expose = 0;
|
||||
}
|
||||
through_drawRect = YES;
|
||||
|
||||
Reference in New Issue
Block a user