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/X11 | |
| parent | e8461a6191e0afa5fd96290856d1a056437469d0 (diff) | |
Separate platform init functions from platform-specific driver files
Diffstat (limited to 'src/drivers/X11')
| -rw-r--r-- | src/drivers/X11/Fl_X11_Gl_Window_Driver.H | 58 | ||||
| -rw-r--r-- | src/drivers/X11/Fl_X11_Gl_Window_Driver.cxx | 34 | ||||
| -rw-r--r-- | src/drivers/X11/Fl_X11_Screen_Driver.cxx | 18 | ||||
| -rw-r--r-- | src/drivers/X11/Fl_X11_System_Driver.cxx | 11 | ||||
| -rw-r--r-- | src/drivers/X11/Fl_X11_Window_Driver.cxx | 5 | ||||
| -rw-r--r-- | src/drivers/X11/fl_X11_gl_platform_init.cxx | 24 | ||||
| -rw-r--r-- | src/drivers/X11/fl_X11_platform_init.cxx | 66 |
7 files changed, 149 insertions, 67 deletions
diff --git a/src/drivers/X11/Fl_X11_Gl_Window_Driver.H b/src/drivers/X11/Fl_X11_Gl_Window_Driver.H new file mode 100644 index 000000000..a7694d1a9 --- /dev/null +++ b/src/drivers/X11/Fl_X11_Gl_Window_Driver.H @@ -0,0 +1,58 @@ +// +// Class Fl_X11_Gl_Window_Driver for the Fast Light Tool Kit (FLTK). +// +// 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 +// + +#ifndef FL_X11_GL_WINDOW_DRIVER_H +#define FL_X11_GL_WINDOW_DRIVER_H + +#include <config.h> +#if HAVE_GL +#include <FL/platform.H> +#include "../../Fl_Gl_Choice.H" +#include "../../Fl_Gl_Window_Driver.H" + + +class Fl_X11_Gl_Window_Driver : public Fl_Gl_Window_Driver { + friend class Fl_Gl_Window_Driver; + Fl_X11_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 int mode_(int m, const int *a); + virtual void swap_buffers(); + 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 waitGL(); + virtual void gl_visual(Fl_Gl_Choice*); // support for Fl::gl_visual() + virtual void gl_start(); + virtual void draw_string_legacy(const char* str, int n); + virtual void gl_bitmap_font(Fl_Font_Descriptor *fl_fontsize); + virtual void get_list(Fl_Font_Descriptor *fd, int r); + virtual int genlistsize(); +#if !USE_XFT + virtual Fl_Font_Descriptor** fontnum_to_fontdescriptor(int fnum); +#endif + public: + static GLContext create_gl_context(XVisualInfo* vis); +}; + + +#endif // HAVE_GL + +#endif // FL_X11_GL_WINDOW_DRIVER_H diff --git a/src/drivers/X11/Fl_X11_Gl_Window_Driver.cxx b/src/drivers/X11/Fl_X11_Gl_Window_Driver.cxx index 1b411c704..9a092756a 100644 --- a/src/drivers/X11/Fl_X11_Gl_Window_Driver.cxx +++ b/src/drivers/X11/Fl_X11_Gl_Window_Driver.cxx @@ -20,7 +20,7 @@ #include "../../Fl_Gl_Choice.H" #include "../../Fl_Screen_Driver.H" #include "../../Fl_Window_Driver.H" -#include "../../Fl_Gl_Window_Driver.H" +#include "Fl_X11_Gl_Window_Driver.H" #include "../Xlib/Fl_Font.H" #include "../Xlib/Fl_Xlib_Graphics_Driver.H" # include <GL/glx.h> @@ -28,33 +28,6 @@ # typedef void *GLXFBConfig; # endif -class Fl_X11_Gl_Window_Driver : public Fl_Gl_Window_Driver { - friend class Fl_Gl_Window_Driver; - Fl_X11_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 int mode_(int m, const int *a); - virtual void swap_buffers(); - 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 waitGL(); - virtual void gl_visual(Fl_Gl_Choice*); // support for Fl::gl_visual() - virtual void gl_start(); - virtual void draw_string_legacy(const char* str, int n); - virtual void gl_bitmap_font(Fl_Font_Descriptor *fl_fontsize); - virtual void get_list(Fl_Font_Descriptor *fd, int r); - virtual int genlistsize(); -#if !USE_XFT - virtual Fl_Font_Descriptor** fontnum_to_fontdescriptor(int fnum); -#endif - public: - static GLContext create_gl_context(XVisualInfo* vis); -}; // Describes crap needed to create a GLContext. class Fl_X11_Gl_Choice : public Fl_Gl_Choice { @@ -360,11 +333,6 @@ void Fl_X11_Gl_Window_Driver::redraw_overlay() { } -Fl_Gl_Window_Driver *Fl_Gl_Window_Driver::newGlWindowDriver(Fl_Gl_Window *w) -{ - return new Fl_X11_Gl_Window_Driver(w); -} - void Fl_X11_Gl_Window_Driver::before_show(int&) { Fl_X11_Gl_Choice *g = (Fl_X11_Gl_Choice*)this->g(); Fl_X::make_xid(pWindow, g->vis, g->colormap); diff --git a/src/drivers/X11/Fl_X11_Screen_Driver.cxx b/src/drivers/X11/Fl_X11_Screen_Driver.cxx index d033f4cb7..3c942d654 100644 --- a/src/drivers/X11/Fl_X11_Screen_Driver.cxx +++ b/src/drivers/X11/Fl_X11_Screen_Driver.cxx @@ -58,24 +58,6 @@ extern const char *fl_bg2; // end of extern additions workaround -/** - 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() -{ - Fl_X11_Screen_Driver *d = new Fl_X11_Screen_Driver(); -#if USE_XFT - for (int i = 0; i < MAX_SCREENS; i++) d->screens[i].scale = 1; - d->current_xft_dpi = 0.; // means the value of the Xft.dpi resource is still unknown -#else - secret_input_character = '*'; -#endif - return d; -} - - void Fl_X11_Screen_Driver::display(const char *d) { if (d) setenv("DISPLAY", d, 1); diff --git a/src/drivers/X11/Fl_X11_System_Driver.cxx b/src/drivers/X11/Fl_X11_System_Driver.cxx index 40a98d32e..cbd97b509 100644 --- a/src/drivers/X11/Fl_X11_System_Driver.cxx +++ b/src/drivers/X11/Fl_X11_System_Driver.cxx @@ -70,17 +70,6 @@ extern "C" { #endif -/** - Creates a driver that manages all system related calls. - - This function must be implemented once for every platform. - */ -Fl_System_Driver *Fl_System_Driver::newSystemDriver() -{ - return new Fl_X11_System_Driver(); -} - - // Find a program in the path... static char *path_find(const char *program, char *filename, int filesize) { const char *path; // Search path diff --git a/src/drivers/X11/Fl_X11_Window_Driver.cxx b/src/drivers/X11/Fl_X11_Window_Driver.cxx index 9b5196358..a91dadec3 100644 --- a/src/drivers/X11/Fl_X11_Window_Driver.cxx +++ b/src/drivers/X11/Fl_X11_Window_Driver.cxx @@ -43,11 +43,6 @@ void Fl_X11_Window_Driver::destroy_double_buffer() { other_xid = 0; } -Fl_Window_Driver *Fl_Window_Driver::newWindowDriver(Fl_Window *w) -{ - return new Fl_X11_Window_Driver(w); -} - Fl_X11_Window_Driver::Fl_X11_Window_Driver(Fl_Window *win) : Fl_Window_Driver(win) diff --git a/src/drivers/X11/fl_X11_gl_platform_init.cxx b/src/drivers/X11/fl_X11_gl_platform_init.cxx new file mode 100644 index 000000000..66cfb6989 --- /dev/null +++ b/src/drivers/X11/fl_X11_gl_platform_init.cxx @@ -0,0 +1,24 @@ +// +// X11-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_X11_Gl_Window_Driver.H" + + +Fl_Gl_Window_Driver *Fl_Gl_Window_Driver::newGlWindowDriver(Fl_Gl_Window *w) +{ + return new Fl_X11_Gl_Window_Driver(w); +} diff --git a/src/drivers/X11/fl_X11_platform_init.cxx b/src/drivers/X11/fl_X11_platform_init.cxx new file mode 100644 index 000000000..6c528a7cb --- /dev/null +++ b/src/drivers/X11/fl_X11_platform_init.cxx @@ -0,0 +1,66 @@ +// +// X11-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 "../Xlib/Fl_Xlib_Copy_Surface_Driver.H" +#include "../Xlib/Fl_Xlib_Graphics_Driver.H" +#include "Fl_X11_Screen_Driver.H" +#include "Fl_X11_System_Driver.H" +#include "Fl_X11_Window_Driver.H" +#include "../Xlib/Fl_Xlib_Image_Surface_Driver.H" + + +Fl_Copy_Surface_Driver *Fl_Copy_Surface_Driver::newCopySurfaceDriver(int w, int h) +{ + return new Fl_Xlib_Copy_Surface_Driver(w, h); +} + + +Fl_Graphics_Driver *Fl_Graphics_Driver::newMainGraphicsDriver() +{ + return new Fl_Xlib_Graphics_Driver(); +} + + +Fl_Screen_Driver *Fl_Screen_Driver::newScreenDriver() +{ + Fl_X11_Screen_Driver *d = new Fl_X11_Screen_Driver(); +#if USE_XFT + for (int i = 0; i < MAX_SCREENS; i++) d->screens[i].scale = 1; + d->current_xft_dpi = 0.; // means the value of the Xft.dpi resource is still unknown +#else + secret_input_character = '*'; +#endif + return d; +} + + +Fl_System_Driver *Fl_System_Driver::newSystemDriver() +{ + return new Fl_X11_System_Driver(); +} + + +Fl_Window_Driver *Fl_Window_Driver::newWindowDriver(Fl_Window *w) +{ + return new Fl_X11_Window_Driver(w); +} + + +Fl_Image_Surface_Driver *Fl_Image_Surface_Driver::newImageSurfaceDriver(int w, int h, int high_res, Fl_Offscreen off) +{ + return new Fl_Xlib_Image_Surface_Driver(w, h, high_res, off); +} |
