From 0ced7991b4d855538f426e95a2f9eb76ba3dbf0f Mon Sep 17 00:00:00 2001 From: ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> Date: Mon, 6 Oct 2025 17:02:13 +0200 Subject: Doxgen documentation: improve section "Buffer factory" --- documentation/src/wayland.dox | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) (limited to 'documentation/src') diff --git a/documentation/src/wayland.dox b/documentation/src/wayland.dox index 5ade736bf..13c189500 100644 --- a/documentation/src/wayland.dox +++ b/documentation/src/wayland.dox @@ -317,7 +317,7 @@ Here is the list of the \c interface value for all protocols and system features Interface How FLTK uses this interface wl_compositor create wl_surface objects wl_subcompositor create subwindows - wl_shm create buffers and buffer factories + wl_shm create shared memory pools and buffers wl_seat create the unique "seat" wl_data_device support of copy/paste/drag-n-drop wl_output received once for each display @@ -735,21 +735,26 @@ computing and drawing in memory but not on display more lines of the desired Man graph. -\section wayland-buffer-factory Buffer factories +\section wayland-buffer-factory Buffer factory Wayland names buffer factory a software procedure that constructs objects of type -struct wl_buffer for use by a client application. -FLTK creates a \c wl_buffer object each time an Fl_Window is mapped on a display or resized. -That's done by member function \c Fl_Wayland_Graphics_Driver::create_shm_buffer() -which follows this 3-step procedure to create a "buffer factory" for FLTK and to construct -Wayland buffers from it: +struct wl_buffer, that is, Wayland buffers, for use by a client application. +FLTK creates a \c wl_buffer object each time a non-GL Fl_Window is mapped on a display or resized. +FLTK triggers the creation of a Wayland buffer as follows: +
Fl::flush() calls, if the window is damaged:
+  \e Fl_Wayland_Window_Driver::flush() calls, if the window's \c frame_cb is NULL:
+    \e Fl_Wayland_Graphics_Driver::buffer_commit() calls, if the window's \c buffer->wl_buffer is NULL:
+      \e Fl_Wayland_Graphics_Driver::create_shm_buffer() creates a Wayland buffer.
+Member function \c Fl_Wayland_Graphics_Driver::create_shm_buffer() +follows this 3-step procedure to create one or more shared memory pools and to +construct Wayland buffers from them: - Libdecor function libdecor_os_create_anonymous_file(off_t size) creates an adequate file and mmap's it. This file lives in RAM because it is created by function \c memfd_create(). FLTK sets this file size to 10 MB unless the size of the buffer to be created is larger; in that case the anonymous file is sized to twice the buffer size. - Wayland function \c wl_shm_create_pool() shares this mmap'ed memory with the -Wayland compositor and returns an object of type struct wl_shm_pool which -encapsulates this memory. A record of type +Wayland compositor and returns an object of type struct wl_shm_pool, a shared memory pool, +which encapsulates this memory. A record of type struct Fl_Wayland_Graphics_Driver::wld_shm_pool_data is created and associated to the newly created \c wl_shm_pool by \c wl_shm_pool_set_user_data(). This record stores the starting address (\c pool_memory) and size (\c pool_size) of the pool's encapsulated -- cgit v1.2.3