diff options
| author | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2022-08-20 17:26:02 +0200 |
|---|---|---|
| committer | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2022-08-20 17:26:02 +0200 |
| commit | d5a1e7feb98f0d3efc17ea755a5f94d008cd4f80 (patch) | |
| tree | e1e2d4d00815f278588c17ac108cc66c14c3f2c8 /src/drivers | |
| parent | 7deff86b5d70ca3f8a1ed4cbbc251c7fa31444dd (diff) | |
Add static Fl_Wayland_Window_Driver::gl_plugin() member function.
Diffstat (limited to 'src/drivers')
| -rw-r--r-- | src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx | 3 | ||||
| -rw-r--r-- | src/drivers/Wayland/Fl_Wayland_Window_Driver.H | 3 | ||||
| -rw-r--r-- | src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx | 30 |
3 files changed, 17 insertions, 19 deletions
diff --git a/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx b/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx index 57d43c63c..6a185ed79 100644 --- a/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx +++ b/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx @@ -1115,8 +1115,7 @@ void Fl_Wayland_Screen_Driver::open_display_platform() { } void Fl_Wayland_Screen_Driver::close_display() { - Fl_Plugin_Manager pm("wayland.fltk.org"); - Fl_Wayland_Plugin *plugin = (Fl_Wayland_Plugin*)pm.plugin("gl.wayland.fltk.org"); + Fl_Wayland_Plugin *plugin = Fl_Wayland_Window_Driver::gl_plugin(); if (plugin) plugin->terminate(); Fl::remove_fd(wl_display_get_fd(Fl_Wayland_Screen_Driver::wl_display)); diff --git a/src/drivers/Wayland/Fl_Wayland_Window_Driver.H b/src/drivers/Wayland/Fl_Wayland_Window_Driver.H index 2a76b86ce..a419fa54b 100644 --- a/src/drivers/Wayland/Fl_Wayland_Window_Driver.H +++ b/src/drivers/Wayland/Fl_Wayland_Window_Driver.H @@ -41,12 +41,14 @@ */ typedef struct _cairo_pattern cairo_pattern_t; +class Fl_Wayland_Plugin; class Fl_Wayland_Window_Driver : public Fl_Window_Driver { friend class Fl_X; friend class Fl_Wayland_Gl_Window_Driver; + friend class Fl_Wayland_Screen_Driver; private: struct shape_data_type { int lw_; ///< width of shape image @@ -55,6 +57,7 @@ private: cairo_pattern_t *mask_pattern_; } *shape_data_; static bool in_flush; // useful for progressive window drawing + static Fl_Wayland_Plugin *gl_plugin(); struct wl_cursor *cursor_; void delete_cursor_(); struct gl_start_support *gl_start_support_; // for support of gl_start/gl_finish diff --git a/src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx b/src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx index d9b6d1486..b935fe604 100644 --- a/src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx +++ b/src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx @@ -98,14 +98,7 @@ Fl_Wayland_Window_Driver::~Fl_Wayland_Window_Driver() } delete_cursor_(); if (gl_start_support_) { // occurs only if gl_start/gl_finish was used - static Fl_Wayland_Plugin *plugin = NULL; - if (!plugin) { - Fl_Plugin_Manager pm("wayland.fltk.org"); - plugin = (Fl_Wayland_Plugin*)pm.plugin("gl.wayland.fltk.org"); - } - if (plugin) { - plugin->destroy(gl_start_support_); - } + gl_plugin()->destroy(gl_start_support_); } } @@ -388,15 +381,8 @@ void Fl_Wayland_Window_Driver::flush() { Fl_Wayland_Window_Driver::in_flush = true; Fl_Window_Driver::flush(); Fl_Wayland_Window_Driver::in_flush = false; - static Fl_Wayland_Plugin *plugin = NULL; - if (!plugin) { - Fl_Plugin_Manager pm("wayland.fltk.org"); - plugin = (Fl_Wayland_Plugin*)pm.plugin("gl.wayland.fltk.org"); - } - if (plugin) { - plugin->do_swap(pWindow); // useful only for GL win with overlay - if (scale != fl_graphics_driver->scale() || W != pWindow->w() || H != pWindow->h()) plugin->invalidate(pWindow); - } + gl_plugin()->do_swap(pWindow); // useful only for GL win with overlay + if (scale != fl_graphics_driver->scale() || W != pWindow->w() || H != pWindow->h()) gl_plugin()->invalidate(pWindow); return; } struct wld_window *window = fl_xid(pWindow); @@ -1531,3 +1517,13 @@ cairo_t *fl_wl_cairo() { struct wl_display *fl_wl_display() { return Fl_Wayland_Screen_Driver::wl_display; } + + +Fl_Wayland_Plugin *Fl_Wayland_Window_Driver::gl_plugin() { + static Fl_Wayland_Plugin *plugin = NULL; + if (!plugin) { + Fl_Plugin_Manager pm("wayland.fltk.org"); + plugin = (Fl_Wayland_Plugin*)pm.plugin("gl.wayland.fltk.org"); + } + return plugin; +} |
