summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorManolo Gouy <Manolo>2018-06-26 14:23:51 +0000
committerManolo Gouy <Manolo>2018-06-26 14:23:51 +0000
commit3199e3331b4c779a9ed77966a51c5182f0dbda7d (patch)
treeb770feb56349d076f74818a8c61b0edcd68874b4 /src
parent7046e99f96810a1be310b1dd1b1b6d4c336ed814 (diff)
Move Fl_Gl_Window_Driver.H from FL/ to src/
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12977 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src')
-rw-r--r--src/Fl_Gl_Choice.cxx2
-rw-r--r--src/Fl_Gl_Overlay.cxx2
-rw-r--r--src/Fl_Gl_Window.cxx2
-rw-r--r--src/Fl_Gl_Window_Driver.H214
-rw-r--r--src/Fl_cocoa.mm2
-rw-r--r--src/drivers/OpenGL/Fl_OpenGL_Display_Device.cxx2
-rw-r--r--src/gl_draw.cxx2
-rw-r--r--src/gl_start.cxx2
-rw-r--r--src/glut_compatibility.cxx2
9 files changed, 222 insertions, 8 deletions
diff --git a/src/Fl_Gl_Choice.cxx b/src/Fl_Gl_Choice.cxx
index a20924b17..014635e14 100644
--- a/src/Fl_Gl_Choice.cxx
+++ b/src/Fl_Gl_Choice.cxx
@@ -23,7 +23,7 @@
# include <stdlib.h>
# include "Fl_Gl_Choice.H"
# include <FL/Fl_Gl_Window.H>
-# include <FL/Fl_Gl_Window_Driver.H>
+# include "Fl_Gl_Window_Driver.H"
# include <FL/gl_draw.H>
# include "flstring.h"
# include <FL/fl_utf8.h>
diff --git a/src/Fl_Gl_Overlay.cxx b/src/Fl_Gl_Overlay.cxx
index b24c1026e..13cbfbac6 100644
--- a/src/Fl_Gl_Overlay.cxx
+++ b/src/Fl_Gl_Overlay.cxx
@@ -22,7 +22,7 @@
#include <FL/Fl.H>
#include <FL/gl.h>
#include <FL/Fl_Gl_Window.H>
-#include <FL/Fl_Gl_Window_Driver.H>
+#include "Fl_Gl_Window_Driver.H"
#include <stdlib.h>
/**
diff --git a/src/Fl_Gl_Window.cxx b/src/Fl_Gl_Window.cxx
index 473f022f3..7d4ad1a3f 100644
--- a/src/Fl_Gl_Window.cxx
+++ b/src/Fl_Gl_Window.cxx
@@ -23,7 +23,7 @@ extern int fl_gl_load_plugin;
#include <FL/gl.h>
#include <FL/Fl_Gl_Window.H>
-#include <FL/Fl_Gl_Window_Driver.H>
+#include "Fl_Gl_Window_Driver.H"
#include "Fl_Window_Driver.H"
#include <FL/Fl_Graphics_Driver.H>
#include <stdlib.h>
diff --git a/src/Fl_Gl_Window_Driver.H b/src/Fl_Gl_Window_Driver.H
new file mode 100644
index 000000000..88d2c14dc
--- /dev/null
+++ b/src/Fl_Gl_Window_Driver.H
@@ -0,0 +1,214 @@
+//
+// "$Id$"
+//
+// Definition of class Fl_Gl_Window_Driver, and of its platform-specific derived classes
+// for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 2016-2018 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:
+//
+// http://www.fltk.org/COPYING.php
+//
+// Please report all bugs and problems on the following page:
+//
+// http://www.fltk.org/str.php
+//
+
+/**
+ \cond DriverDev
+ \addtogroup DriverDeveloper
+ \{
+ */
+
+#ifndef Fl_Gl_Window_Driver_H
+#define Fl_Gl_Window_Driver_H
+
+#include <FL/Fl_Gl_Window.H>
+
+class Fl_Gl_Choice;
+class Fl_Font_Descriptor;
+
+/* The constructor of each Fl_Gl_Window object creates also an object from a
+ platform-specific derived class from this class.
+ */
+class Fl_Gl_Window_Driver {
+protected:
+ Fl_Gl_Window *pWindow;
+public:
+ Fl_Gl_Choice* g() {return pWindow->g;}
+ void g(Fl_Gl_Choice *c) {pWindow->g = c;}
+ int mode() {return pWindow->mode_;}
+ void mode(int m) { pWindow->mode_ = m;}
+ const int *alist() {return pWindow->alist;}
+ void alist(const int *l) { pWindow->alist = l;}
+ void* overlay() {return pWindow->overlay;}
+ void draw_overlay() {pWindow->draw_overlay();}
+
+ Fl_Gl_Window_Driver(Fl_Gl_Window *win) : pWindow(win) {}
+ virtual ~Fl_Gl_Window_Driver() {}
+ static Fl_Gl_Window_Driver *newGlWindowDriver(Fl_Gl_Window *w);
+ static Fl_Gl_Window_Driver *global();
+ virtual float pixels_per_unit() {return 1;}
+ virtual void before_show(int& need_redraw) {}
+ virtual void after_show(int need_redraw) {}
+ virtual void invalidate();
+ virtual int mode_(int m, const int *a) {return 0;}
+ virtual void make_current_before() {}
+ virtual void make_current_after() {}
+ virtual void swap_buffers() {}
+ virtual void resize(int is_a_resize, int w, int h) {}
+ virtual char swap_type();
+ virtual int flush_begin(char& valid_f) {return 0;}
+ virtual void hide_overlay(void *& overlay) {}
+ static Fl_Gl_Choice *find_begin(int m, const int *alistp);
+ // Return one of these structures for a given gl mode.
+ // The second argument is a glX attribute list, and is used if mode is zero.
+ // This is not supported on Win32:
+ virtual Fl_Gl_Choice *find(int mode, const int *alistp) {return NULL;}
+ virtual GLContext create_gl_context(Fl_Window* window, const Fl_Gl_Choice* g, int layer = 0) {return 0;}
+ virtual void set_gl_context(Fl_Window* w, GLContext context) {}
+ virtual void delete_gl_context(GLContext) {}
+ virtual void make_overlay(void* &o);
+ virtual void hide_overlay() {}
+ virtual void make_overlay_current() {}
+ virtual void redraw_overlay() {}
+ virtual int can_do_overlay() {return 0;}
+ virtual void waitGL() {} // support for gl_finish() function
+ virtual void gl_visual(Fl_Gl_Choice*); // support for Fl::gl_visual() function
+ virtual void gl_start() {} // support for gl_start() function
+ virtual void* GetProcAddress(const char *procName); // support for glutGetProcAddress()
+ virtual void draw_string_legacy(const char* str, int n); // support for gl_draw()
+ void draw_string_legacy_get_list(const char* str, int n); // support for gl_draw()
+ static void draw_string_legacy_glut(const char* str, int n); // support for gl_draw()
+ virtual void get_list(Fl_Font_Descriptor* fd, int r) {} // support for gl_draw() without textures
+ virtual void gl_bitmap_font(Fl_Font_Descriptor *fl_fontsize) {} // support for gl_font() without textures
+ virtual int overlay_color(Fl_Color i) {return 0;} // support for gl_color() with HAVE_GL_OVERLAY
+ static void draw_string_with_texture(const char* str, int n); // cross-platform
+ // support for gl_draw(). The cross-platform version may be enough.
+ virtual char *alpha_mask_for_string(const char *str, int n, int w, int h);
+ virtual int genlistsize() { return 0; } // support for gl_draw()
+ virtual Fl_Font_Descriptor** fontnum_to_fontdescriptor(int fnum);
+};
+
+#ifdef FL_CFG_GFX_QUARTZ
+#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;
+ friend class Fl_OpenGL_Display_Device;
+ 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_redraw);
+ virtual void after_show(int need_redraw);
+ 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();
+ void flush_context();
+ 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();
+ static NSOpenGLContext* create_GLcontext_for_window(NSOpenGLPixelFormat *pixelformat, NSOpenGLContext *shared_ctx, Fl_Window *window);
+ static NSOpenGLPixelFormat *mode_to_NSOpenGLPixelFormat(int mode, const int*); // uses Objective-c
+ static void GLcontext_update(NSOpenGLContext*); // uses Objective-c
+ static void GLcontext_release(NSOpenGLContext*); // uses Objective-c
+ static void GLcontext_makecurrent(NSOpenGLContext*); // uses Objective-c
+ static void GL_cleardrawable(void); // uses Objective-c
+ virtual char *alpha_mask_for_string(const char *str, int n, int w, int h);
+};
+#endif // FL_CFG_GFX_QUARTZ
+
+
+#ifdef FL_CFG_GFX_GDI
+
+class Fl_WinAPI_Gl_Window_Driver : public Fl_Gl_Window_Driver {
+ friend class Fl_Gl_Window_Driver;
+ Fl_WinAPI_Gl_Window_Driver(Fl_Gl_Window *win) : Fl_Gl_Window_Driver(win) {}
+ virtual float pixels_per_unit();
+ virtual int mode_(int m, const int *a);
+ virtual void make_current_after();
+ virtual void swap_buffers();
+ virtual void invalidate() {}
+ virtual int flush_begin(char& valid_f);
+ virtual void hide_overlay(void *& overlay);
+ 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* GetProcAddress(const char *procName);
+ 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 HAVE_GL_OVERLAY
+ virtual int can_do_overlay();
+ virtual int overlay_color(Fl_Color i);
+#endif
+};
+
+#endif // FL_CFG_GFX_GDI
+
+
+#ifdef FL_CFG_GFX_XLIB
+#include <X11/Xutil.h> // for XVisualInfo
+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_redraw);
+ virtual int mode_(int m, const int *a);
+ 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);
+#if HAVE_GL_OVERLAY
+ virtual void make_overlay(void *&o);
+ virtual int can_do_overlay();
+ virtual void hide_overlay();
+ virtual int overlay_color(Fl_Color i);
+#endif
+ 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 // FL_CFG_GFX_XLIB
+
+#endif /* Fl_Gl_Window_Driver_H */
+
+/**
+ \}
+ \endcond
+ */
+
+//
+// End of "$Id$".
+//
diff --git a/src/Fl_cocoa.mm b/src/Fl_cocoa.mm
index 220d265c4..95788ac98 100644
--- a/src/Fl_cocoa.mm
+++ b/src/Fl_cocoa.mm
@@ -43,7 +43,7 @@ extern "C" {
#include <FL/Fl_Tooltip.H>
#include <FL/Fl_Printer.H>
#include <FL/fl_draw.H>
-#include <FL/Fl_Gl_Window_Driver.H>
+#include "Fl_Gl_Window_Driver.H"
#include "drivers/Quartz/Fl_Quartz_Graphics_Driver.H"
#include "drivers/Quartz/Fl_Quartz_Copy_Surface_Driver.H"
#include "drivers/Cocoa/Fl_Cocoa_Screen_Driver.H"
diff --git a/src/drivers/OpenGL/Fl_OpenGL_Display_Device.cxx b/src/drivers/OpenGL/Fl_OpenGL_Display_Device.cxx
index 302fc7348..66570ae41 100644
--- a/src/drivers/OpenGL/Fl_OpenGL_Display_Device.cxx
+++ b/src/drivers/OpenGL/Fl_OpenGL_Display_Device.cxx
@@ -38,7 +38,7 @@ Fl_OpenGL_Display_Device::Fl_OpenGL_Display_Device(Fl_OpenGL_Graphics_Driver *gr
}
#ifdef FL_CFG_GFX_QUARTZ
-#include <FL/Fl_Gl_Window_Driver.H>
+#include "../../Fl_Gl_Window_Driver.H"
// convert BGRA to RGB and also exchange top and bottom
static uchar *convert_BGRA_to_RGB(uchar *baseAddress, int w, int h, int mByteWidth)
diff --git a/src/gl_draw.cxx b/src/gl_draw.cxx
index 38bb4f603..a77c9fa4b 100644
--- a/src/gl_draw.cxx
+++ b/src/gl_draw.cxx
@@ -39,7 +39,7 @@
#include <FL/gl.h>
#include <FL/gl_draw.H>
#include <FL/fl_draw.H>
-#include <FL/Fl_Gl_Window_Driver.H>
+#include "Fl_Gl_Window_Driver.H"
#include <FL/Fl_Image_Surface.H>
#include <FL/glu.h> // for gluUnProject()
#include <FL/glut.H> // for glutStrokeString() and glutStrokeLength()
diff --git a/src/gl_start.cxx b/src/gl_start.cxx
index 07540f751..18ce99bc9 100644
--- a/src/gl_start.cxx
+++ b/src/gl_start.cxx
@@ -37,7 +37,7 @@
#include <FL/gl.h>
class Fl_Gl_Choice;
#include <FL/Fl_Gl_Window.H>
-#include <FL/Fl_Gl_Window_Driver.H>
+#include "Fl_Gl_Window_Driver.H"
static GLContext context;
static int clip_state_number=-1;
diff --git a/src/glut_compatibility.cxx b/src/glut_compatibility.cxx
index 38312f5d5..7f3821b77 100644
--- a/src/glut_compatibility.cxx
+++ b/src/glut_compatibility.cxx
@@ -28,7 +28,7 @@
#include "flstring.h"
#if HAVE_GL
-# include <FL/Fl_Gl_Window_Driver.H>
+# include "Fl_Gl_Window_Driver.H"
# include "Fl_Screen_Driver.H"
# include <FL/glut.H>
# define MAXWINDOWS 32