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/Xlib | |
| parent | e8461a6191e0afa5fd96290856d1a056437469d0 (diff) | |
Separate platform init functions from platform-specific driver files
Diffstat (limited to 'src/drivers/Xlib')
| -rw-r--r-- | src/drivers/Xlib/Fl_Xlib_Copy_Surface_Driver.H | 36 | ||||
| -rw-r--r-- | src/drivers/Xlib/Fl_Xlib_Copy_Surface_Driver.cxx | 21 | ||||
| -rw-r--r-- | src/drivers/Xlib/Fl_Xlib_Graphics_Driver.cxx | 8 | ||||
| -rw-r--r-- | src/drivers/Xlib/Fl_Xlib_Image_Surface_Driver.H | 34 | ||||
| -rw-r--r-- | src/drivers/Xlib/Fl_Xlib_Image_Surface_Driver.cxx | 18 |
5 files changed, 72 insertions, 45 deletions
diff --git a/src/drivers/Xlib/Fl_Xlib_Copy_Surface_Driver.H b/src/drivers/Xlib/Fl_Xlib_Copy_Surface_Driver.H new file mode 100644 index 000000000..a0b0db171 --- /dev/null +++ b/src/drivers/Xlib/Fl_Xlib_Copy_Surface_Driver.H @@ -0,0 +1,36 @@ +// +// Copy-to-clipboard code 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_XLIB_COPY_SURFACE_DRIVER_H +#define FL_XLIB_COPY_SURFACE_DRIVER_H + +#include <FL/Fl_Copy_Surface.H> +#include <FL/platform.H> + +class Fl_Xlib_Copy_Surface_Driver : public Fl_Copy_Surface_Driver { + friend class Fl_Copy_Surface_Driver; + virtual void end_current(); +protected: + Fl_Offscreen xid; + Window oldwindow; + Fl_Xlib_Copy_Surface_Driver(int w, int h); + ~Fl_Xlib_Copy_Surface_Driver(); + void set_current(); + void translate(int x, int y); + void untranslate(); +}; + +#endif // FL_XLIB_COPY_SURFACE_DRIVER_H diff --git a/src/drivers/Xlib/Fl_Xlib_Copy_Surface_Driver.cxx b/src/drivers/Xlib/Fl_Xlib_Copy_Surface_Driver.cxx index 0343e9a9c..f87ae55a2 100644 --- a/src/drivers/Xlib/Fl_Xlib_Copy_Surface_Driver.cxx +++ b/src/drivers/Xlib/Fl_Xlib_Copy_Surface_Driver.cxx @@ -15,32 +15,13 @@ // #include <config.h> -#include <FL/Fl_Copy_Surface.H> +#include "Fl_Xlib_Copy_Surface_Driver.H" #include <FL/Fl.H> #include <FL/platform.H> #include <FL/fl_draw.H> #include "Fl_Xlib_Graphics_Driver.H" #include "../X11/Fl_X11_Screen_Driver.H" -class Fl_Xlib_Copy_Surface_Driver : public Fl_Copy_Surface_Driver { - friend class Fl_Copy_Surface_Driver; - virtual void end_current(); -protected: - Fl_Offscreen xid; - Window oldwindow; - Fl_Xlib_Copy_Surface_Driver(int w, int h); - ~Fl_Xlib_Copy_Surface_Driver(); - void set_current(); - void translate(int x, int y); - void untranslate(); -}; - - -Fl_Copy_Surface_Driver *Fl_Copy_Surface_Driver::newCopySurfaceDriver(int w, int h) -{ - return new Fl_Xlib_Copy_Surface_Driver(w, h); -} - Fl_Xlib_Copy_Surface_Driver::Fl_Xlib_Copy_Surface_Driver(int w, int h) : Fl_Copy_Surface_Driver(w, h) { driver(new Fl_Xlib_Graphics_Driver()); diff --git a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver.cxx b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver.cxx index 14c56c040..697acecb3 100644 --- a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver.cxx +++ b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver.cxx @@ -30,14 +30,6 @@ extern char fl_is_over_the_spot; extern char *fl_get_font_xfld(int fnum, int size); #endif -/* - * By linking this module, the following static method will instantiate the - * X11 Xlib Graphics driver as the main display driver. - */ -Fl_Graphics_Driver *Fl_Graphics_Driver::newMainGraphicsDriver() -{ - return new Fl_Xlib_Graphics_Driver(); -} GC Fl_Xlib_Graphics_Driver::gc_ = NULL; int Fl_Xlib_Graphics_Driver::fl_overlay = 0; diff --git a/src/drivers/Xlib/Fl_Xlib_Image_Surface_Driver.H b/src/drivers/Xlib/Fl_Xlib_Image_Surface_Driver.H new file mode 100644 index 000000000..b7cb48010 --- /dev/null +++ b/src/drivers/Xlib/Fl_Xlib_Image_Surface_Driver.H @@ -0,0 +1,34 @@ +// +// Draw-to-image code 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_XLIB_IMAGE_SURFACE_DRIVER_H +#define FL_XLIB_IMAGE_SURFACE_DRIVER_H + +#include <FL/Fl_Image_Surface.H> + +class Fl_Xlib_Image_Surface_Driver : public Fl_Image_Surface_Driver { + virtual void end_current(); +public: + Window pre_window; + Fl_Xlib_Image_Surface_Driver(int w, int h, int high_res, Fl_Offscreen off); + ~Fl_Xlib_Image_Surface_Driver(); + void set_current(); + void translate(int x, int y); + void untranslate(); + Fl_RGB_Image *image(); +}; + +#endif // FL_XLIB_IMAGE_SURFACE_DRIVER_H diff --git a/src/drivers/Xlib/Fl_Xlib_Image_Surface_Driver.cxx b/src/drivers/Xlib/Fl_Xlib_Image_Surface_Driver.cxx index 89fe4a100..e1a33c746 100644 --- a/src/drivers/Xlib/Fl_Xlib_Image_Surface_Driver.cxx +++ b/src/drivers/Xlib/Fl_Xlib_Image_Surface_Driver.cxx @@ -15,25 +15,9 @@ // #include "Fl_Xlib_Graphics_Driver.H" -#include <FL/Fl_Image_Surface.H> +#include "Fl_Xlib_Image_Surface_Driver.H" #include "../../Fl_Screen_Driver.H" -class Fl_Xlib_Image_Surface_Driver : public Fl_Image_Surface_Driver { - virtual void end_current(); -public: - Window pre_window; - Fl_Xlib_Image_Surface_Driver(int w, int h, int high_res, Fl_Offscreen off); - ~Fl_Xlib_Image_Surface_Driver(); - void set_current(); - void translate(int x, int y); - void untranslate(); - Fl_RGB_Image *image(); -}; - -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); -} Fl_Xlib_Image_Surface_Driver::Fl_Xlib_Image_Surface_Driver(int w, int h, int high_res, Fl_Offscreen off) : Fl_Image_Surface_Driver(w, h, high_res, off) { float d = 1; |
