diff options
| author | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2022-12-09 17:06:35 +0100 |
|---|---|---|
| committer | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2022-12-09 17:06:35 +0100 |
| commit | eb2572deaf06548671059de59351eaff13e92a6e (patch) | |
| tree | 2e4cd4cf1f4659e68170fa8f21c9dd2aad059b53 | |
| parent | 632661fa647e5ce932bd87c8ea6f8035a8bdd264 (diff) | |
Add new Wayland-specific fl_wl_compositor() function
| -rw-r--r-- | FL/wayland.H | 9 | ||||
| -rw-r--r-- | documentation/src/osissues.dox | 2 | ||||
| -rw-r--r-- | src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx | 6 |
3 files changed, 16 insertions, 1 deletions
diff --git a/FL/wayland.H b/FL/wayland.H index d5aabab03..6c7cf2d48 100644 --- a/FL/wayland.H +++ b/FL/wayland.H @@ -19,7 +19,7 @@ #endif // !FL_PLATFORM_H /** \file - Definitions of functions specific to the Wayland platform. + \anchor wayland_H Definitions of functions specific to the Wayland platform. */ // *********** for Wayland component *********** @@ -36,6 +36,13 @@ extern FL_EXPORT struct wld_window *fl_wl_xid(const Fl_Window *win); extern FL_EXPORT Fl_Window *fl_wl_find(struct wld_window *); /** Returns the cairo context associated to the current window*/ extern FL_EXPORT cairo_t *fl_wl_cairo(); +/** Returns the wl_compositor of the current Wayland session. + This allows, for example, to create a wl_surface with + \code + struct wl_surface *my_wl_surface = wl_compositor_create_surface(fl_wl_compositor()); + \endcode + */ +extern FL_EXPORT struct wl_compositor *fl_wl_compositor(); typedef void *EGLContext; /** Returns the EGLContext corresponding to the given GLContext */ extern FL_EXPORT EGLContext fl_wl_glcontext(GLContext rc); diff --git a/documentation/src/osissues.dox b/documentation/src/osissues.dox index e7c88cd5d..557a5f2e3 100644 --- a/documentation/src/osissues.dox +++ b/documentation/src/osissues.dox @@ -982,6 +982,8 @@ this to exit. It may be useful to call this if you want your program to continue without the Wayland connection. You cannot open the display again, and cannot call any FLTK functions. +\see \ref wayland_H "wayland.H" for all functions specific of the Wayland platform. + \subsection osissues_wayland_scaling HiDPI display support FLTK Wayland apps automatically scale according to the Wayland-defined, integer-valued scale factor. On a HiDPI display, it's enough to set this factor to 2 for diff --git a/src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx b/src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx index 5291f80b0..560756870 100644 --- a/src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx +++ b/src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx @@ -1573,6 +1573,12 @@ struct wld_window *fl_wl_xid(const Fl_Window *win) { } +struct wl_compositor *fl_wl_compositor() { + Fl_Wayland_Screen_Driver *screen_driver = (Fl_Wayland_Screen_Driver*)Fl::screen_driver(); + return screen_driver->wl_compositor; +} + + Fl_Wayland_Plugin *Fl_Wayland_Window_Driver::gl_plugin() { static Fl_Wayland_Plugin *plugin = NULL; if (!plugin) { |
