FLTK logo

[master] feac10e - Wayland: reduce the number of platform-specific FL_EXPORT directives.

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] feac10e - Wayland: reduce the number of platform-specific FL_EXPORT directives. "ManoloFLTK" Aug 25, 2022  
 
commit feac10ec891470be6f66afe412b0bbd44eb586e0
Author:     ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>
AuthorDate: Thu Aug 25 10:42:58 2022 +0200
Commit:     ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>
CommitDate: Thu Aug 25 10:42:58 2022 +0200

    Wayland: reduce the number of platform-specific FL_EXPORT directives.

 src/drivers/Wayland/Fl_Wayland_Gl_Window_Driver.cxx | 21 +++++++++------------
 src/drivers/Wayland/Fl_Wayland_Screen_Driver.H      |  2 +-
 src/drivers/Wayland/Fl_Wayland_Window_Driver.H      |  2 +-
 3 files changed, 11 insertions(+), 14 deletions(-)

diff --git src/drivers/Wayland/Fl_Wayland_Gl_Window_Driver.cxx src/drivers/Wayland/Fl_Wayland_Gl_Window_Driver.cxx
index 598a412..979cef3 100644
--- src/drivers/Wayland/Fl_Wayland_Gl_Window_Driver.cxx
+++ src/drivers/Wayland/Fl_Wayland_Gl_Window_Driver.cxx
@@ -71,8 +71,8 @@ Fl_Wayland_Gl_Window_Driver::Fl_Wayland_Gl_Window_Driver(Fl_Gl_Window *win) : Fl
 void Fl_Wayland_Gl_Window_Driver::init() {
   EGLint major, minor;
 
-  if (!Fl_Wayland_Screen_Driver::wl_display) fl_open_display();
-  egl_display = eglGetDisplay((EGLNativeDisplayType) Fl_Wayland_Screen_Driver::wl_display);
+  if (!fl_wl_display()) fl_open_display();
+  egl_display = eglGetDisplay((EGLNativeDisplayType) fl_wl_display());
   if (egl_display == EGL_NO_DISPLAY) {
     Fl::fatal("Can't create egl display\n");
   }
@@ -86,17 +86,14 @@ void Fl_Wayland_Gl_Window_Driver::init() {
   //printf("EGL has %d configs\n", configs_count);
   eglBindAPI(EGL_OPENGL_API);
 
-  gl_event_queue = wl_display_create_queue(Fl_Wayland_Screen_Driver::wl_display);
+  gl_event_queue = wl_display_create_queue(fl_wl_display());
 }
 
 
 char *Fl_Wayland_Gl_Window_Driver::alpha_mask_for_string(const char *str, int n, int w, int h, Fl_Fontsize fs)
 {
   // write str to a bitmap just big enough
-  struct wld_window *save_win = Fl_Wayland_Window_Driver::wld_window;
-  fl_window = Fl_Wayland_Window_Driver::wld_window = NULL;
   Fl_Image_Surface *surf = new Fl_Image_Surface(w, h);
-  fl_window = Fl_Wayland_Window_Driver::wld_window = save_win;
   Fl_Font f=fl_font();
   Fl_Surface_Device::push_current(surf);
   fl_color(FL_BLACK);
@@ -264,8 +261,8 @@ void Fl_Wayland_Gl_Window_Driver::make_current_before() {
     // Tested apps: shape, glpuzzle, cube, fractals, gl_overlay, fullscreen, unittests,
     //   OpenGL3-glut-test, OpenGL3test.
     // Tested wayland compositors: mutter, kde-plasma, weston, sway on FreeBSD.
-    wl_display_roundtrip(Fl_Wayland_Screen_Driver::wl_display);
-    wl_display_roundtrip(Fl_Wayland_Screen_Driver::wl_display);
+    wl_display_roundtrip(fl_wl_display());
+    wl_display_roundtrip(fl_wl_display());
   }
 }
 
@@ -319,11 +316,11 @@ void Fl_Wayland_Gl_Window_Driver::swap_buffers() {
   if (egl_surface && !egl_swap_in_progress) {
     egl_swap_in_progress = true;
     //eglSwapInterval(egl_display, 0); // doesn't seem to have any effect in this context
-    while (wl_display_prepare_read(Fl_Wayland_Screen_Driver::wl_display) != 0) {
-      wl_display_dispatch_pending(Fl_Wayland_Screen_Driver::wl_display);
+    while (wl_display_prepare_read(fl_wl_display()) != 0) {
+      wl_display_dispatch_pending(fl_wl_display());
     }
-    wl_display_read_events(Fl_Wayland_Screen_Driver::wl_display);
-    wl_display_dispatch_queue_pending(Fl_Wayland_Screen_Driver::wl_display,  gl_event_queue);
+    wl_display_read_events(fl_wl_display());
+    wl_display_dispatch_queue_pending(fl_wl_display(),  gl_event_queue);
     eglSwapBuffers(Fl_Wayland_Gl_Window_Driver::egl_display, egl_surface);
     egl_swap_in_progress = false;
   }
diff --git src/drivers/Wayland/Fl_Wayland_Screen_Driver.H src/drivers/Wayland/Fl_Wayland_Screen_Driver.H
index 0dbdb08..196f07d 100644
--- src/drivers/Wayland/Fl_Wayland_Screen_Driver.H
+++ src/drivers/Wayland/Fl_Wayland_Screen_Driver.H
@@ -63,7 +63,7 @@ class Fl_Wayland_Screen_Driver : public Fl_Screen_Driver
   static int insertion_point_height;
   static bool insertion_point_location_is_valid;
 public:
-  static FL_EXPORT struct wl_display *wl_display;
+  static struct wl_display *wl_display;
   static void insertion_point_location(int x, int y, int height);
   static bool insertion_point_location(int *px, int *py, int *pwidth, int *pheight);
   int get_mouse_unscaled(int &xx, int &yy);
diff --git src/drivers/Wayland/Fl_Wayland_Window_Driver.H src/drivers/Wayland/Fl_Wayland_Window_Driver.H
index fc84bf1..a419fa5 100644
--- src/drivers/Wayland/Fl_Wayland_Window_Driver.H
+++ src/drivers/Wayland/Fl_Wayland_Window_Driver.H
@@ -84,7 +84,7 @@ public:
   struct xdg_toplevel *xdg_toplevel();
   Fl_Wayland_Window_Driver(Fl_Window*);
   virtual ~Fl_Wayland_Window_Driver();
-  static FL_EXPORT struct wld_window *wld_window;
+  static struct wld_window *wld_window;
   static void redraw(struct wld_window *window);
 
   static inline Fl_Wayland_Window_Driver* driver(const Fl_Window *w) {return (Fl_Wayland_Window_Driver*)Fl_Window_Driver::driver(w);}
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'.