diff options
| author | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2022-03-13 08:56:23 +0100 |
|---|---|---|
| committer | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2022-03-13 08:56:35 +0100 |
| commit | b549cfaaea11ce5e881e2151a838c91a031ad9ba (patch) | |
| tree | a8a34a8cd7270a4d4ca68bca08c1b6e6388220d4 /src/drivers/Cocoa | |
| parent | e8461a6191e0afa5fd96290856d1a056437469d0 (diff) | |
Separate platform init functions from platform-specific driver files
Diffstat (limited to 'src/drivers/Cocoa')
| -rw-r--r-- | src/drivers/Cocoa/Fl_Cocoa_Gl_Window_Driver.H | 60 | ||||
| -rw-r--r-- | src/drivers/Cocoa/Fl_Cocoa_Gl_Window_Driver.cxx | 29 | ||||
| -rw-r--r-- | src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.cxx | 20 | ||||
| -rw-r--r-- | src/drivers/Cocoa/Fl_Cocoa_Window_Driver.cxx | 17 | ||||
| -rw-r--r-- | src/drivers/Cocoa/fl_macOS_gl_platform_init.cxx | 24 |
5 files changed, 85 insertions, 65 deletions
diff --git a/src/drivers/Cocoa/Fl_Cocoa_Gl_Window_Driver.H b/src/drivers/Cocoa/Fl_Cocoa_Gl_Window_Driver.H new file mode 100644 index 000000000..0ae5020fb --- /dev/null +++ b/src/drivers/Cocoa/Fl_Cocoa_Gl_Window_Driver.H @@ -0,0 +1,60 @@ +// +// Class Fl_Cocoa_Gl_Window_Driver for the Fast Light Tool Kit (FLTK). +// +// Copyright 2021 by Bill Spitzak and others. +// +// This library is free software. Distribution and use rights are outlined in +// the file "COPYING" which should have been included with this file. If this +// file is missing or damaged, see the license at: +// +// https://www.fltk.org/COPYING.php +// +// Please see the following page on how to report bugs and issues: +// +// https://www.fltk.org/bugs.php +// + +#include <config.h> +#if HAVE_GL +#include <FL/platform.H> +#include <FL/gl.h> +#include "../../Fl_Gl_Choice.H" +//#include "../../Fl_Screen_Driver.H" +#include "Fl_Cocoa_Window_Driver.H" +#include "../../Fl_Gl_Window_Driver.H" +//#include <FL/Fl_Graphics_Driver.H> +#include <OpenGL/OpenGL.h> +//#include <FL/Fl_Image_Surface.H> + +extern void gl_texture_reset(); + +#ifdef __OBJC__ +@class NSOpenGLPixelFormat; +#else +class NSOpenGLPixelFormat; +#endif // __OBJC__ + +class Fl_Cocoa_Gl_Window_Driver : public Fl_Gl_Window_Driver { + friend class Fl_Gl_Window_Driver; + Fl_Cocoa_Gl_Window_Driver(Fl_Gl_Window *win) : Fl_Gl_Window_Driver(win) {} + virtual float pixels_per_unit(); + virtual void before_show(int& need_after); + virtual void after_show(); + virtual int mode_(int m, const int *a); + virtual void make_current_before(); + virtual void swap_buffers(); + virtual void resize(int is_a_resize, int w, int h); + virtual char swap_type(); + virtual Fl_Gl_Choice *find(int m, const int *alistp); + virtual GLContext create_gl_context(Fl_Window* window, const Fl_Gl_Choice* g, int layer = 0); + virtual void set_gl_context(Fl_Window* w, GLContext context); + virtual void delete_gl_context(GLContext); + virtual void make_overlay_current(); + virtual void redraw_overlay(); + virtual void gl_start(); + virtual char *alpha_mask_for_string(const char *str, int n, int w, int h, Fl_Fontsize fs); + virtual Fl_RGB_Image* capture_gl_rectangle(int x, int y, int w, int h); +}; + + +#endif // HAVE_GL diff --git a/src/drivers/Cocoa/Fl_Cocoa_Gl_Window_Driver.cxx b/src/drivers/Cocoa/Fl_Cocoa_Gl_Window_Driver.cxx index af36b1fd1..6491332e3 100644 --- a/src/drivers/Cocoa/Fl_Cocoa_Gl_Window_Driver.cxx +++ b/src/drivers/Cocoa/Fl_Cocoa_Gl_Window_Driver.cxx @@ -21,7 +21,7 @@ #include "../../Fl_Gl_Choice.H" #include "../../Fl_Screen_Driver.H" #include "Fl_Cocoa_Window_Driver.H" -#include "../../Fl_Gl_Window_Driver.H" +#include "Fl_Cocoa_Gl_Window_Driver.H" #include <FL/Fl_Graphics_Driver.H> #include <OpenGL/OpenGL.h> #include <FL/Fl_Image_Surface.H> @@ -34,27 +34,6 @@ extern void gl_texture_reset(); class NSOpenGLPixelFormat; #endif // __OBJC__ -class Fl_Cocoa_Gl_Window_Driver : public Fl_Gl_Window_Driver { - friend class Fl_Gl_Window_Driver; - Fl_Cocoa_Gl_Window_Driver(Fl_Gl_Window *win) : Fl_Gl_Window_Driver(win) {} - virtual float pixels_per_unit(); - virtual void before_show(int& need_after); - virtual void after_show(); - virtual int mode_(int m, const int *a); - virtual void make_current_before(); - virtual void swap_buffers(); - virtual void resize(int is_a_resize, int w, int h); - virtual char swap_type(); - virtual Fl_Gl_Choice *find(int m, const int *alistp); - virtual GLContext create_gl_context(Fl_Window* window, const Fl_Gl_Choice* g, int layer = 0); - virtual void set_gl_context(Fl_Window* w, GLContext context); - virtual void delete_gl_context(GLContext); - virtual void make_overlay_current(); - virtual void redraw_overlay(); - virtual void gl_start(); - virtual char *alpha_mask_for_string(const char *str, int n, int w, int h, Fl_Fontsize fs); - virtual Fl_RGB_Image* capture_gl_rectangle(int x, int y, int w, int h); -}; // Describes crap needed to create a GLContext. class Fl_Cocoa_Gl_Choice : public Fl_Gl_Choice { @@ -121,12 +100,6 @@ void Fl_Cocoa_Gl_Window_Driver::redraw_overlay() { pWindow->redraw(); } - -Fl_Gl_Window_Driver *Fl_Gl_Window_Driver::newGlWindowDriver(Fl_Gl_Window *w) -{ - return new Fl_Cocoa_Gl_Window_Driver(w); -} - void Fl_Cocoa_Gl_Window_Driver::before_show(int& need_after) { need_after = 1; } diff --git a/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.cxx b/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.cxx index e213e5fd0..33f92a6db 100644 --- a/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.cxx +++ b/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.cxx @@ -34,26 +34,6 @@ extern void (*fl_unlock_function)(); int Fl_Cocoa_Screen_Driver::next_marked_length = 0; -/** - \cond DriverDev - \addtogroup DriverDeveloper - \{ - */ - -/** - Creates a driver that manages all screen and display related calls. - - This function must be implemented once for every platform. - */ -Fl_Screen_Driver *Fl_Screen_Driver::newScreenDriver() -{ - return new Fl_Cocoa_Screen_Driver(); -} - -/** - \} - \endcond - */ static Fl_Text_Editor::Key_Binding extra_bindings[] = { // Define CMD+key accelerators... diff --git a/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.cxx b/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.cxx index 7cb411418..e91342c8a 100644 --- a/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.cxx +++ b/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.cxx @@ -27,23 +27,6 @@ #include <FL/platform.H> #include <math.h> -/** - \cond DriverDev - \addtogroup DriverDeveloper - \{ - */ - -Fl_Window_Driver *Fl_Window_Driver::newWindowDriver(Fl_Window *w) -{ - return new Fl_Cocoa_Window_Driver(w); -} - -/** - \} - \endcond - */ - - Fl_Cocoa_Window_Driver::Fl_Cocoa_Window_Driver(Fl_Window *win) : Fl_Window_Driver(win) diff --git a/src/drivers/Cocoa/fl_macOS_gl_platform_init.cxx b/src/drivers/Cocoa/fl_macOS_gl_platform_init.cxx new file mode 100644 index 000000000..421c665d2 --- /dev/null +++ b/src/drivers/Cocoa/fl_macOS_gl_platform_init.cxx @@ -0,0 +1,24 @@ +// +// Wayland-specific code to initialize wayland support. +// +// Copyright 2022 by Bill Spitzak and others. +// +// This library is free software. Distribution and use rights are outlined in +// the file "COPYING" which should have been included with this file. If this +// file is missing or damaged, see the license at: +// +// https://www.fltk.org/COPYING.php +// +// Please see the following page on how to report bugs and issues: +// +// https://www.fltk.org/bugs.php +// + + +#include "Fl_Cocoa_Gl_Window_Driver.H" + + +Fl_Gl_Window_Driver *Fl_Gl_Window_Driver::newGlWindowDriver(Fl_Gl_Window *w) +{ + return new Fl_Cocoa_Gl_Window_Driver(w); +} |
