lv_wl_backend_private.h¶
Typedefs
-
typedef void *(*lv_wayland_backend_init_t)(void)¶
Initialize the backend context.
This function is called once when the Wayland driver is initialized to create the global backend context. The returned pointer will be passed as backend_ctx to all other backend operations.
See also
Note
This is called before any displays are created
- Return:
Pointer to backend-specific context data, or NULL on failure
-
typedef void (*lv_wayland_backend_deinit_t)(void *backend_ctx)¶
Deinitialize the backend context.
This function is called when the Wayland driver is deinitialized. It must clean up all resources allocated in the init function and free the backend context.
See also
Note
This is called after all displays have been destroyed
- Param backend_ctx:
[in] Pointer to the backend context returned by init
-
typedef void *(*lv_wayland_backend_init_display_t)(void *backend_ctx, lv_display_t *display, int32_t width, int32_t height)¶
Initialize a new display.
This function is called when creating a new LVGL display on Wayland. It should allocate and initialize per-display resources needed for rendering.
Note
The returned pointer can be retrieved later using lv_wayland_get_backend_display_data()
Note
It is expected that each display gets its own data structure in order for a backend to support multiple displays
- Param backend_ctx:
[in] Pointer to the backend context
- Param display:
[in] Pointer to the LVGL display object
- Param width:
[in] Initial width of the display in pixels
- Param height:
[in] Initial height of the display in pixels
- Return:
Pointer to display-specific data, or NULL on failure
-
typedef void *(*lv_wayland_backend_resize_display_t)(void *backend_ctx, lv_display_t *display)¶
Resize or reconfigure a display.
This function is called when a display needs to be resized or when its rotation is modified. The backend should update its rendering resources accordingly.
Note
This may be called multiple times during a display's lifetime
Note
The returned pointer will replace the previous display data. It can be retrieved using lv_wayland_get_backend_display_data()
Warning
The display data is overwritten with the return value of this function
- Param backend_ctx:
[in] Pointer to the backend context
- Param display:
[in] Pointer to the LVGL display object being resized
- Return:
Pointer to updated display-specific data, or NULL on failure
-
typedef void (*lv_wayland_backend_destroy_display_t)(void *backend_ctx, lv_display_t *display)¶
Destroy a display.
This function is called when an LVGL display is being destroyed. It must clean up all per-display resources and free the display data that was allocated in init_display.
Note
The display data associated with this display must be freed
- Param backend_ctx:
[in] Pointer to the backend context
- Param display:
[in] Pointer to the LVGL display object being destroyed
-
typedef void (*lv_wayland_backend_global_handler_t)(void *backend_ctx, struct wl_registry *registry, uint32_t name, const char *interface, uint32_t version)¶
Handle Wayland global objects.
This function is called for every global object advertised by the Wayland compositor. The backend can use this to bind to Wayland protocols it requires (e.g., wl_shm, EGL extensions, DMA-BUF protocols, etc.).
Note
This is called during Wayland connection setup
Note
The backend should use wl_registry_bind() to bind to needed protocols
- Param backend_ctx:
[in] Pointer to the backend context
- Param registry:
[in] Wayland registry object
- Param name:
[in] Numeric name of the global object
- Param interface:
[in] String name of the interface (e.g., "wl_shm")
- Param version:
[in] Version number of the interface
Functions
-
void *lv_wayland_get_backend_display_data(lv_display_t *display)¶
Get the backend-specific display data.
Retrieves the per-display data pointer that was returned by the backend's init_display/resize_display functions. This allows the backend to access its own display-specific state and resources.
See also
Note
This returns the value that was returned by lv_wayland_backend_init_display_t or lv_wayland_backend_resize_display_t
- Parameters:
display – [in] Pointer to the LVGL display object
- Returns:
Pointer to backend-specific display data
-
struct wl_surface *lv_wayland_get_window_surface(lv_display_t *display)¶
Get the Wayland surface for rendering.
Retrieves the wl_surface object associated with the display window. This is the surface that the backend must use for all rendering operations (attaching buffers, committing frames, etc.).
Note
This surface is managed by the Wayland driver and must not be destroyed by the backend
Note
All rendering output should be attached to this surface
- Parameters:
display – [in] Pointer to the LVGL display object
- Returns:
Pointer to the Wayland surface for rendering, or NULL if not available
Variables
-
const lv_wayland_backend_ops_t wl_backend_ops¶
-
struct lv_wayland_backend_ops_t¶
- #include <lv_wl_backend_private.h>
Wayland backend operations structure.
This structure defines the complete set of operations that a Wayland backend must implement. All function pointers must be non-NULL.
- Lifecycle Order:
init() - Initialize backend context
global_handler() - Called for each Wayland global (may be called multiple times)
init_display() - Create display (may be called multiple times for multiple displays)
resize_display() - Resize display (called as needed)
deinit_display() - Destroy display (called once per display)
deinit() - Clean up backend context
Public Members
-
lv_wayland_backend_init_t init¶
Initialize backend context
-
lv_wayland_backend_global_handler_t global_handler¶
Handle Wayland global objects
-
lv_wayland_backend_init_display_t init_display¶
Initialize a new display
-
lv_wayland_backend_resize_display_t resize_display¶
Resize or reconfigure display
-
lv_wayland_backend_destroy_display_t deinit_display¶
Destroy a display
-
lv_wayland_backend_deinit_t deinit¶
Deinitialize backend context