Fix for fltk.coredev "reentrant calls with Fl_Window::resize" - cont'd
This commit is contained in:
parent
16c9641797
commit
939d536b66
@ -1253,9 +1253,19 @@ static FLWindowDelegate *flwindowdelegate_instance = nil;
|
||||
float s = Fl::screen_driver()->scale(window->screen_num());
|
||||
NSRect r = [view frame];
|
||||
Fl_Cocoa_Window_Driver::driver(window)->view_resized(1);
|
||||
if (Fl_Cocoa_Window_Driver::driver(window)->through_resize())
|
||||
Fl_Cocoa_Window_Driver::driver(window)->resize(X, Y, lround(r.size.width/s), lround(r.size.height/s));
|
||||
else
|
||||
if (Fl_Cocoa_Window_Driver::driver(window)->through_resize()) {
|
||||
if (window->as_gl_window()) {
|
||||
static Fl_Cocoa_Plugin *plugin = NULL;
|
||||
if (!plugin) {
|
||||
Fl_Plugin_Manager pm("fltk:cocoa");
|
||||
plugin = (Fl_Cocoa_Plugin*)pm.plugin("gl.cocoa.fltk.org");
|
||||
}
|
||||
// calls Fl_Gl_Window::resize() without including Fl_Gl_Window.H
|
||||
plugin->resize(window->as_gl_window(), X, Y, lround(r.size.width/s), lround(r.size.height/s));
|
||||
} else {
|
||||
Fl_Cocoa_Window_Driver::driver(window)->resize(X, Y, lround(r.size.width/s), lround(r.size.height/s));
|
||||
}
|
||||
} else
|
||||
window->resize(X, Y, lround(r.size.width/s), lround(r.size.height/s));
|
||||
Fl_Cocoa_Window_Driver::driver(window)->view_resized(0);
|
||||
update_e_xy_and_e_xy_root(nsw);
|
||||
|
@ -297,4 +297,15 @@ Fl_RGB_Image* Fl_Cocoa_Gl_Window_Driver::capture_gl_rectangle(int x, int y, int
|
||||
return img;
|
||||
}
|
||||
|
||||
class Fl_Gl_Cocoa_Plugin : public Fl_Cocoa_Plugin {
|
||||
public:
|
||||
Fl_Gl_Cocoa_Plugin() : Fl_Cocoa_Plugin(name()) { }
|
||||
virtual const char *name() { return "gl.cocoa.fltk.org"; }
|
||||
virtual void resize(Fl_Gl_Window *glw, int x, int y, int w, int h) {
|
||||
glw->Fl_Gl_Window::resize(x, y, w, h);
|
||||
}
|
||||
};
|
||||
|
||||
static Fl_Gl_Cocoa_Plugin Gl_Cocoa_Plugin;
|
||||
|
||||
#endif // HAVE_GL
|
||||
|
@ -24,6 +24,7 @@
|
||||
#define FL_COCOA_WINDOW_DRIVER_H
|
||||
|
||||
#include "../../Fl_Window_Driver.H"
|
||||
#include <FL/Fl_Plugin.H>
|
||||
#include <ApplicationServices/ApplicationServices.h>
|
||||
|
||||
class Fl_Image;
|
||||
@ -163,4 +164,12 @@ public:
|
||||
NSImage *icon_image;
|
||||
};
|
||||
|
||||
class Fl_Cocoa_Plugin : public Fl_Plugin {
|
||||
public:
|
||||
Fl_Cocoa_Plugin(const char *pluginName) : Fl_Plugin(klass(), pluginName) { }
|
||||
virtual const char *klass() { return "fltk:cocoa"; }
|
||||
virtual const char *name() = 0;
|
||||
virtual void resize(Fl_Gl_Window *glw, int x, int y, int w, int h) = 0;
|
||||
};
|
||||
|
||||
#endif // FL_COCOA_WINDOW_DRIVER_H
|
||||
|
Loading…
Reference in New Issue
Block a user