feat(wayland): remove deprecated WL_SHELL (#8877)

This commit is contained in:
André Costa
2025-09-18 14:13:01 +02:00
committed by GitHub
parent 9c75f16b75
commit 3e94b4d1d4
15 changed files with 1 additions and 301 deletions
-4
View File
@@ -1881,10 +1881,6 @@ menu "LVGL configuration"
bool "Draw client side window decorations, only necessary on Mutter (GNOME)"
depends on LV_USE_WAYLAND
default n
config LV_WAYLAND_WL_SHELL
bool "Support the legacy wl_shell instead of the default XDG Shell protocol"
depends on LV_USE_WAYLAND
default n
config LV_WAYLAND_BUF_COUNT
int "Use 1 for single buffer with partial render mode or 2 for double buffer with full render mode"
depends on LV_USE_WAYLAND
@@ -71,16 +71,10 @@ Some optional settings depend on whether DMA buffer support is enabled (`LV_WAYL
- `1` or `0`
- `0`
* - `LV_WAYLAND_WL_SHELL` (**Deprecated**)
- Optional (`1` or `0`)
- Optional (`1` or `0`)
Additional notes
* DMABUF support (`LV_WAYLAND_USE_DMABUF`) improves performance and enables more render modes but has specific requirements and restrictions.
* `LV_WAYLAND_WINDOW_DECORATIONS` is only required for some compositors (e.g., GNOME/Mutter or Weston).
* `LV_WAYLAND_WL_SHELL` Enables support for the deprecated `wl_shell`. Only useful when the BSP on the target has weston ``9.x``. (**Deprecated** and will be removed in a future release)
Example
-------
-1
View File
@@ -1117,7 +1117,6 @@
#define LV_USE_WAYLAND 0
#if LV_USE_WAYLAND
#define LV_WAYLAND_WINDOW_DECORATIONS 0 /**< Draw client side window decorations only necessary on Mutter/GNOME */
#define LV_WAYLAND_WL_SHELL 0 /**< Use the legacy wl_shell protocol instead of the default XDG shell */
#endif
/** Driver for /dev/fb */
-1
View File
@@ -1251,7 +1251,6 @@
#define LV_WAYLAND_RENDER_MODE LV_DISPLAY_RENDER_MODE_PARTIAL /**< DMABUF supports LV_DISPLAY_RENDER_MODE_FULL and LV_DISPLAY_RENDER_MODE_DIRECT*/
/**< When LV_WAYLAND_USE_DMABUF is disabled, only LV_DISPLAY_RENDER_MODE_PARTIAL is supported*/
#define LV_WAYLAND_WINDOW_DECORATIONS 0 /**< Draw client side window decorations only necessary on Mutter/GNOME. Not supported using DMABUF*/
#define LV_WAYLAND_WL_SHELL 0 /**< Use the legacy wl_shell protocol instead of the default XDG shell*/
#endif
/** Driver for /dev/fb */
-1
View File
@@ -212,7 +212,6 @@ LV_EXPORT_CONST_INT(LV_DRAW_BUF_ALIGN);
#if LV_USE_WAYLAND == 0
#define LV_WAYLAND_USE_DMABUF 0
#define LV_WAYLAND_WINDOW_DECORATIONS 0
#define LV_WAYLAND_WL_SHELL 0
#endif /* LV_USE_WAYLAND */
#if LV_USE_LINUX_DRM == 0
-11
View File
@@ -282,11 +282,7 @@ void lv_wayland_deinit(void)
lv_wayland_dmabuf_deinit(&lv_wl_ctx.dmabuf_ctx);
#endif
#if LV_WAYLAND_WL_SHELL
lv_wayland_wl_shell_deinit();
#elif LV_WAYLAND_XDG_SHELL
lv_wayland_xdg_shell_deinit();
#endif
if(lv_wl_ctx.wl_seat) {
wl_seat_destroy(lv_wl_ctx.wl_seat);
@@ -355,18 +351,11 @@ static void handle_global(void * data, struct wl_registry * registry, uint32_t n
app->wl_seat = wl_registry_bind(app->registry, name, &wl_seat_interface, 1);
wl_seat_add_listener(app->wl_seat, lv_wayland_seat_get_listener(), app);
}
#if LV_WAYLAND_WL_SHELL
else if(strcmp(interface, wl_shell_interface.name) == 0) {
app->wl_shell = wl_registry_bind(registry, name, &wl_shell_interface, 1);
}
#endif
#if LV_WAYLAND_XDG_SHELL
else if(strcmp(interface, xdg_wm_base_interface.name) == 0) {
/* supporting version 2 of the XDG protocol - ensures greater compatibility */
app->xdg_wm = wl_registry_bind(app->registry, name, &xdg_wm_base_interface, 2);
xdg_wm_base_add_listener(app->xdg_wm, lv_wayland_xdg_shell_get_wm_base_listener(), app);
}
#endif
#if LV_WAYLAND_USE_DMABUF
else if(strcmp(interface, zwp_linux_dmabuf_v1_interface.name) == 0) {
lv_wayland_dmabuf_set_interface(&app->dmabuf_ctx, app->registry, name, interface, version);
+1 -34
View File
@@ -21,12 +21,7 @@ extern "C" {
#include "lv_wayland_smm.h"
#include <sys/poll.h>
#include <wayland-client-protocol.h>
#if !LV_WAYLAND_WL_SHELL
#include "wayland_xdg_shell.h"
#define LV_WAYLAND_XDG_SHELL 1
#else
#define LV_WAYLAND_XDG_SHELL 0
#endif
#include <wayland_xdg_shell.h>
#if LV_WAYLAND_USE_DMABUF
#include <sys/mman.h>
@@ -67,10 +62,8 @@ extern "C" {
enum object_type {
OBJECT_TITLEBAR = 0,
OBJECT_BUTTON_CLOSE,
#if LV_WAYLAND_XDG_SHELL
OBJECT_BUTTON_MAXIMIZE,
OBJECT_BUTTON_MINIMIZE,
#endif
OBJECT_BORDER_TOP,
OBJECT_BORDER_BOTTOM,
OBJECT_BORDER_LEFT,
@@ -164,13 +157,7 @@ struct lv_wayland_context {
dmabuf_ctx_t dmabuf_ctx;
#endif
#if LV_WAYLAND_WL_SHELL
struct wl_shell * wl_shell;
#endif
#if LV_WAYLAND_XDG_SHELL
struct xdg_wm_base * xdg_wm;
#endif
#ifdef LV_WAYLAND_WINDOW_DECORATIONS
bool opt_disable_decorations;
@@ -202,15 +189,9 @@ struct window {
struct lv_wayland_context * wl_ctx;
#if LV_WAYLAND_WL_SHELL
struct wl_shell_surface * wl_shell_surface;
#endif
#if LV_WAYLAND_XDG_SHELL
struct xdg_surface * xdg_surface;
struct xdg_toplevel * xdg_toplevel;
uint32_t wm_capabilities;
#endif
struct graphic_object * body;
struct {
@@ -306,19 +287,6 @@ void lv_wayland_window_decoration_detach(struct window * window, struct graphic_
* Window Management
**********************/
#if LV_WAYLAND_WL_SHELL
lv_result_t lv_wayland_wl_shell_create_window(struct lv_wayland_context * app, struct window * window,
const char * title);
const struct wl_shell_surface_listener * lv_wayland_wl_shell_get_listener(void);
void lv_wayland_wl_shell_handle_pointer_event(struct lv_wayland_context * app, uint32_t serial, uint32_t button,
uint32_t state);
lv_result_t lv_wayland_wl_shell_set_maximized(struct window * window, bool maximized);
lv_result_t lv_wayland_wl_shell_set_minimized(struct window * window);
lv_result_t lv_wayland_wl_shell_set_fullscreen(struct window * window, bool fullscreen);
lv_result_t lv_wayland_wl_shell_destroy_window(struct window * window);
void lv_wayland_wl_shell_deinit(void);
#elif LV_WAYLAND_XDG_SHELL
const struct xdg_surface_listener * lv_wayland_xdg_shell_get_surface_listener(void);
const struct xdg_toplevel_listener * lv_wayland_xdg_shell_get_toplevel_listener(void);
const struct xdg_wm_base_listener * lv_wayland_xdg_shell_get_wm_base_listener(void);
@@ -338,7 +306,6 @@ void lv_wayland_xdg_shell_handle_pointer_event(struct lv_wayland_context * app,
const char * lv_wayland_xdg_shell_get_cursor_name(const struct lv_wayland_context * app);
void lv_wayland_xdg_shell_deinit(void);
#endif
/**********************
* SHM
-6
View File
@@ -129,9 +129,7 @@ static void pointer_handle_enter(void * data, struct wl_pointer * pointer, uint3
app->pointer_obj->input.pointer.x = pos_x;
app->pointer_obj->input.pointer.y = pos_y;
#if LV_WAYLAND_XDG_SHELL
cursor = lv_wayland_xdg_shell_get_cursor_name(app);
#endif
if(app->cursor_surface) {
struct wl_cursor_image * cursor_image = wl_cursor_theme_get_cursor(app->cursor_theme, cursor)->images[0];
@@ -187,11 +185,7 @@ static void pointer_handle_button(void * data, struct wl_pointer * wl_pointer, u
}
struct window * window = app->pointer_obj->window;
#if LV_WAYLAND_WL_SHELL
lv_wayland_wl_shell_handle_pointer_event(app, serial, button, state);
#elif LV_WAYLAND_XDG_SHELL
lv_wayland_xdg_shell_handle_pointer_event(app, serial, button, state);
#endif
switch(app->pointer_obj->type) {
case OBJECT_WINDOW:
-184
View File
@@ -1,184 +0,0 @@
/**
* @file lv_wl_shell.c
*
*/
/*********************
* INCLUDES
*********************/
#include "lv_wayland.h"
#if LV_WAYLAND_WL_SHELL
/* WL_SHELL has been deprecated for 3 years now */
#warning LV_WAYLAND_WL_SHELL is deprecated and will be removed in a future release
#include "lv_wayland_private.h"
#include <linux/input-event-codes.h>
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**********************
* STATIC PROTOTYPES
**********************/
static void wl_shell_handle_ping(void * data, struct wl_shell_surface * shell_surface, uint32_t serial);
static void wl_shell_handle_configure(void * data, struct wl_shell_surface * shell_surface, uint32_t edges,
int32_t width, int32_t height);
/**********************
* STATIC VARIABLES
**********************/
static const struct wl_shell_surface_listener shell_surface_listener = {
.ping = wl_shell_handle_ping,
.configure = wl_shell_handle_configure,
};
/**********************
* MACROS
**********************/
/**********************
* GLOBAL FUNCTIONS
**********************/
/**********************
* PRIVATE FUNCTIONS
**********************/
void lv_wayland_wl_shell_deinit(void)
{
if(lv_wl_ctx.wl_shell) {
wl_shell_destroy(lv_wl_ctx.wl_shell);
}
}
const struct wl_shell_surface_listener * lv_wayland_wl_shell_get_listener(void)
{
return &shell_surface_listener;
}
lv_result_t lv_wayland_wl_shell_create_window(struct lv_wayland_context * ctx, struct window * window,
const char * title)
{
if(!ctx->wl_shell) {
return LV_RESULT_INVALID;
}
window->wl_shell_surface = wl_shell_get_shell_surface(ctx->wl_shell, window->body->surface);
if(!window->wl_shell_surface) {
LV_LOG_ERROR("cannot create WL shell surface");
return LV_RESULT_INVALID;
}
wl_shell_surface_add_listener(window->wl_shell_surface, lv_wayland_wl_shell_get_listener(), window);
wl_shell_surface_set_toplevel(window->wl_shell_surface);
wl_shell_surface_set_title(window->wl_shell_surface, title);
/* For wl_shell, just draw the window, weston doesn't send it */
lv_wayland_window_draw(window, window->width, window->height);
return LV_RESULT_OK;
}
lv_result_t lv_wayland_wl_shell_set_maximized(struct window * window, bool maximized)
{
if(!window->wl_shell_surface) {
return LV_RESULT_INVALID;
}
if(maximized) {
LV_LOG_ERROR("WL_SHELL - Unsupported operation - Maximization");
return LV_RESULT_INVALID;
}
else {
wl_shell_surface_set_toplevel(window->wl_shell_surface);
}
return LV_RESULT_OK;
}
lv_result_t lv_wayland_wl_shell_set_minimized(struct window * window)
{
LV_LOG_ERROR("WL_SHELL - Unsupported operation - Minization");
return LV_RESULT_INVALID;
}
lv_result_t lv_wayland_wl_shell_set_fullscreen(struct window * window, bool fullscreen)
{
if(!window->wl_shell_surface) {
return LV_RESULT_INVALID;
}
if(fullscreen) {
wl_shell_surface_set_fullscreen(window->wl_shell_surface, WL_SHELL_SURFACE_FULLSCREEN_METHOD_SCALE, 0, NULL);
}
else {
wl_shell_surface_set_toplevel(window->wl_shell_surface);
}
return LV_RESULT_OK;
}
lv_result_t lv_wayland_wl_shell_destroy_window(struct window * window)
{
if(!window->wl_shell_surface) {
return LV_RESULT_INVALID;
}
wl_shell_surface_destroy(window->wl_shell_surface);
return LV_RESULT_OK;
}
void lv_wayland_wl_shell_handle_pointer_event(struct lv_wayland_context * ctx, uint32_t serial, uint32_t button,
uint32_t state)
{
struct window * window = ctx->pointer_obj->window;
switch(ctx->pointer_obj->type) {
case OBJECT_TITLEBAR:
if((button == BTN_LEFT) && (state == WL_POINTER_BUTTON_STATE_PRESSED)) {
if(window->wl_shell_surface) {
wl_shell_surface_move(window->wl_shell_surface, ctx->wl_seat, serial);
window->flush_pending = true;
}
}
break;
case OBJECT_BUTTON_CLOSE:
case OBJECT_BORDER_TOP:
case OBJECT_BORDER_BOTTOM:
case OBJECT_BORDER_LEFT:
case OBJECT_BORDER_RIGHT:
case OBJECT_WINDOW:
break;
}
}
/**********************
* STATIC FUNCTIONS
**********************/
static void wl_shell_handle_ping(void * data, struct wl_shell_surface * shell_surface, uint32_t serial)
{
return wl_shell_surface_pong(shell_surface, serial);
}
static void wl_shell_handle_configure(void * data, struct wl_shell_surface * shell_surface, uint32_t edges,
int32_t width, int32_t height)
{
struct window * window = (struct window *)data;
LV_UNUSED(edges);
if((width <= 0) || (height <= 0)) {
return;
}
else if((width != window->width) || (height != window->height)) {
window->resize_width = width;
window->resize_height = height;
window->resize_pending = true;
}
}
#endif /* LV_WAYLAND_WL_SHELL */
-10
View File
@@ -169,18 +169,10 @@ static void touch_handle_down(void * data, struct wl_touch * wl_touch, uint32_t
struct window * window = app->touch_obj->window;
switch(app->touch_obj->type) {
case OBJECT_TITLEBAR:
#if LV_WAYLAND_XDG_SHELL
if(window->xdg_toplevel) {
xdg_toplevel_move(window->xdg_toplevel, app->wl_seat, serial);
window->flush_pending = true;
}
#endif
#if LV_WAYLAND_WL_SHELL
if(window->wl_shell_surface) {
wl_shell_surface_move(window->wl_shell_surface, app->wl_seat, serial);
window->flush_pending = true;
}
#endif
break;
default:
break;
@@ -221,7 +213,6 @@ static void touch_handle_up(void * data, struct wl_touch * wl_touch, uint32_t se
case OBJECT_BUTTON_CLOSE:
window->shall_close = true;
break;
#if LV_WAYLAND_XDG_SHELL
case OBJECT_BUTTON_MAXIMIZE:
if(window->xdg_toplevel) {
if(window->maximized) {
@@ -238,7 +229,6 @@ static void touch_handle_up(void * data, struct wl_touch * wl_touch, uint32_t se
xdg_toplevel_set_minimized(window->xdg_toplevel);
window->flush_pending = true;
}
#endif /* LV_WAYLAND_XDG_SHELL */
default:
break;
}
-21
View File
@@ -210,11 +210,7 @@ void lv_wayland_window_set_maximized(lv_display_t * disp, bool maximized)
}
if(window->maximized != maximized) {
#if LV_WAYLAND_WL_SHELL
err = lv_wayland_wl_shell_set_maximized(window, maximized);
#elif LV_WAYLAND_XDG_SHELL
err = lv_wayland_xdg_shell_set_maximized(window, maximized);
#endif
}
if(err == LV_RESULT_INVALID) {
@@ -237,11 +233,7 @@ void lv_wayland_window_set_fullscreen(lv_display_t * disp, bool fullscreen)
if(window->fullscreen == fullscreen) {
return;
}
#if LV_WAYLAND_WL_SHELL
err = lv_wayland_wl_shell_set_fullscreen(window, fullscreen);
#elif LV_WAYLAND_XDG_SHELL
err = lv_wayland_xdg_shell_set_fullscreen(window, fullscreen);
#endif
if(err == LV_RESULT_INVALID) {
LV_LOG_WARN("Failed to set wayland window to fullscreen");
@@ -274,9 +266,7 @@ void lv_wayland_window_draw(struct window * window, uint32_t width, uint32_t hei
/* First resize */
if(lv_wayland_window_resize(window, width, height) != LV_RESULT_OK) {
LV_LOG_ERROR("Failed to resize window");
#if LV_WAYLAND_XDG_SHELL
lv_wayland_xdg_shell_destroy_window_toplevel(window);
#endif
}
lv_refr_now(window->lv_disp);
@@ -335,12 +325,8 @@ void lv_wayland_window_destroy(struct window * window)
return;
}
#if LV_WAYLAND_WL_SHELL
lv_wayland_wl_shell_destroy_window(window);
#elif LV_WAYLAND_XDG_SHELL
lv_wayland_xdg_shell_destroy_window_toplevel(window);
lv_wayland_xdg_shell_destroy_window_surface(window);
#endif
#if LV_WAYLAND_WINDOW_DECORATIONS
for(size_t i = 0; i < NUM_DECORATIONS; i++) {
@@ -387,16 +373,9 @@ static struct window * create_window(struct lv_wayland_context * app, int width,
goto err_free_window;
}
#if LV_WAYLAND_WL_SHELL
if(lv_wayland_wl_shell_create_window(app, window, title) != LV_RESULT_OK) {
LV_LOG_ERROR("Failed to create wl shell window");
goto err_destroy_surface;
}
#elif LV_WAYLAND_XDG_SHELL
if(lv_wayland_xdg_shell_create_window(app, window, title) != LV_RESULT_OK) {
goto err_destroy_surface;
}
#endif
return window;
@@ -80,7 +80,6 @@ bool lv_wayland_window_decoration_attach(struct window * window, struct graphic_
pos_x = parent->width - 1 * (BUTTON_MARGIN + BUTTON_SIZE);
pos_y = -1 * (BUTTON_MARGIN + BUTTON_SIZE + (BORDER_SIZE / 2));
break;
#if LV_WAYLAND_XDG_SHELL
case OBJECT_BUTTON_MAXIMIZE:
pos_x = parent->width - 2 * (BUTTON_MARGIN + BUTTON_SIZE);
pos_y = -1 * (BUTTON_MARGIN + BUTTON_SIZE + (BORDER_SIZE / 2));
@@ -89,7 +88,6 @@ bool lv_wayland_window_decoration_attach(struct window * window, struct graphic_
pos_x = parent->width - 3 * (BUTTON_MARGIN + BUTTON_SIZE);
pos_y = -1 * (BUTTON_MARGIN + BUTTON_SIZE + (BORDER_SIZE / 2));
break;
#endif
case OBJECT_BORDER_TOP:
pos_x = -BORDER_SIZE;
pos_y = -(BORDER_SIZE + TITLE_BAR_HEIGHT);
@@ -191,7 +189,6 @@ bool lv_wayland_window_decoration_create(struct window * window, struct graphic_
decoration->width = BUTTON_SIZE;
decoration->height = BUTTON_SIZE;
break;
#if LV_WAYLAND_XDG_SHELL
case OBJECT_BUTTON_MAXIMIZE:
decoration->width = BUTTON_SIZE;
decoration->height = BUTTON_SIZE;
@@ -200,7 +197,6 @@ bool lv_wayland_window_decoration_create(struct window * window, struct graphic_
decoration->width = BUTTON_SIZE;
decoration->height = BUTTON_SIZE;
break;
#endif
case OBJECT_BORDER_TOP:
decoration->width = window_width + 2 * (BORDER_SIZE);
decoration->height = BORDER_SIZE;
@@ -272,7 +268,6 @@ bool lv_wayland_window_decoration_create(struct window * window, struct graphic_
}
}
break;
#if LV_WAYLAND_XDG_SHELL
case OBJECT_BUTTON_MAXIMIZE:
color_fill(buf_base, lv_color_make(0xCC, 0xCC, 0xCC), decoration->width, decoration->height);
for(y = 0; y < decoration->height; y++) {
@@ -303,7 +298,6 @@ bool lv_wayland_window_decoration_create(struct window * window, struct graphic_
}
}
break;
#endif
case OBJECT_BORDER_TOP:
/* fallthrough */
case OBJECT_BORDER_BOTTOM:
-7
View File
@@ -9,14 +9,8 @@
#include "lv_wayland.h"
#if LV_USE_WAYLAND
/*
* LV_WAYLAND_XDG_SHELL is automatically defined if LV_WAYLAND_WL_SHELL is not set
* inside lv_wayland_private.h so we need include this header file before checking
* for LV_WAYLAND_XDG_SHELL
*/
#include "lv_wayland_private.h"
#if LV_WAYLAND_XDG_SHELL
#include <linux/input-event-codes.h>
#include "wayland_xdg_shell.h"
@@ -498,5 +492,4 @@ static void xdg_wm_base_ping(void * data, struct xdg_wm_base * xdg_wm_base, uint
return;
}
#endif /* LV_WAYLAND_XDG_SHELL */
#endif /* LV_USE_WAYLAND */
-8
View File
@@ -4016,13 +4016,6 @@
#define LV_WAYLAND_WINDOW_DECORATIONS 0 /**< Draw client side window decorations only necessary on Mutter/GNOME. Not supported using DMABUF*/
#endif
#endif
#ifndef LV_WAYLAND_WL_SHELL
#ifdef CONFIG_LV_WAYLAND_WL_SHELL
#define LV_WAYLAND_WL_SHELL CONFIG_LV_WAYLAND_WL_SHELL
#else
#define LV_WAYLAND_WL_SHELL 0 /**< Use the legacy wl_shell protocol instead of the default XDG shell*/
#endif
#endif
#endif
/** Driver for /dev/fb */
@@ -4762,7 +4755,6 @@ LV_EXPORT_CONST_INT(LV_DRAW_BUF_ALIGN);
#if LV_USE_WAYLAND == 0
#define LV_WAYLAND_USE_DMABUF 0
#define LV_WAYLAND_WINDOW_DECORATIONS 0
#define LV_WAYLAND_WL_SHELL 0
#endif /* LV_USE_WAYLAND */
#if LV_USE_LINUX_DRM == 0
-1
View File
@@ -1137,7 +1137,6 @@
#define LV_USE_WAYLAND 0
#if LV_USE_WAYLAND
#define LV_WAYLAND_WINDOW_DECORATIONS 0 /**< Draw client side window decorations only necessary on Mutter/GNOME */
#define LV_WAYLAND_WL_SHELL 0 /**< Use the legacy wl_shell protocol instead of the default XDG shell */
#endif
/** Driver for /dev/fb */