FLTK logo

[master] 1fc23f8 - Clean use of virtual GLContext Fl_Gl_Window_Driver::create_gl_context().

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.commit  ]
 
Previous Message ]Next Message ]

[master] 1fc23f8 - Clean use of virtual GLContext Fl_Gl_Window_Driver::create_gl_context(). "ManoloFLTK" Oct 02, 2022  
 
commit 1fc23f85068008ba58961b9c9e6ecd67320f5500
Author:     ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>
AuthorDate: Sun Oct 2 13:35:53 2022 +0200
Commit:     ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>
CommitDate: Sun Oct 2 13:35:53 2022 +0200

    Clean use of virtual GLContext Fl_Gl_Window_Driver::create_gl_context().

 src/Fl_Gl_Window_Driver.H                           |  2 +-
 src/drivers/Cocoa/Fl_Cocoa_Gl_Window_Driver.H       |  2 +-
 src/drivers/Cocoa/Fl_Cocoa_Gl_Window_Driver.mm      |  2 +-
 src/drivers/Wayland/Fl_Wayland_Gl_Window_Driver.H   |  2 +-
 src/drivers/Wayland/Fl_Wayland_Gl_Window_Driver.cxx |  3 ++-
 src/drivers/WinAPI/Fl_WinAPI_Gl_Window_Driver.H     |  4 +++-
 src/drivers/WinAPI/Fl_WinAPI_Gl_Window_Driver.cxx   | 10 ++++++++--
 src/drivers/X11/Fl_X11_Gl_Window_Driver.H           |  4 ++--
 src/drivers/X11/Fl_X11_Gl_Window_Driver.cxx         |  8 +++++---
 9 files changed, 24 insertions(+), 13 deletions(-)

diff --git src/Fl_Gl_Window_Driver.H src/Fl_Gl_Window_Driver.H
index 0580e52..839c5bc 100644
--- src/Fl_Gl_Window_Driver.H
+++ src/Fl_Gl_Window_Driver.H
@@ -78,7 +78,7 @@ public:
   // 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*, const Fl_Gl_Choice*, int layer = 0) {(void)layer; return 0;}
+  virtual GLContext create_gl_context(Fl_Window*, const Fl_Gl_Choice*) {return 0;}
   virtual void set_gl_context(Fl_Window*, GLContext) {}
   virtual void delete_gl_context(GLContext) {}
   virtual void make_overlay(void* &o);
diff --git src/drivers/Cocoa/Fl_Cocoa_Gl_Window_Driver.H src/drivers/Cocoa/Fl_Cocoa_Gl_Window_Driver.H
index 9d7e6df..a54b185 100644
--- src/drivers/Cocoa/Fl_Cocoa_Gl_Window_Driver.H
+++ src/drivers/Cocoa/Fl_Cocoa_Gl_Window_Driver.H
@@ -39,7 +39,7 @@ class Fl_Cocoa_Gl_Window_Driver : public Fl_Gl_Window_Driver {
   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 GLContext create_gl_context(Fl_Window* window, const Fl_Gl_Choice* g);
   virtual void set_gl_context(Fl_Window* w, GLContext context);
   virtual void delete_gl_context(GLContext);
   virtual void make_overlay_current();
diff --git src/drivers/Cocoa/Fl_Cocoa_Gl_Window_Driver.mm src/drivers/Cocoa/Fl_Cocoa_Gl_Window_Driver.mm
index fb6690d..c2e618e 100644
--- src/drivers/Cocoa/Fl_Cocoa_Gl_Window_Driver.mm
+++ src/drivers/Cocoa/Fl_Cocoa_Gl_Window_Driver.mm
@@ -186,7 +186,7 @@ static NSOpenGLContext *create_GLcontext_for_window(
   return context;
 }
 
-GLContext Fl_Cocoa_Gl_Window_Driver::create_gl_context(Fl_Window* window, const Fl_Gl_Choice* g, int layer) {
+GLContext Fl_Cocoa_Gl_Window_Driver::create_gl_context(Fl_Window* window, const Fl_Gl_Choice* g) {
   GLContext context, shared_ctx = 0;
   if (context_list && nContext) shared_ctx = context_list[0];
   // resets the pile of string textures used to draw strings
diff --git src/drivers/Wayland/Fl_Wayland_Gl_Window_Driver.H src/drivers/Wayland/Fl_Wayland_Gl_Window_Driver.H
index 5ecfeea..c00df25 100644
--- src/drivers/Wayland/Fl_Wayland_Gl_Window_Driver.H
+++ src/drivers/Wayland/Fl_Wayland_Gl_Window_Driver.H
@@ -45,7 +45,7 @@ class Fl_Wayland_Gl_Window_Driver : public Fl_Gl_Window_Driver {
   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 GLContext create_gl_context(Fl_Window* window, const Fl_Gl_Choice* g);
   virtual void set_gl_context(Fl_Window* w, GLContext context);
   virtual void delete_gl_context(GLContext);
   virtual void make_overlay_current();
diff --git src/drivers/Wayland/Fl_Wayland_Gl_Window_Driver.cxx src/drivers/Wayland/Fl_Wayland_Gl_Window_Driver.cxx
index 2866e02..0cd33ca 100644
--- src/drivers/Wayland/Fl_Wayland_Gl_Window_Driver.cxx
+++ src/drivers/Wayland/Fl_Wayland_Gl_Window_Driver.cxx
@@ -176,7 +176,8 @@ Fl_Gl_Choice *Fl_Wayland_Gl_Window_Driver::find(int m, const int *alistp)
 }
 
 
-GLContext Fl_Wayland_Gl_Window_Driver::create_gl_context(Fl_Window* window, const Fl_Gl_Choice* g, int layer) {
+GLContext Fl_Wayland_Gl_Window_Driver::create_gl_context(Fl_Window* window,
+                                                         const Fl_Gl_Choice* g) {
   GLContext shared_ctx = 0;
   if (context_list && nContext) shared_ctx = context_list[0];
 
diff --git src/drivers/WinAPI/Fl_WinAPI_Gl_Window_Driver.H src/drivers/WinAPI/Fl_WinAPI_Gl_Window_Driver.H
index 2de50eb..6934fec 100644
--- src/drivers/WinAPI/Fl_WinAPI_Gl_Window_Driver.H
+++ src/drivers/WinAPI/Fl_WinAPI_Gl_Window_Driver.H
@@ -41,7 +41,9 @@ class Fl_WinAPI_Gl_Window_Driver : public Fl_Gl_Window_Driver {
   virtual void invalidate() {}
   virtual int flush_begin(char& valid_f);
   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 GLContext create_gl_context(Fl_Window* window, const Fl_Gl_Choice* g);
+  GLContext do_create_gl_context(Fl_Window* window, const Fl_Gl_Choice* g,
+                                 int layer);
   virtual void set_gl_context(Fl_Window* w, GLContext context);
   virtual void delete_gl_context(GLContext);
   virtual void make_overlay_current();
diff --git src/drivers/WinAPI/Fl_WinAPI_Gl_Window_Driver.cxx src/drivers/WinAPI/Fl_WinAPI_Gl_Window_Driver.cxx
index ca72d3e..bf5f791 100644
--- src/drivers/WinAPI/Fl_WinAPI_Gl_Window_Driver.cxx
+++ src/drivers/WinAPI/Fl_WinAPI_Gl_Window_Driver.cxx
@@ -128,7 +128,8 @@ Fl_Gl_Choice *Fl_WinAPI_Gl_Window_Driver::find(int m, const int *alistp)
 }
 
 
-GLContext Fl_WinAPI_Gl_Window_Driver::create_gl_context(Fl_Window* window, const Fl_Gl_Choice* g, int layer)
+GLContext Fl_WinAPI_Gl_Window_Driver::do_create_gl_context(Fl_Window* window,
+                      const Fl_Gl_Choice* g, int layer)
 {
   Fl_X* i = Fl_X::i(window);
   HDC hdc = Fl_WinAPI_Window_Driver::driver(window)->private_dc;
@@ -150,6 +151,11 @@ GLContext Fl_WinAPI_Gl_Window_Driver::create_gl_context(Fl_Window* window, const
 }
 
 
+GLContext Fl_WinAPI_Gl_Window_Driver::create_gl_context(Fl_Window* window, const Fl_Gl_Choice* g)
+{
+  do_create_gl_context(window, g, 0);
+}
+
 void Fl_WinAPI_Gl_Window_Driver::set_gl_context(Fl_Window* w, GLContext context) {
   if (context != cached_context || w != cached_window) {
     cached_context = context;
@@ -208,7 +214,7 @@ void Fl_WinAPI_Gl_Window_Driver::gl_hide_before(void *& overlay) {
 void Fl_WinAPI_Gl_Window_Driver::make_overlay(void*&overlay) {
   if (overlay) return;
 
-  GLContext context = create_gl_context(pWindow, g(), 1);
+  GLContext context = do_create_gl_context(pWindow, g(), 1);
   if (!context) {overlay = pWindow; return;} // fake the overlay
 
   HDC hdc = Fl_WinAPI_Window_Driver::driver(pWindow)->private_dc;
diff --git src/drivers/X11/Fl_X11_Gl_Window_Driver.H src/drivers/X11/Fl_X11_Gl_Window_Driver.H
index 8043c04..72c4af1 100644
--- src/drivers/X11/Fl_X11_Gl_Window_Driver.H
+++ src/drivers/X11/Fl_X11_Gl_Window_Driver.H
@@ -33,7 +33,7 @@ class Fl_X11_Gl_Window_Driver : public Fl_Gl_Window_Driver {
   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 GLContext create_gl_context(Fl_Window* window, const Fl_Gl_Choice* g);
   virtual void set_gl_context(Fl_Window* w, GLContext context);
   virtual void delete_gl_context(GLContext);
   virtual void make_overlay_current();
@@ -48,7 +48,7 @@ class Fl_X11_Gl_Window_Driver : public Fl_Gl_Window_Driver {
 #if !USE_XFT
   virtual Fl_Font_Descriptor** fontnum_to_fontdescriptor(int fnum);
 #endif
-  static GLContext create_gl_context(XVisualInfo* vis);
+  //static GLContext create_gl_context(XVisualInfo* vis);
 };
 
 
diff --git src/drivers/X11/Fl_X11_Gl_Window_Driver.cxx src/drivers/X11/Fl_X11_Gl_Window_Driver.cxx
index 90036b9..d0b79a0 100644
--- src/drivers/X11/Fl_X11_Gl_Window_Driver.cxx
+++ src/drivers/X11/Fl_X11_Gl_Window_Driver.cxx
@@ -253,8 +253,9 @@ static int ctxErrorHandler( Display *, XErrorEvent * )
   return 0;
 }
 
-GLContext Fl_X11_Gl_Window_Driver::create_gl_context(Fl_Window* window, const Fl_Gl_Choice* g, int layer) {
-  (void)window; (void)layer;
+GLContext Fl_X11_Gl_Window_Driver::create_gl_context(Fl_Window* window,
+                                                     const Fl_Gl_Choice* g) {
+  (void)window;
   GLContext shared_ctx = 0;
   if (context_list && nContext) shared_ctx = context_list[0];
 
@@ -302,6 +303,7 @@ GLContext Fl_X11_Gl_Window_Driver::create_gl_context(Fl_Window* window, const Fl
   return ctx;
 }
 
+/* This is no longer used
 GLContext Fl_X11_Gl_Window_Driver::create_gl_context(XVisualInfo *vis) {
   GLContext shared_ctx = 0;
   if (context_list && nContext) shared_ctx = context_list[0];
@@ -309,7 +311,7 @@ GLContext Fl_X11_Gl_Window_Driver::create_gl_context(XVisualInfo *vis) {
   if (context)
     add_context(context);
   return context;
-}
+}*/
 
 void Fl_X11_Gl_Window_Driver::set_gl_context(Fl_Window* w, GLContext context) {
   if (context != cached_context || w != cached_window) {
Direct Link to Message ]
 
     
Previous Message ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.