From 939d536b66c633b42eeddfe3dfa775e7fab0055a Mon Sep 17 00:00:00 2001 From: ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> Date: Tue, 7 Dec 2021 10:54:29 +0100 Subject: Fix for fltk.coredev "reentrant calls with Fl_Window::resize" - cont'd --- src/drivers/Cocoa/Fl_Cocoa_Gl_Window_Driver.cxx | 11 +++++++++++ src/drivers/Cocoa/Fl_Cocoa_Window_Driver.H | 9 +++++++++ 2 files changed, 20 insertions(+) (limited to 'src/drivers') diff --git a/src/drivers/Cocoa/Fl_Cocoa_Gl_Window_Driver.cxx b/src/drivers/Cocoa/Fl_Cocoa_Gl_Window_Driver.cxx index 372ee38ec..af36b1fd1 100644 --- a/src/drivers/Cocoa/Fl_Cocoa_Gl_Window_Driver.cxx +++ b/src/drivers/Cocoa/Fl_Cocoa_Gl_Window_Driver.cxx @@ -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 diff --git a/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.H b/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.H index 4bc7d3783..3003e3904 100644 --- a/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.H +++ b/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.H @@ -24,6 +24,7 @@ #define FL_COCOA_WINDOW_DRIVER_H #include "../../Fl_Window_Driver.H" +#include #include 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 -- cgit v1.2.3