wayland: remove wl_shell and libweston patch
This commit removes the wl_shell and libweston patche, which are now not necessary anymore. Becasue we have removed the wayland backend for the LVGL image. Signed-off-by: Mike Engel <Mike.Engel@digi.com>
This commit is contained in:
parent
6b33d06197
commit
7afc4a67de
|
|
@ -1,92 +0,0 @@
|
|||
From: Haihua Hu <jared.hu@nxp.com>
|
||||
Date: Wed, 3 Aug 2022 16:34:47 +0800
|
||||
Subject: [PATCH] Revert "libweston/libinput-device: Enable/Set pointer
|
||||
capabilities only on pointer movement"
|
||||
|
||||
This reverts commit e825fe389ebd63470028abd828019840c1170a03.
|
||||
|
||||
This commit will cause waylandsink cannot register pointer seat.
|
||||
As a result, mouse cannot move waylandsink window
|
||||
|
||||
(cherry picked from commit 3f8f336b5d2cf7ea7aa4e047d669d093fc46dfe6)
|
||||
|
||||
Upstream-Status: Inappropriate [DEY specific]
|
||||
---
|
||||
libweston/libinput-device.c | 29 +++++------------------------
|
||||
1 file changed, 5 insertions(+), 24 deletions(-)
|
||||
|
||||
diff --git a/libweston/libinput-device.c b/libweston/libinput-device.c
|
||||
index 4ea89de0..2d7a7d5f 100644
|
||||
--- a/libweston/libinput-device.c
|
||||
+++ b/libweston/libinput-device.c
|
||||
@@ -60,21 +60,6 @@ evdev_led_update(struct evdev_device *device, enum weston_led weston_leds)
|
||||
libinput_device_led_update(device->device, leds);
|
||||
}
|
||||
|
||||
-static void
|
||||
-ensure_pointer_capability(struct libinput_device *libinput_device)
|
||||
-{
|
||||
- struct evdev_device *device = libinput_device_get_user_data(libinput_device);
|
||||
- struct weston_seat *seat = device->seat;
|
||||
-
|
||||
- if (!libinput_device_has_capability(libinput_device, LIBINPUT_DEVICE_CAP_POINTER))
|
||||
- return;
|
||||
-
|
||||
- if (!(device->seat_caps & EVDEV_SEAT_POINTER)) {
|
||||
- weston_seat_init_pointer(seat);
|
||||
- device->seat_caps |= EVDEV_SEAT_POINTER;
|
||||
- }
|
||||
-}
|
||||
-
|
||||
static void
|
||||
handle_keyboard_key(struct libinput_device *libinput_device,
|
||||
struct libinput_event_keyboard *keyboard_event)
|
||||
@@ -112,8 +97,6 @@ handle_pointer_motion(struct libinput_device *libinput_device,
|
||||
struct timespec time;
|
||||
double dx_unaccel, dy_unaccel;
|
||||
|
||||
- ensure_pointer_capability(libinput_device);
|
||||
-
|
||||
timespec_from_usec(&time,
|
||||
libinput_event_pointer_get_time_usec(pointer_event));
|
||||
dx_unaccel = libinput_event_pointer_get_dx_unaccelerated(pointer_event);
|
||||
@@ -146,8 +129,6 @@ handle_pointer_motion_absolute(
|
||||
double x, y;
|
||||
uint32_t width, height;
|
||||
|
||||
- ensure_pointer_capability(libinput_device);
|
||||
-
|
||||
if (!output)
|
||||
return false;
|
||||
|
||||
@@ -179,8 +160,6 @@ handle_pointer_button(struct libinput_device *libinput_device,
|
||||
libinput_event_pointer_get_seat_button_count(pointer_event);
|
||||
struct timespec time;
|
||||
|
||||
- ensure_pointer_capability(libinput_device);
|
||||
-
|
||||
/* Ignore button events that are not seat wide state changes. */
|
||||
if ((button_state == LIBINPUT_BUTTON_STATE_PRESSED &&
|
||||
seat_button_count != 1) ||
|
||||
@@ -260,8 +239,6 @@ handle_pointer_axis(struct libinput_device *libinput_device,
|
||||
bool has_vert, has_horiz;
|
||||
struct timespec time;
|
||||
|
||||
- ensure_pointer_capability(libinput_device);
|
||||
-
|
||||
has_vert = libinput_event_pointer_has_axis(pointer_event,
|
||||
LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL);
|
||||
has_horiz = libinput_event_pointer_has_axis(pointer_event,
|
||||
@@ -738,7 +715,11 @@ evdev_device_create(struct libinput_device *libinput_device,
|
||||
|
||||
device->seat_caps |= EVDEV_SEAT_KEYBOARD;
|
||||
}
|
||||
-
|
||||
+ if (libinput_device_has_capability(libinput_device,
|
||||
+ LIBINPUT_DEVICE_CAP_POINTER)) {
|
||||
+ weston_seat_init_pointer(seat);
|
||||
+ device->seat_caps |= EVDEV_SEAT_POINTER;
|
||||
+ }
|
||||
if (libinput_device_has_capability(libinput_device,
|
||||
LIBINPUT_DEVICE_CAP_TOUCH)) {
|
||||
if (weston_seat_init_touch(seat) < 0) {
|
||||
|
|
@ -1,943 +0,0 @@
|
|||
From: Gabriel Valcazar <gabriel.valcazar@digi.com>
|
||||
Date: Fri, 19 Jan 2024 09:45:19 +0100
|
||||
Subject: [PATCH] Restore wl_shell to weston 13
|
||||
|
||||
This shell was deprecated some time ago and removed in weston 11, but it's the
|
||||
default shell used by LVGL's wayland backend. Until we migrate said backend to
|
||||
use xdg_shell, restore wl_shell in weston 13.
|
||||
|
||||
This reverts the following commits:
|
||||
|
||||
* d40cedc8af9a42e1f6746fb58f4556080c6ff133
|
||||
* 7cae2a1fb0aeec24ca33ac4c7cbb268f77095cb5
|
||||
* e6b8f5a5e40cd6c0b934e8ae079c86d5193efa96
|
||||
|
||||
Upstream-Status: Inappropriate [DEY specific]
|
||||
|
||||
Signed-off-by: Gabriel Valcazar <gabriel.valcazar@digi.com>
|
||||
---
|
||||
desktop-shell/shell.c | 26 +-
|
||||
libweston/backend-wayland/wayland.c | 87 ++++-
|
||||
libweston/desktop/internal.h | 4 +
|
||||
libweston/desktop/libweston-desktop.c | 19 +
|
||||
libweston/desktop/meson.build | 1 +
|
||||
libweston/desktop/wl-shell.c | 505 ++++++++++++++++++++++++++
|
||||
meson.build | 6 +
|
||||
meson_options.txt | 7 +
|
||||
8 files changed, 638 insertions(+), 17 deletions(-)
|
||||
create mode 100644 libweston/desktop/wl-shell.c
|
||||
|
||||
diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
|
||||
index 084e6029..ed394ff8 100644
|
||||
--- a/desktop-shell/shell.c
|
||||
+++ b/desktop-shell/shell.c
|
||||
@@ -1337,16 +1337,16 @@ resize_grab_motion(struct weston_pointer_grab *grab,
|
||||
to_y = wl_fixed_from_double(tmp_s.c.y);
|
||||
|
||||
width = resize->width;
|
||||
- if (resize->edges & WESTON_DESKTOP_SURFACE_EDGE_LEFT) {
|
||||
+ if (resize->edges & WL_SHELL_SURFACE_RESIZE_LEFT) {
|
||||
width += wl_fixed_to_int(from_x - to_x);
|
||||
- } else if (resize->edges & WESTON_DESKTOP_SURFACE_EDGE_RIGHT) {
|
||||
+ } else if (resize->edges & WL_SHELL_SURFACE_RESIZE_RIGHT) {
|
||||
width += wl_fixed_to_int(to_x - from_x);
|
||||
}
|
||||
|
||||
height = resize->height;
|
||||
- if (resize->edges & WESTON_DESKTOP_SURFACE_EDGE_TOP) {
|
||||
+ if (resize->edges & WL_SHELL_SURFACE_RESIZE_TOP) {
|
||||
height += wl_fixed_to_int(from_y - to_y);
|
||||
- } else if (resize->edges & WESTON_DESKTOP_SURFACE_EDGE_BOTTOM) {
|
||||
+ } else if (resize->edges & WL_SHELL_SURFACE_RESIZE_BOTTOM) {
|
||||
height += wl_fixed_to_int(to_y - from_y);
|
||||
}
|
||||
|
||||
@@ -1424,9 +1424,9 @@ surface_resize(struct shell_surface *shsurf,
|
||||
{
|
||||
struct weston_resize_grab *resize;
|
||||
const unsigned resize_topbottom =
|
||||
- WESTON_DESKTOP_SURFACE_EDGE_TOP | WESTON_DESKTOP_SURFACE_EDGE_BOTTOM;
|
||||
+ WL_SHELL_SURFACE_RESIZE_TOP | WL_SHELL_SURFACE_RESIZE_BOTTOM;
|
||||
const unsigned resize_leftright =
|
||||
- WESTON_DESKTOP_SURFACE_EDGE_LEFT | WESTON_DESKTOP_SURFACE_EDGE_RIGHT;
|
||||
+ WL_SHELL_SURFACE_RESIZE_LEFT | WL_SHELL_SURFACE_RESIZE_RIGHT;
|
||||
const unsigned resize_any = resize_topbottom | resize_leftright;
|
||||
struct weston_geometry geometry;
|
||||
|
||||
@@ -1434,7 +1434,7 @@ surface_resize(struct shell_surface *shsurf,
|
||||
return 0;
|
||||
|
||||
/* Check for invalid edge combinations. */
|
||||
- if (edges == WESTON_DESKTOP_SURFACE_EDGE_NONE || edges > resize_any ||
|
||||
+ if (edges == WL_SHELL_SURFACE_RESIZE_NONE || edges > resize_any ||
|
||||
(edges & resize_topbottom) == resize_topbottom ||
|
||||
(edges & resize_leftright) == resize_leftright)
|
||||
return 0;
|
||||
@@ -2385,9 +2385,9 @@ desktop_surface_committed(struct weston_desktop_surface *desktop_surface,
|
||||
offset.c.y = 0;
|
||||
}
|
||||
|
||||
- if (shsurf->resize_edges & WESTON_DESKTOP_SURFACE_EDGE_LEFT)
|
||||
+ if (shsurf->resize_edges & WL_SHELL_SURFACE_RESIZE_LEFT)
|
||||
offset.c.x = shsurf->last_width - surface->width;
|
||||
- if (shsurf->resize_edges & WESTON_DESKTOP_SURFACE_EDGE_TOP)
|
||||
+ if (shsurf->resize_edges & WL_SHELL_SURFACE_RESIZE_TOP)
|
||||
offset.c.y = shsurf->last_height - surface->height;
|
||||
|
||||
pos = weston_view_get_pos_offset_global(view);
|
||||
@@ -3312,18 +3312,18 @@ resize_binding(struct weston_pointer *pointer, const struct timespec *time,
|
||||
y = surf_pos.c.y;
|
||||
|
||||
if (x < surface->width / 3)
|
||||
- edges |= WESTON_DESKTOP_SURFACE_EDGE_LEFT;
|
||||
+ edges |= WL_SHELL_SURFACE_RESIZE_LEFT;
|
||||
else if (x < 2 * surface->width / 3)
|
||||
edges |= 0;
|
||||
else
|
||||
- edges |= WESTON_DESKTOP_SURFACE_EDGE_RIGHT;
|
||||
+ edges |= WL_SHELL_SURFACE_RESIZE_RIGHT;
|
||||
|
||||
if (y < surface->height / 3)
|
||||
- edges |= WESTON_DESKTOP_SURFACE_EDGE_TOP;
|
||||
+ edges |= WL_SHELL_SURFACE_RESIZE_TOP;
|
||||
else if (y < 2 * surface->height / 3)
|
||||
edges |= 0;
|
||||
else
|
||||
- edges |= WESTON_DESKTOP_SURFACE_EDGE_BOTTOM;
|
||||
+ edges |= WL_SHELL_SURFACE_RESIZE_BOTTOM;
|
||||
|
||||
surface_resize(shsurf, pointer, edges);
|
||||
}
|
||||
diff --git a/libweston/backend-wayland/wayland.c b/libweston/backend-wayland/wayland.c
|
||||
index 892c5b0c..733931ff 100644
|
||||
--- a/libweston/backend-wayland/wayland.c
|
||||
+++ b/libweston/backend-wayland/wayland.c
|
||||
@@ -85,6 +85,7 @@ struct wayland_backend {
|
||||
struct wl_display *wl_display;
|
||||
struct wl_registry *registry;
|
||||
struct wl_compositor *compositor;
|
||||
+ struct wl_shell *shell;
|
||||
struct xdg_wm_base *xdg_wm_base;
|
||||
struct zwp_fullscreen_shell_v1 *fshell;
|
||||
struct wl_shm *shm;
|
||||
@@ -123,6 +124,7 @@ struct wayland_output {
|
||||
struct wl_output *output;
|
||||
uint32_t global_id;
|
||||
|
||||
+ struct wl_shell_surface *shell_surface;
|
||||
struct xdg_surface *xdg_surface;
|
||||
struct xdg_toplevel *xdg_toplevel;
|
||||
int configure_width, configure_height;
|
||||
@@ -666,6 +668,11 @@ wayland_backend_destroy_output_surface(struct wayland_output *output)
|
||||
output->parent.xdg_surface = NULL;
|
||||
}
|
||||
|
||||
+ if (output->parent.shell_surface) {
|
||||
+ wl_shell_surface_destroy(output->parent.shell_surface);
|
||||
+ output->parent.shell_surface = NULL;
|
||||
+ }
|
||||
+
|
||||
wl_surface_destroy(output->parent.surface);
|
||||
output->parent.surface = NULL;
|
||||
}
|
||||
@@ -743,6 +750,8 @@ wayland_output_destroy(struct weston_output *base)
|
||||
free(output);
|
||||
}
|
||||
|
||||
+static const struct wl_shell_surface_listener shell_surface_listener;
|
||||
+
|
||||
#ifdef ENABLE_EGL
|
||||
static int
|
||||
wayland_output_init_gl_renderer(struct wayland_output *output)
|
||||
@@ -905,6 +914,8 @@ wayland_output_set_windowed(struct wayland_output *output)
|
||||
|
||||
if (output->parent.xdg_toplevel) {
|
||||
xdg_toplevel_unset_fullscreen(output->parent.xdg_toplevel);
|
||||
+ } else if (output->parent.shell_surface) {
|
||||
+ wl_shell_surface_set_toplevel(output->parent.shell_surface);
|
||||
} else {
|
||||
abort();
|
||||
}
|
||||
@@ -914,6 +925,7 @@ wayland_output_set_windowed(struct wayland_output *output)
|
||||
|
||||
static void
|
||||
wayland_output_set_fullscreen(struct wayland_output *output,
|
||||
+ enum wl_shell_surface_fullscreen_method method,
|
||||
uint32_t framerate, struct wl_output *target)
|
||||
{
|
||||
if (output->frame) {
|
||||
@@ -925,6 +937,9 @@ wayland_output_set_fullscreen(struct wayland_output *output,
|
||||
|
||||
if (output->parent.xdg_toplevel) {
|
||||
xdg_toplevel_set_fullscreen(output->parent.xdg_toplevel, target);
|
||||
+ } else if (output->parent.shell_surface) {
|
||||
+ wl_shell_surface_set_fullscreen(output->parent.shell_surface,
|
||||
+ method, framerate, target);
|
||||
} else {
|
||||
abort();
|
||||
}
|
||||
@@ -1150,7 +1165,7 @@ wayland_output_switch_mode(struct weston_output *output_base,
|
||||
|
||||
if (output->parent.xdg_surface)
|
||||
return wayland_output_switch_mode_xdg(output, mode);
|
||||
- if (output->backend->parent.fshell)
|
||||
+ if (output->backend->parent.fshell || output->parent.shell_surface)
|
||||
return wayland_output_switch_mode_fshell(output, mode);
|
||||
|
||||
return -1;
|
||||
@@ -1263,6 +1278,20 @@ wayland_backend_create_output_surface(struct wayland_output *output)
|
||||
|
||||
weston_log("wayland-backend: Using xdg_wm_base\n");
|
||||
}
|
||||
+ else if (b->parent.shell) {
|
||||
+ output->parent.shell_surface =
|
||||
+ wl_shell_get_shell_surface(b->parent.shell,
|
||||
+ output->parent.surface);
|
||||
+ if (!output->parent.shell_surface) {
|
||||
+ wl_surface_destroy(output->parent.surface);
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ wl_shell_surface_add_listener(output->parent.shell_surface,
|
||||
+ &shell_surface_listener, output);
|
||||
+
|
||||
+ weston_log("wayland-backend: Using wl_shell\n");
|
||||
+ }
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1334,9 +1363,13 @@ wayland_output_enable(struct weston_output *base)
|
||||
|
||||
output->parent.draw_initial_frame = true;
|
||||
}
|
||||
+ } else {
|
||||
+ wayland_output_set_fullscreen(output,
|
||||
+ WL_SHELL_SURFACE_FULLSCREEN_METHOD_DRIVER,
|
||||
+ output->mode.refresh, output->parent.output);
|
||||
}
|
||||
} else if (b->fullscreen) {
|
||||
- wayland_output_set_fullscreen(output, 0, NULL);
|
||||
+ wayland_output_set_fullscreen(output, 0, 0, NULL);
|
||||
} else {
|
||||
wayland_output_set_windowed(output);
|
||||
}
|
||||
@@ -1625,10 +1658,13 @@ wayland_output_setup_fullscreen(struct wayland_output *output,
|
||||
return -1;
|
||||
|
||||
/* What should size be set if conditional is false? */
|
||||
- if (b->parent.xdg_wm_base) {
|
||||
+ if (b->parent.xdg_wm_base || b->parent.shell) {
|
||||
if (output->parent.xdg_toplevel)
|
||||
xdg_toplevel_set_fullscreen(output->parent.xdg_toplevel,
|
||||
output->parent.output);
|
||||
+ else if (output->parent.shell_surface)
|
||||
+ wl_shell_surface_set_fullscreen(output->parent.shell_surface,
|
||||
+ 0, 0, NULL);
|
||||
|
||||
wl_display_roundtrip(b->parent.wl_display);
|
||||
|
||||
@@ -1652,6 +1688,36 @@ err_set_size:
|
||||
return -1;
|
||||
}
|
||||
|
||||
+static void
|
||||
+shell_surface_ping(void *data, struct wl_shell_surface *shell_surface,
|
||||
+ uint32_t serial)
|
||||
+{
|
||||
+ wl_shell_surface_pong(shell_surface, serial);
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+shell_surface_configure(void *data, struct wl_shell_surface *shell_surface,
|
||||
+ uint32_t edges, int32_t width, int32_t height)
|
||||
+{
|
||||
+ struct wayland_output *output = data;
|
||||
+
|
||||
+ output->parent.configure_width = width;
|
||||
+ output->parent.configure_height = height;
|
||||
+
|
||||
+ /* FIXME: implement resizing */
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+shell_surface_popup_done(void *data, struct wl_shell_surface *shell_surface)
|
||||
+{
|
||||
+}
|
||||
+
|
||||
+static const struct wl_shell_surface_listener shell_surface_listener = {
|
||||
+ shell_surface_ping,
|
||||
+ shell_surface_configure,
|
||||
+ shell_surface_popup_done
|
||||
+};
|
||||
+
|
||||
/* Events received from the wayland-server this compositor is client of: */
|
||||
|
||||
/* parent input interface */
|
||||
@@ -1833,6 +1899,9 @@ input_handle_button(void *data, struct wl_pointer *pointer,
|
||||
if (input->output->parent.xdg_toplevel)
|
||||
xdg_toplevel_move(input->output->parent.xdg_toplevel,
|
||||
input->parent.seat, serial);
|
||||
+ else if (input->output->parent.shell_surface)
|
||||
+ wl_shell_surface_move(input->output->parent.shell_surface,
|
||||
+ input->parent.seat, serial);
|
||||
frame_status_clear(input->output->frame,
|
||||
FRAME_STATUS_MOVE);
|
||||
return;
|
||||
@@ -2194,6 +2263,9 @@ input_handle_touch_down(void *data, struct wl_touch *wl_touch,
|
||||
if (output->parent.xdg_toplevel)
|
||||
xdg_toplevel_move(output->parent.xdg_toplevel,
|
||||
input->parent.seat, serial);
|
||||
+ else if (output->parent.shell_surface)
|
||||
+ wl_shell_surface_move(output->parent.shell_surface,
|
||||
+ input->parent.seat, serial);
|
||||
frame_status_clear(output->frame,
|
||||
FRAME_STATUS_MOVE);
|
||||
return;
|
||||
@@ -2708,6 +2780,10 @@ registry_handle_global(void *data, struct wl_registry *registry, uint32_t name,
|
||||
&xdg_wm_base_interface, 1);
|
||||
xdg_wm_base_add_listener(b->parent.xdg_wm_base,
|
||||
&wm_base_listener, b);
|
||||
+ } else if (strcmp(interface, "wl_shell") == 0) {
|
||||
+ b->parent.shell =
|
||||
+ wl_registry_bind(registry, name,
|
||||
+ &wl_shell_interface, 1);
|
||||
} else if (strcmp(interface, "zwp_fullscreen_shell_v1") == 0) {
|
||||
b->parent.fshell =
|
||||
wl_registry_bind(registry, name,
|
||||
@@ -2809,6 +2885,9 @@ wayland_destroy(struct weston_backend *backend)
|
||||
if (b->parent.xdg_wm_base)
|
||||
xdg_wm_base_destroy(b->parent.xdg_wm_base);
|
||||
|
||||
+ if (b->parent.shell)
|
||||
+ wl_shell_destroy(b->parent.shell);
|
||||
+
|
||||
if (b->parent.fshell)
|
||||
zwp_fullscreen_shell_v1_release(b->parent.fshell);
|
||||
|
||||
@@ -2880,7 +2959,7 @@ fullscreen_binding(struct weston_keyboard *keyboard,
|
||||
return;
|
||||
|
||||
if (input->output->frame)
|
||||
- wayland_output_set_fullscreen(input->output, 0, NULL);
|
||||
+ wayland_output_set_fullscreen(input->output, 0, 0, NULL);
|
||||
else
|
||||
wayland_output_set_windowed(input->output);
|
||||
|
||||
diff --git a/libweston/desktop/internal.h b/libweston/desktop/internal.h
|
||||
index 74a65f96..a7a39046 100644
|
||||
--- a/libweston/desktop/internal.h
|
||||
+++ b/libweston/desktop/internal.h
|
||||
@@ -249,6 +249,10 @@ weston_desktop_xdg_wm_base_create(struct weston_desktop *desktop,
|
||||
struct wl_global *
|
||||
weston_desktop_xdg_shell_v6_create(struct weston_desktop *desktop,
|
||||
struct wl_display *display);
|
||||
+struct wl_global *
|
||||
+weston_desktop_wl_shell_create(struct weston_desktop *desktop,
|
||||
+ struct wl_display *display);
|
||||
+
|
||||
void
|
||||
weston_desktop_xwayland_init(struct weston_desktop *desktop);
|
||||
void
|
||||
diff --git a/libweston/desktop/libweston-desktop.c b/libweston/desktop/libweston-desktop.c
|
||||
index 5923e40f..f01678d1 100644
|
||||
--- a/libweston/desktop/libweston-desktop.c
|
||||
+++ b/libweston/desktop/libweston-desktop.c
|
||||
@@ -42,6 +42,7 @@ struct weston_desktop {
|
||||
void *user_data;
|
||||
struct wl_global *xdg_wm_base; /* Stable protocol xdg_shell replaces xdg_shell_unstable_v6 */
|
||||
struct wl_global *xdg_shell_v6; /* Unstable xdg_shell_unstable_v6 protocol. */
|
||||
+ struct wl_global *wl_shell;
|
||||
};
|
||||
|
||||
void
|
||||
@@ -76,6 +77,22 @@ weston_desktop_create(struct weston_compositor *compositor,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
+#ifdef HAVE_DEPRECATED_WL_SHELL
|
||||
+ weston_log("Warning: support for deprecated wl_shell interface is "
|
||||
+ "enabled. Please migrate legacy clients to xdg-shell.\n");
|
||||
+ desktop->wl_shell =
|
||||
+ weston_desktop_wl_shell_create(desktop, display);
|
||||
+ if (desktop->wl_shell == NULL) {
|
||||
+ weston_desktop_destroy(desktop);
|
||||
+ return NULL;
|
||||
+ }
|
||||
+#else
|
||||
+ weston_log("Note: support for the deprecated wl_shell interface is "
|
||||
+ "disabled. If a legacy client still needs it, it can be "
|
||||
+ "re-enabled by passing -Ddeprecated-wl-shell=true to Meson "
|
||||
+ "when building Weston.\n");
|
||||
+#endif
|
||||
+
|
||||
weston_desktop_xwayland_init(desktop);
|
||||
|
||||
return desktop;
|
||||
@@ -89,6 +106,8 @@ weston_desktop_destroy(struct weston_desktop *desktop)
|
||||
|
||||
weston_desktop_xwayland_fini(desktop);
|
||||
|
||||
+ if (desktop->wl_shell != NULL)
|
||||
+ wl_global_destroy(desktop->wl_shell);
|
||||
if (desktop->xdg_shell_v6 != NULL)
|
||||
wl_global_destroy(desktop->xdg_shell_v6);
|
||||
if (desktop->xdg_wm_base != NULL)
|
||||
diff --git a/libweston/desktop/meson.build b/libweston/desktop/meson.build
|
||||
index 4588ad10..d8e1a709 100644
|
||||
--- a/libweston/desktop/meson.build
|
||||
+++ b/libweston/desktop/meson.build
|
||||
@@ -4,6 +4,7 @@ srcs_libweston += files([
|
||||
'seat.c',
|
||||
'surface.c',
|
||||
'xwayland.c',
|
||||
+ 'wl-shell.c',
|
||||
'xdg-shell.c',
|
||||
'xdg-shell-v6.c',
|
||||
])
|
||||
diff --git a/libweston/desktop/wl-shell.c b/libweston/desktop/wl-shell.c
|
||||
new file mode 100644
|
||||
index 00000000..74140b4d
|
||||
--- /dev/null
|
||||
+++ b/libweston/desktop/wl-shell.c
|
||||
@@ -0,0 +1,505 @@
|
||||
+/*
|
||||
+ * Copyright © 2010-2012 Intel Corporation
|
||||
+ * Copyright © 2011-2012 Collabora, Ltd.
|
||||
+ * Copyright © 2013 Raspberry Pi Foundation
|
||||
+ * Copyright © 2016 Quentin "Sardem FF7" Glidic
|
||||
+ *
|
||||
+ * Permission is hereby granted, free of charge, to any person obtaining a
|
||||
+ * copy of this software and associated documentation files (the "Software"),
|
||||
+ * to deal in the Software without restriction, including without limitation
|
||||
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
+ * and/or sell copies of the Software, and to permit persons to whom the
|
||||
+ * Software is furnished to do so, subject to the following conditions:
|
||||
+ *
|
||||
+ * The above copyright notice and this permission notice (including the next
|
||||
+ * paragraph) shall be included in all copies or substantial portions of the
|
||||
+ * Software.
|
||||
+ *
|
||||
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
+ * DEALINGS IN THE SOFTWARE.
|
||||
+ */
|
||||
+
|
||||
+#include "config.h"
|
||||
+
|
||||
+#include <assert.h>
|
||||
+
|
||||
+#include <wayland-server.h>
|
||||
+
|
||||
+#include <libweston/libweston.h>
|
||||
+#include <libweston/zalloc.h>
|
||||
+
|
||||
+#include <libweston/desktop.h>
|
||||
+#include "internal.h"
|
||||
+
|
||||
+#define WD_WL_SHELL_PROTOCOL_VERSION 1
|
||||
+
|
||||
+enum weston_desktop_wl_shell_surface_state {
|
||||
+ NONE,
|
||||
+ TOPLEVEL,
|
||||
+ MAXIMIZED,
|
||||
+ FULLSCREEN,
|
||||
+ TRANSIENT,
|
||||
+ POPUP,
|
||||
+};
|
||||
+
|
||||
+struct weston_desktop_wl_shell_surface {
|
||||
+ struct wl_resource *resource;
|
||||
+ struct weston_desktop *desktop;
|
||||
+ struct wl_display *display;
|
||||
+ struct weston_desktop_surface *surface;
|
||||
+ struct weston_desktop_surface *parent;
|
||||
+ bool added;
|
||||
+ struct weston_desktop_seat *popup_seat;
|
||||
+ enum weston_desktop_wl_shell_surface_state state;
|
||||
+ struct wl_listener wl_surface_resource_destroy_listener;
|
||||
+};
|
||||
+
|
||||
+static void
|
||||
+weston_desktop_wl_shell_surface_set_size(struct weston_desktop_surface *dsurface,
|
||||
+ void *user_data,
|
||||
+ int32_t width, int32_t height)
|
||||
+{
|
||||
+ struct weston_desktop_wl_shell_surface *surface = user_data;
|
||||
+ struct weston_surface *wsurface =
|
||||
+ weston_desktop_surface_get_surface(surface->surface);
|
||||
+
|
||||
+ if ((wsurface->width == width && wsurface->height == height) ||
|
||||
+ (width == 0 && height == 0))
|
||||
+ return;
|
||||
+
|
||||
+ wl_shell_surface_send_configure(surface->resource,
|
||||
+ WL_SHELL_SURFACE_RESIZE_NONE,
|
||||
+ width, height);
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+weston_desktop_wl_shell_surface_maybe_ungrab(struct weston_desktop_wl_shell_surface *surface)
|
||||
+{
|
||||
+ if (surface->state != POPUP ||
|
||||
+ !weston_desktop_surface_get_grab(surface->surface))
|
||||
+ return;
|
||||
+
|
||||
+ weston_desktop_surface_popup_ungrab(surface->surface,
|
||||
+ surface->popup_seat);
|
||||
+ surface->popup_seat = NULL;
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+weston_desktop_wl_shell_surface_committed(struct weston_desktop_surface *dsurface,
|
||||
+ void *user_data,
|
||||
+ struct weston_coord_surface c)
|
||||
+{
|
||||
+ struct weston_desktop_wl_shell_surface *surface = user_data;
|
||||
+ struct weston_surface *wsurface =
|
||||
+ weston_desktop_surface_get_surface(dsurface);
|
||||
+
|
||||
+ if (wsurface->buffer_ref.buffer == NULL)
|
||||
+ weston_desktop_wl_shell_surface_maybe_ungrab(surface);
|
||||
+
|
||||
+ if (surface->added)
|
||||
+ weston_desktop_api_committed(surface->desktop, surface->surface,
|
||||
+ c);
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+weston_desktop_wl_shell_surface_ping(struct weston_desktop_surface *dsurface,
|
||||
+ uint32_t serial, void *user_data)
|
||||
+{
|
||||
+ struct weston_desktop_wl_shell_surface *surface = user_data;
|
||||
+
|
||||
+ wl_shell_surface_send_ping(surface->resource, serial);
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+weston_desktop_wl_shell_surface_close(struct weston_desktop_surface *dsurface,
|
||||
+ void *user_data)
|
||||
+{
|
||||
+ struct weston_desktop_wl_shell_surface *surface = user_data;
|
||||
+
|
||||
+ if (surface->state == POPUP)
|
||||
+ wl_shell_surface_send_popup_done(surface->resource);
|
||||
+}
|
||||
+
|
||||
+static bool
|
||||
+weston_desktop_wl_shell_surface_get_maximized(struct weston_desktop_surface *dsurface,
|
||||
+ void *user_data)
|
||||
+{
|
||||
+ struct weston_desktop_wl_shell_surface *surface = user_data;
|
||||
+
|
||||
+ return surface->state == MAXIMIZED;
|
||||
+}
|
||||
+
|
||||
+static bool
|
||||
+weston_desktop_wl_shell_surface_get_fullscreen(struct weston_desktop_surface *dsurface,
|
||||
+ void *user_data)
|
||||
+{
|
||||
+ struct weston_desktop_wl_shell_surface *surface = user_data;
|
||||
+
|
||||
+ return surface->state == FULLSCREEN;
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+weston_desktop_wl_shell_change_state(struct weston_desktop_wl_shell_surface *surface,
|
||||
+ enum weston_desktop_wl_shell_surface_state state,
|
||||
+ struct weston_desktop_surface *parent,
|
||||
+ const struct weston_coord_surface *offset)
|
||||
+{
|
||||
+ bool to_add = (parent == NULL);
|
||||
+
|
||||
+ assert(state != NONE);
|
||||
+
|
||||
+ if (to_add && surface->added) {
|
||||
+ surface->state = state;
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ if (surface->state != state) {
|
||||
+ if (surface->state == POPUP)
|
||||
+ weston_desktop_wl_shell_surface_maybe_ungrab(surface);
|
||||
+
|
||||
+ if (to_add) {
|
||||
+ weston_desktop_surface_unset_relative_to(surface->surface);
|
||||
+ weston_desktop_api_surface_added(surface->desktop,
|
||||
+ surface->surface);
|
||||
+ } else if (surface->added) {
|
||||
+ weston_desktop_api_surface_removed(surface->desktop,
|
||||
+ surface->surface);
|
||||
+ }
|
||||
+
|
||||
+ surface->state = state;
|
||||
+ surface->added = to_add;
|
||||
+ }
|
||||
+
|
||||
+ if (parent != NULL)
|
||||
+ weston_desktop_surface_set_relative_to(surface->surface, parent,
|
||||
+ *offset, false);
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+weston_desktop_wl_shell_surface_destroy(struct weston_desktop_surface *dsurface,
|
||||
+ void *user_data)
|
||||
+{
|
||||
+ struct weston_desktop_wl_shell_surface *surface = user_data;
|
||||
+
|
||||
+ wl_list_remove(&surface->wl_surface_resource_destroy_listener.link);
|
||||
+
|
||||
+ weston_desktop_wl_shell_surface_maybe_ungrab(surface);
|
||||
+ weston_desktop_surface_unset_relative_to(surface->surface);
|
||||
+ if (surface->added)
|
||||
+ weston_desktop_api_surface_removed(surface->desktop,
|
||||
+ surface->surface);
|
||||
+
|
||||
+ free(surface);
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+weston_desktop_wl_shell_surface_protocol_pong(struct wl_client *wl_client,
|
||||
+ struct wl_resource *resource,
|
||||
+ uint32_t serial)
|
||||
+{
|
||||
+ struct weston_desktop_surface *surface = wl_resource_get_user_data(resource);
|
||||
+
|
||||
+ weston_desktop_client_pong(weston_desktop_surface_get_client(surface), serial);
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+weston_desktop_wl_shell_surface_protocol_move(struct wl_client *wl_client,
|
||||
+ struct wl_resource *resource,
|
||||
+ struct wl_resource *seat_resource,
|
||||
+ uint32_t serial)
|
||||
+{
|
||||
+ struct weston_desktop_surface *dsurface =
|
||||
+ wl_resource_get_user_data(resource);
|
||||
+ struct weston_seat *seat =
|
||||
+ wl_resource_get_user_data(seat_resource);
|
||||
+ struct weston_desktop_wl_shell_surface *surface =
|
||||
+ weston_desktop_surface_get_implementation_data(dsurface);
|
||||
+
|
||||
+ if (seat == NULL)
|
||||
+ return;
|
||||
+
|
||||
+ weston_desktop_api_move(surface->desktop, dsurface, seat, serial);
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+weston_desktop_wl_shell_surface_protocol_resize(struct wl_client *wl_client,
|
||||
+ struct wl_resource *resource,
|
||||
+ struct wl_resource *seat_resource,
|
||||
+ uint32_t serial,
|
||||
+ enum wl_shell_surface_resize edges)
|
||||
+{
|
||||
+ struct weston_desktop_surface *dsurface =
|
||||
+ wl_resource_get_user_data(resource);
|
||||
+ struct weston_seat *seat = wl_resource_get_user_data(seat_resource);
|
||||
+ struct weston_desktop_wl_shell_surface *surface =
|
||||
+ weston_desktop_surface_get_implementation_data(dsurface);
|
||||
+ enum weston_desktop_surface_edge surf_edges =
|
||||
+ (enum weston_desktop_surface_edge) edges;
|
||||
+
|
||||
+ if (seat == NULL)
|
||||
+ return;
|
||||
+
|
||||
+ weston_desktop_api_resize(surface->desktop, dsurface, seat, serial, surf_edges);
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+weston_desktop_wl_shell_surface_protocol_set_toplevel(struct wl_client *wl_client,
|
||||
+ struct wl_resource *resource)
|
||||
+{
|
||||
+ struct weston_desktop_surface *dsurface =
|
||||
+ wl_resource_get_user_data(resource);
|
||||
+ struct weston_desktop_wl_shell_surface *surface =
|
||||
+ weston_desktop_surface_get_implementation_data(dsurface);
|
||||
+
|
||||
+ weston_desktop_wl_shell_change_state(surface, TOPLEVEL, NULL, NULL);
|
||||
+ if (surface->parent == NULL)
|
||||
+ return;
|
||||
+ surface->parent = NULL;
|
||||
+ weston_desktop_api_set_parent(surface->desktop, surface->surface, NULL);
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+weston_desktop_wl_shell_surface_protocol_set_transient(struct wl_client *wl_client,
|
||||
+ struct wl_resource *resource,
|
||||
+ struct wl_resource *parent_resource,
|
||||
+ int32_t x, int32_t y,
|
||||
+ enum wl_shell_surface_transient flags)
|
||||
+{
|
||||
+ struct weston_desktop_surface *dsurface =
|
||||
+ wl_resource_get_user_data(resource);
|
||||
+ struct weston_surface *wparent =
|
||||
+ wl_resource_get_user_data(parent_resource);
|
||||
+ struct weston_desktop_surface *parent;
|
||||
+ struct weston_desktop_wl_shell_surface *surface =
|
||||
+ weston_desktop_surface_get_implementation_data(dsurface);
|
||||
+ struct weston_surface *wsurface;
|
||||
+ struct weston_coord_surface offset;
|
||||
+
|
||||
+ if (!weston_surface_is_desktop_surface(wparent))
|
||||
+ return;
|
||||
+
|
||||
+ parent = weston_surface_get_desktop_surface(wparent);
|
||||
+ wsurface = weston_desktop_surface_get_surface(dsurface);
|
||||
+ offset = weston_coord_surface(x, y, wsurface);
|
||||
+ if (flags & WL_SHELL_SURFACE_TRANSIENT_INACTIVE) {
|
||||
+ weston_desktop_wl_shell_change_state(surface, TRANSIENT, parent,
|
||||
+ &offset);
|
||||
+ } else {
|
||||
+ weston_desktop_wl_shell_change_state(surface, TOPLEVEL, NULL,
|
||||
+ NULL);
|
||||
+ surface->parent = parent;
|
||||
+ weston_desktop_api_set_parent(surface->desktop,
|
||||
+ surface->surface, parent);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+weston_desktop_wl_shell_surface_protocol_set_fullscreen(struct wl_client *wl_client,
|
||||
+ struct wl_resource *resource,
|
||||
+ enum wl_shell_surface_fullscreen_method method,
|
||||
+ uint32_t framerate,
|
||||
+ struct wl_resource *output_resource)
|
||||
+{
|
||||
+ struct weston_desktop_surface *dsurface =
|
||||
+ wl_resource_get_user_data(resource);
|
||||
+ struct weston_desktop_wl_shell_surface *surface =
|
||||
+ weston_desktop_surface_get_implementation_data(dsurface);
|
||||
+ struct weston_output *output = NULL;
|
||||
+
|
||||
+ if (output_resource != NULL)
|
||||
+ output = weston_head_from_resource(output_resource)->output;
|
||||
+
|
||||
+ weston_desktop_wl_shell_change_state(surface, FULLSCREEN, NULL, NULL);
|
||||
+ weston_desktop_api_fullscreen_requested(surface->desktop, dsurface,
|
||||
+ true, output);
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+weston_desktop_wl_shell_surface_protocol_set_popup(struct wl_client *wl_client,
|
||||
+ struct wl_resource *resource,
|
||||
+ struct wl_resource *seat_resource,
|
||||
+ uint32_t serial,
|
||||
+ struct wl_resource *parent_resource,
|
||||
+ int32_t x, int32_t y,
|
||||
+ enum wl_shell_surface_transient flags)
|
||||
+{
|
||||
+ struct weston_desktop_surface *dsurface =
|
||||
+ wl_resource_get_user_data(resource);
|
||||
+ struct weston_seat *wseat = wl_resource_get_user_data(seat_resource);
|
||||
+ struct weston_desktop_seat *seat = weston_desktop_seat_from_seat(wseat);
|
||||
+ struct weston_surface *parent =
|
||||
+ wl_resource_get_user_data(parent_resource);
|
||||
+ struct weston_desktop_surface *parent_surface;
|
||||
+ struct weston_desktop_wl_shell_surface *surface =
|
||||
+ weston_desktop_surface_get_implementation_data(dsurface);
|
||||
+ struct weston_surface *wsurface;
|
||||
+ struct weston_coord_surface offset;
|
||||
+
|
||||
+ /* Check that if we have a valid wseat we also got a valid desktop seat */
|
||||
+ if (wseat != NULL && seat == NULL) {
|
||||
+ wl_client_post_no_memory(wl_client);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ if (!weston_surface_is_desktop_surface(parent))
|
||||
+ return;
|
||||
+
|
||||
+ parent_surface = weston_surface_get_desktop_surface(parent);
|
||||
+ wsurface = weston_desktop_surface_get_surface(dsurface);
|
||||
+ offset = weston_coord_surface(x, y, wsurface);
|
||||
+
|
||||
+ weston_desktop_wl_shell_change_state(surface, POPUP,
|
||||
+ parent_surface, &offset);
|
||||
+ weston_desktop_surface_popup_grab(surface->surface, parent_surface, seat, serial);
|
||||
+ surface->popup_seat = seat;
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+weston_desktop_wl_shell_surface_protocol_set_maximized(struct wl_client *wl_client,
|
||||
+ struct wl_resource *resource,
|
||||
+ struct wl_resource *output_resource)
|
||||
+{
|
||||
+ struct weston_desktop_surface *dsurface =
|
||||
+ wl_resource_get_user_data(resource);
|
||||
+ struct weston_desktop_wl_shell_surface *surface =
|
||||
+ weston_desktop_surface_get_implementation_data(dsurface);
|
||||
+
|
||||
+ weston_desktop_wl_shell_change_state(surface, MAXIMIZED, NULL, NULL);
|
||||
+ weston_desktop_api_maximized_requested(surface->desktop, dsurface, true);
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+weston_desktop_wl_shell_surface_protocol_set_title(struct wl_client *wl_client,
|
||||
+ struct wl_resource *resource,
|
||||
+ const char *title)
|
||||
+{
|
||||
+ struct weston_desktop_surface *surface =
|
||||
+ wl_resource_get_user_data(resource);
|
||||
+
|
||||
+ weston_desktop_surface_set_title(surface, title);
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+weston_desktop_wl_shell_surface_protocol_set_class(struct wl_client *wl_client,
|
||||
+ struct wl_resource *resource,
|
||||
+ const char *class_)
|
||||
+{
|
||||
+ struct weston_desktop_surface *surface =
|
||||
+ wl_resource_get_user_data(resource);
|
||||
+
|
||||
+ weston_desktop_surface_set_app_id(surface, class_);
|
||||
+}
|
||||
+
|
||||
+
|
||||
+static const struct wl_shell_surface_interface weston_desktop_wl_shell_surface_implementation = {
|
||||
+ .pong = weston_desktop_wl_shell_surface_protocol_pong,
|
||||
+ .move = weston_desktop_wl_shell_surface_protocol_move,
|
||||
+ .resize = weston_desktop_wl_shell_surface_protocol_resize,
|
||||
+ .set_toplevel = weston_desktop_wl_shell_surface_protocol_set_toplevel,
|
||||
+ .set_transient = weston_desktop_wl_shell_surface_protocol_set_transient,
|
||||
+ .set_fullscreen = weston_desktop_wl_shell_surface_protocol_set_fullscreen,
|
||||
+ .set_popup = weston_desktop_wl_shell_surface_protocol_set_popup,
|
||||
+ .set_maximized = weston_desktop_wl_shell_surface_protocol_set_maximized,
|
||||
+ .set_title = weston_desktop_wl_shell_surface_protocol_set_title,
|
||||
+ .set_class = weston_desktop_wl_shell_surface_protocol_set_class,
|
||||
+};
|
||||
+
|
||||
+static const struct weston_desktop_surface_implementation weston_desktop_wl_shell_surface_internal_implementation = {
|
||||
+ .set_size = weston_desktop_wl_shell_surface_set_size,
|
||||
+ .committed = weston_desktop_wl_shell_surface_committed,
|
||||
+ .ping = weston_desktop_wl_shell_surface_ping,
|
||||
+ .close = weston_desktop_wl_shell_surface_close,
|
||||
+
|
||||
+ .get_maximized = weston_desktop_wl_shell_surface_get_maximized,
|
||||
+ .get_fullscreen = weston_desktop_wl_shell_surface_get_fullscreen,
|
||||
+
|
||||
+ .destroy = weston_desktop_wl_shell_surface_destroy,
|
||||
+};
|
||||
+
|
||||
+static void
|
||||
+wl_surface_resource_destroyed(struct wl_listener *listener,
|
||||
+ void *data)
|
||||
+{
|
||||
+ struct weston_desktop_wl_shell_surface *surface =
|
||||
+ wl_container_of(listener, surface,
|
||||
+ wl_surface_resource_destroy_listener);
|
||||
+
|
||||
+ /* the wl_shell_surface spec says that wl_shell_surfaces are to be
|
||||
+ * destroyed automatically when the wl_surface is destroyed. */
|
||||
+ weston_desktop_surface_destroy(surface->surface);
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+weston_desktop_wl_shell_protocol_get_shell_surface(struct wl_client *wl_client,
|
||||
+ struct wl_resource *resource,
|
||||
+ uint32_t id,
|
||||
+ struct wl_resource *surface_resource)
|
||||
+{
|
||||
+ struct weston_desktop_client *client = wl_resource_get_user_data(resource);
|
||||
+ struct weston_surface *wsurface = wl_resource_get_user_data(surface_resource);
|
||||
+ struct weston_desktop_wl_shell_surface *surface;
|
||||
+
|
||||
+
|
||||
+ if (weston_surface_set_role(wsurface, "wl_shell_surface", resource, WL_SHELL_ERROR_ROLE) < 0)
|
||||
+ return;
|
||||
+
|
||||
+ surface = zalloc(sizeof(struct weston_desktop_wl_shell_surface));
|
||||
+ if (surface == NULL) {
|
||||
+ wl_client_post_no_memory(wl_client);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ surface->desktop = weston_desktop_client_get_desktop(client);
|
||||
+ surface->display = weston_desktop_get_display(surface->desktop);
|
||||
+
|
||||
+ surface->surface =
|
||||
+ weston_desktop_surface_create(surface->desktop, client, wsurface,
|
||||
+ &weston_desktop_wl_shell_surface_internal_implementation,
|
||||
+ surface);
|
||||
+ if (surface->surface == NULL) {
|
||||
+ free(surface);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ surface->wl_surface_resource_destroy_listener.notify =
|
||||
+ wl_surface_resource_destroyed;
|
||||
+ wl_resource_add_destroy_listener(wsurface->resource,
|
||||
+ &surface->wl_surface_resource_destroy_listener);
|
||||
+
|
||||
+ surface->resource =
|
||||
+ weston_desktop_surface_add_resource(surface->surface,
|
||||
+ &wl_shell_surface_interface,
|
||||
+ &weston_desktop_wl_shell_surface_implementation,
|
||||
+ id, NULL);
|
||||
+}
|
||||
+
|
||||
+
|
||||
+static const struct wl_shell_interface weston_desktop_wl_shell_implementation = {
|
||||
+ .get_shell_surface = weston_desktop_wl_shell_protocol_get_shell_surface,
|
||||
+};
|
||||
+
|
||||
+static void
|
||||
+weston_desktop_wl_shell_bind(struct wl_client *client, void *data,
|
||||
+ uint32_t version, uint32_t id)
|
||||
+{
|
||||
+ struct weston_desktop *desktop = data;
|
||||
+
|
||||
+ weston_desktop_client_create(desktop, client, NULL, &wl_shell_interface,
|
||||
+ &weston_desktop_wl_shell_implementation,
|
||||
+ version, id);
|
||||
+}
|
||||
+
|
||||
+struct wl_global *
|
||||
+weston_desktop_wl_shell_create(struct weston_desktop *desktop,
|
||||
+ struct wl_display *display)
|
||||
+{
|
||||
+ return wl_global_create(display,
|
||||
+ &wl_shell_interface,
|
||||
+ WD_WL_SHELL_PROTOCOL_VERSION, desktop,
|
||||
+ weston_desktop_wl_shell_bind);
|
||||
+}
|
||||
diff --git a/meson.build b/meson.build
|
||||
index 2383273d..6adf97be 100644
|
||||
--- a/meson.build
|
||||
+++ b/meson.build
|
||||
@@ -133,6 +133,12 @@ if dep_xkbcommon.version().version_compare('>= 0.5.0')
|
||||
config_h.set('HAVE_XKBCOMMON_COMPOSE', '1')
|
||||
endif
|
||||
|
||||
+if get_option('deprecated-wl-shell')
|
||||
+ warning('Support for the deprecated wl_shell interface is enabled.')
|
||||
+ warning('This feature will be removed in a future version.')
|
||||
+ config_h.set('HAVE_DEPRECATED_WL_SHELL', '1')
|
||||
+endif
|
||||
+
|
||||
dep_wayland_server = dependency('wayland-server', version: '>= 1.22.0')
|
||||
dep_wayland_client = dependency('wayland-client', version: '>= 1.22.0')
|
||||
dep_pixman = dependency('pixman-1', version: '>= 0.25.2')
|
||||
diff --git a/meson_options.txt b/meson_options.txt
|
||||
index ac355f15..45dd733a 100644
|
||||
--- a/meson_options.txt
|
||||
+++ b/meson_options.txt
|
||||
@@ -137,6 +137,13 @@ option(
|
||||
description: 'Weston desktop shell: default helper client selection'
|
||||
)
|
||||
|
||||
+option(
|
||||
+ 'deprecated-wl-shell',
|
||||
+ type: 'boolean',
|
||||
+ value: false,
|
||||
+ description: 'Enable the deprecated wl_shell protocol'
|
||||
+)
|
||||
+
|
||||
option(
|
||||
'color-management-lcms',
|
||||
type: 'boolean',
|
||||
|
||||
|
|
@ -5,8 +5,6 @@ SRC_URI:append:stm32mpcommon = " \
|
|||
file://0002-Disable-request-to-EGL_DRM_RENDER_NODE_FILE_EXT.patch \
|
||||
file://0003-Revert-compositor-improve-opacity-handling-for-scale.patch \
|
||||
file://0004-Revert-compositor-set-transform.opaque-for-surfaces-.patch \
|
||||
file://0005-Revert-libweston-libinput-device-Enable-Set-pointer-.patch \
|
||||
file://0006-Restore-wl_shell-to-weston-13.patch \
|
||||
"
|
||||
|
||||
SIMPLECLIENTS="egl,touch,dmabuf-v4l,dmabuf-egl"
|
||||
|
|
@ -24,4 +22,3 @@ PACKAGECONFIG ??= "${@bb.utils.contains('DISTRO_FEATURES', 'wayland', 'kms wayla
|
|||
remoting \
|
||||
"
|
||||
|
||||
EXTRA_OEMESON += "-Ddeprecated-wl-shell=true"
|
||||
|
|
|
|||
|
|
@ -1,934 +0,0 @@
|
|||
From: Gabriel Valcazar <gabriel.valcazar@digi.com>
|
||||
Date: Fri, 19 Jan 2024 09:45:19 +0100
|
||||
Subject: [PATCH] Restore wl_shell to weston 12
|
||||
|
||||
This shell was deprecated some time ago and removed in weston 12, but it's the
|
||||
default shell used by LVGL's wayland backend. Until we migrate said backend to
|
||||
use xdg_shell, restore wl_shell in weston 12.
|
||||
|
||||
This reverts the following commits:
|
||||
|
||||
* d40cedc8af9a42e1f6746fb58f4556080c6ff133
|
||||
* 7cae2a1fb0aeec24ca33ac4c7cbb268f77095cb5
|
||||
* e6b8f5a5e40cd6c0b934e8ae079c86d5193efa96
|
||||
|
||||
Upstream-Status: Inappropriate [DEY specific]
|
||||
|
||||
Signed-off-by: Gabriel Valcazar <gabriel.valcazar@digi.com>
|
||||
---
|
||||
desktop-shell/shell.c | 26 +-
|
||||
libweston/backend-wayland/wayland.c | 87 ++++-
|
||||
libweston/desktop/internal.h | 4 +
|
||||
libweston/desktop/libweston-desktop.c | 19 +
|
||||
libweston/desktop/meson.build | 1 +
|
||||
libweston/desktop/wl-shell.c | 497 ++++++++++++++++++++++++++
|
||||
meson.build | 6 +
|
||||
meson_options.txt | 7 +
|
||||
8 files changed, 630 insertions(+), 17 deletions(-)
|
||||
create mode 100644 libweston/desktop/wl-shell.c
|
||||
|
||||
diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
|
||||
index abc151e24f86..abf054e8bfcd 100644
|
||||
--- a/desktop-shell/shell.c
|
||||
+++ b/desktop-shell/shell.c
|
||||
@@ -1367,16 +1367,16 @@ resize_grab_motion(struct weston_pointer_grab *grab,
|
||||
to_y = wl_fixed_from_double(tmp_s.c.y);
|
||||
|
||||
width = resize->width;
|
||||
- if (resize->edges & WESTON_DESKTOP_SURFACE_EDGE_LEFT) {
|
||||
+ if (resize->edges & WL_SHELL_SURFACE_RESIZE_LEFT) {
|
||||
width += wl_fixed_to_int(from_x - to_x);
|
||||
- } else if (resize->edges & WESTON_DESKTOP_SURFACE_EDGE_RIGHT) {
|
||||
+ } else if (resize->edges & WL_SHELL_SURFACE_RESIZE_RIGHT) {
|
||||
width += wl_fixed_to_int(to_x - from_x);
|
||||
}
|
||||
|
||||
height = resize->height;
|
||||
- if (resize->edges & WESTON_DESKTOP_SURFACE_EDGE_TOP) {
|
||||
+ if (resize->edges & WL_SHELL_SURFACE_RESIZE_TOP) {
|
||||
height += wl_fixed_to_int(from_y - to_y);
|
||||
- } else if (resize->edges & WESTON_DESKTOP_SURFACE_EDGE_BOTTOM) {
|
||||
+ } else if (resize->edges & WL_SHELL_SURFACE_RESIZE_BOTTOM) {
|
||||
height += wl_fixed_to_int(to_y - from_y);
|
||||
}
|
||||
|
||||
@@ -1454,9 +1454,9 @@ surface_resize(struct shell_surface *shsurf,
|
||||
{
|
||||
struct weston_resize_grab *resize;
|
||||
const unsigned resize_topbottom =
|
||||
- WESTON_DESKTOP_SURFACE_EDGE_TOP | WESTON_DESKTOP_SURFACE_EDGE_BOTTOM;
|
||||
+ WL_SHELL_SURFACE_RESIZE_TOP | WL_SHELL_SURFACE_RESIZE_BOTTOM;
|
||||
const unsigned resize_leftright =
|
||||
- WESTON_DESKTOP_SURFACE_EDGE_LEFT | WESTON_DESKTOP_SURFACE_EDGE_RIGHT;
|
||||
+ WL_SHELL_SURFACE_RESIZE_LEFT | WL_SHELL_SURFACE_RESIZE_RIGHT;
|
||||
const unsigned resize_any = resize_topbottom | resize_leftright;
|
||||
struct weston_geometry geometry;
|
||||
|
||||
@@ -1466,7 +1466,7 @@ surface_resize(struct shell_surface *shsurf,
|
||||
return 0;
|
||||
|
||||
/* Check for invalid edge combinations. */
|
||||
- if (edges == WESTON_DESKTOP_SURFACE_EDGE_NONE || edges > resize_any ||
|
||||
+ if (edges == WL_SHELL_SURFACE_RESIZE_NONE || edges > resize_any ||
|
||||
(edges & resize_topbottom) == resize_topbottom ||
|
||||
(edges & resize_leftright) == resize_leftright)
|
||||
return 0;
|
||||
@@ -2469,9 +2469,9 @@ desktop_surface_committed(struct weston_desktop_surface *desktop_surface,
|
||||
sy = 0;
|
||||
}
|
||||
|
||||
- if (shsurf->resize_edges & WESTON_DESKTOP_SURFACE_EDGE_LEFT)
|
||||
+ if (shsurf->resize_edges & WL_SHELL_SURFACE_RESIZE_LEFT)
|
||||
sx = shsurf->last_width - surface->width;
|
||||
- if (shsurf->resize_edges & WESTON_DESKTOP_SURFACE_EDGE_TOP)
|
||||
+ if (shsurf->resize_edges & WL_SHELL_SURFACE_RESIZE_TOP)
|
||||
sy = shsurf->last_height - surface->height;
|
||||
|
||||
to_s = weston_coord_surface(sx, sy, view->surface);
|
||||
@@ -3450,18 +3450,18 @@ resize_binding(struct weston_pointer *pointer, const struct timespec *time,
|
||||
y = surf_pos.c.y;
|
||||
|
||||
if (x < surface->width / 3)
|
||||
- edges |= WESTON_DESKTOP_SURFACE_EDGE_LEFT;
|
||||
+ edges |= WL_SHELL_SURFACE_RESIZE_LEFT;
|
||||
else if (x < 2 * surface->width / 3)
|
||||
edges |= 0;
|
||||
else
|
||||
- edges |= WESTON_DESKTOP_SURFACE_EDGE_RIGHT;
|
||||
+ edges |= WL_SHELL_SURFACE_RESIZE_RIGHT;
|
||||
|
||||
if (y < surface->height / 3)
|
||||
- edges |= WESTON_DESKTOP_SURFACE_EDGE_TOP;
|
||||
+ edges |= WL_SHELL_SURFACE_RESIZE_TOP;
|
||||
else if (y < 2 * surface->height / 3)
|
||||
edges |= 0;
|
||||
else
|
||||
- edges |= WESTON_DESKTOP_SURFACE_EDGE_BOTTOM;
|
||||
+ edges |= WL_SHELL_SURFACE_RESIZE_BOTTOM;
|
||||
|
||||
surface_resize(shsurf, pointer, edges);
|
||||
}
|
||||
diff --git a/libweston/backend-wayland/wayland.c b/libweston/backend-wayland/wayland.c
|
||||
index 48c21b99afec..7a82b1a61ee1 100644
|
||||
--- a/libweston/backend-wayland/wayland.c
|
||||
+++ b/libweston/backend-wayland/wayland.c
|
||||
@@ -85,6 +85,7 @@ struct wayland_backend {
|
||||
struct wl_display *wl_display;
|
||||
struct wl_registry *registry;
|
||||
struct wl_compositor *compositor;
|
||||
+ struct wl_shell *shell;
|
||||
struct xdg_wm_base *xdg_wm_base;
|
||||
struct zwp_fullscreen_shell_v1 *fshell;
|
||||
struct wl_shm *shm;
|
||||
@@ -123,6 +124,7 @@ struct wayland_output {
|
||||
struct wl_output *output;
|
||||
uint32_t global_id;
|
||||
|
||||
+ struct wl_shell_surface *shell_surface;
|
||||
struct xdg_surface *xdg_surface;
|
||||
struct xdg_toplevel *xdg_toplevel;
|
||||
int configure_width, configure_height;
|
||||
@@ -665,6 +667,11 @@ wayland_backend_destroy_output_surface(struct wayland_output *output)
|
||||
output->parent.xdg_surface = NULL;
|
||||
}
|
||||
|
||||
+ if (output->parent.shell_surface) {
|
||||
+ wl_shell_surface_destroy(output->parent.shell_surface);
|
||||
+ output->parent.shell_surface = NULL;
|
||||
+ }
|
||||
+
|
||||
wl_surface_destroy(output->parent.surface);
|
||||
output->parent.surface = NULL;
|
||||
}
|
||||
@@ -737,6 +744,8 @@ wayland_output_destroy(struct weston_output *base)
|
||||
free(output);
|
||||
}
|
||||
|
||||
+static const struct wl_shell_surface_listener shell_surface_listener;
|
||||
+
|
||||
#ifdef ENABLE_EGL
|
||||
static int
|
||||
wayland_output_init_gl_renderer(struct wayland_output *output)
|
||||
@@ -899,6 +908,8 @@ wayland_output_set_windowed(struct wayland_output *output)
|
||||
|
||||
if (output->parent.xdg_toplevel) {
|
||||
xdg_toplevel_unset_fullscreen(output->parent.xdg_toplevel);
|
||||
+ } else if (output->parent.shell_surface) {
|
||||
+ wl_shell_surface_set_toplevel(output->parent.shell_surface);
|
||||
} else {
|
||||
abort();
|
||||
}
|
||||
@@ -908,6 +919,7 @@ wayland_output_set_windowed(struct wayland_output *output)
|
||||
|
||||
static void
|
||||
wayland_output_set_fullscreen(struct wayland_output *output,
|
||||
+ enum wl_shell_surface_fullscreen_method method,
|
||||
uint32_t framerate, struct wl_output *target)
|
||||
{
|
||||
if (output->frame) {
|
||||
@@ -919,6 +931,9 @@ wayland_output_set_fullscreen(struct wayland_output *output,
|
||||
|
||||
if (output->parent.xdg_toplevel) {
|
||||
xdg_toplevel_set_fullscreen(output->parent.xdg_toplevel, target);
|
||||
+ } else if (output->parent.shell_surface) {
|
||||
+ wl_shell_surface_set_fullscreen(output->parent.shell_surface,
|
||||
+ method, framerate, target);
|
||||
} else {
|
||||
abort();
|
||||
}
|
||||
@@ -1139,7 +1154,7 @@ wayland_output_switch_mode(struct weston_output *output_base,
|
||||
|
||||
if (output->parent.xdg_surface)
|
||||
return wayland_output_switch_mode_xdg(output, mode);
|
||||
- if (output->backend->parent.fshell)
|
||||
+ if (output->backend->parent.fshell || output->parent.shell_surface)
|
||||
return wayland_output_switch_mode_fshell(output, mode);
|
||||
|
||||
return -1;
|
||||
@@ -1245,6 +1260,20 @@ wayland_backend_create_output_surface(struct wayland_output *output)
|
||||
|
||||
weston_log("wayland-backend: Using xdg_wm_base\n");
|
||||
}
|
||||
+ else if (b->parent.shell) {
|
||||
+ output->parent.shell_surface =
|
||||
+ wl_shell_get_shell_surface(b->parent.shell,
|
||||
+ output->parent.surface);
|
||||
+ if (!output->parent.shell_surface) {
|
||||
+ wl_surface_destroy(output->parent.surface);
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ wl_shell_surface_add_listener(output->parent.shell_surface,
|
||||
+ &shell_surface_listener, output);
|
||||
+
|
||||
+ weston_log("wayland-backend: Using wl_shell\n");
|
||||
+ }
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1309,9 +1338,13 @@ wayland_output_enable(struct weston_output *base)
|
||||
|
||||
output->parent.draw_initial_frame = true;
|
||||
}
|
||||
+ } else {
|
||||
+ wayland_output_set_fullscreen(output,
|
||||
+ WL_SHELL_SURFACE_FULLSCREEN_METHOD_DRIVER,
|
||||
+ output->mode.refresh, output->parent.output);
|
||||
}
|
||||
} else if (b->fullscreen) {
|
||||
- wayland_output_set_fullscreen(output, 0, NULL);
|
||||
+ wayland_output_set_fullscreen(output, 0, 0, NULL);
|
||||
} else {
|
||||
wayland_output_set_windowed(output);
|
||||
}
|
||||
@@ -1600,10 +1633,13 @@ wayland_output_setup_fullscreen(struct wayland_output *output,
|
||||
return -1;
|
||||
|
||||
/* What should size be set if conditional is false? */
|
||||
- if (b->parent.xdg_wm_base) {
|
||||
+ if (b->parent.xdg_wm_base || b->parent.shell) {
|
||||
if (output->parent.xdg_toplevel)
|
||||
xdg_toplevel_set_fullscreen(output->parent.xdg_toplevel,
|
||||
output->parent.output);
|
||||
+ else if (output->parent.shell_surface)
|
||||
+ wl_shell_surface_set_fullscreen(output->parent.shell_surface,
|
||||
+ 0, 0, NULL);
|
||||
|
||||
wl_display_roundtrip(b->parent.wl_display);
|
||||
|
||||
@@ -1627,6 +1663,36 @@ err_set_size:
|
||||
return -1;
|
||||
}
|
||||
|
||||
+static void
|
||||
+shell_surface_ping(void *data, struct wl_shell_surface *shell_surface,
|
||||
+ uint32_t serial)
|
||||
+{
|
||||
+ wl_shell_surface_pong(shell_surface, serial);
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+shell_surface_configure(void *data, struct wl_shell_surface *shell_surface,
|
||||
+ uint32_t edges, int32_t width, int32_t height)
|
||||
+{
|
||||
+ struct wayland_output *output = data;
|
||||
+
|
||||
+ output->parent.configure_width = width;
|
||||
+ output->parent.configure_height = height;
|
||||
+
|
||||
+ /* FIXME: implement resizing */
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+shell_surface_popup_done(void *data, struct wl_shell_surface *shell_surface)
|
||||
+{
|
||||
+}
|
||||
+
|
||||
+static const struct wl_shell_surface_listener shell_surface_listener = {
|
||||
+ shell_surface_ping,
|
||||
+ shell_surface_configure,
|
||||
+ shell_surface_popup_done
|
||||
+};
|
||||
+
|
||||
/* Events received from the wayland-server this compositor is client of: */
|
||||
|
||||
/* parent input interface */
|
||||
@@ -1808,6 +1874,9 @@ input_handle_button(void *data, struct wl_pointer *pointer,
|
||||
if (input->output->parent.xdg_toplevel)
|
||||
xdg_toplevel_move(input->output->parent.xdg_toplevel,
|
||||
input->parent.seat, serial);
|
||||
+ else if (input->output->parent.shell_surface)
|
||||
+ wl_shell_surface_move(input->output->parent.shell_surface,
|
||||
+ input->parent.seat, serial);
|
||||
frame_status_clear(input->output->frame,
|
||||
FRAME_STATUS_MOVE);
|
||||
return;
|
||||
@@ -2169,6 +2238,9 @@ input_handle_touch_down(void *data, struct wl_touch *wl_touch,
|
||||
if (output->parent.xdg_toplevel)
|
||||
xdg_toplevel_move(output->parent.xdg_toplevel,
|
||||
input->parent.seat, serial);
|
||||
+ else if (output->parent.shell_surface)
|
||||
+ wl_shell_surface_move(output->parent.shell_surface,
|
||||
+ input->parent.seat, serial);
|
||||
frame_status_clear(output->frame,
|
||||
FRAME_STATUS_MOVE);
|
||||
return;
|
||||
@@ -2683,6 +2755,10 @@ registry_handle_global(void *data, struct wl_registry *registry, uint32_t name,
|
||||
&xdg_wm_base_interface, 1);
|
||||
xdg_wm_base_add_listener(b->parent.xdg_wm_base,
|
||||
&wm_base_listener, b);
|
||||
+ } else if (strcmp(interface, "wl_shell") == 0) {
|
||||
+ b->parent.shell =
|
||||
+ wl_registry_bind(registry, name,
|
||||
+ &wl_shell_interface, 1);
|
||||
} else if (strcmp(interface, "zwp_fullscreen_shell_v1") == 0) {
|
||||
b->parent.fshell =
|
||||
wl_registry_bind(registry, name,
|
||||
@@ -2778,6 +2854,9 @@ wayland_destroy(struct weston_backend *backend)
|
||||
if (b->parent.xdg_wm_base)
|
||||
xdg_wm_base_destroy(b->parent.xdg_wm_base);
|
||||
|
||||
+ if (b->parent.shell)
|
||||
+ wl_shell_destroy(b->parent.shell);
|
||||
+
|
||||
if (b->parent.fshell)
|
||||
zwp_fullscreen_shell_v1_release(b->parent.fshell);
|
||||
|
||||
@@ -2847,7 +2926,7 @@ fullscreen_binding(struct weston_keyboard *keyboard,
|
||||
return;
|
||||
|
||||
if (input->output->frame)
|
||||
- wayland_output_set_fullscreen(input->output, 0, NULL);
|
||||
+ wayland_output_set_fullscreen(input->output, 0, 0, NULL);
|
||||
else
|
||||
wayland_output_set_windowed(input->output);
|
||||
|
||||
diff --git a/libweston/desktop/internal.h b/libweston/desktop/internal.h
|
||||
index c8d09272c87d..41e81b1376ce 100644
|
||||
--- a/libweston/desktop/internal.h
|
||||
+++ b/libweston/desktop/internal.h
|
||||
@@ -249,6 +249,10 @@ weston_desktop_xdg_wm_base_create(struct weston_desktop *desktop,
|
||||
struct wl_global *
|
||||
weston_desktop_xdg_shell_v6_create(struct weston_desktop *desktop,
|
||||
struct wl_display *display);
|
||||
+struct wl_global *
|
||||
+weston_desktop_wl_shell_create(struct weston_desktop *desktop,
|
||||
+ struct wl_display *display);
|
||||
+
|
||||
void
|
||||
weston_desktop_xwayland_init(struct weston_desktop *desktop);
|
||||
void
|
||||
diff --git a/libweston/desktop/libweston-desktop.c b/libweston/desktop/libweston-desktop.c
|
||||
index 05240cfbb32e..b74ee09fb021 100644
|
||||
--- a/libweston/desktop/libweston-desktop.c
|
||||
+++ b/libweston/desktop/libweston-desktop.c
|
||||
@@ -42,6 +42,7 @@ struct weston_desktop {
|
||||
void *user_data;
|
||||
struct wl_global *xdg_wm_base; /* Stable protocol xdg_shell replaces xdg_shell_unstable_v6 */
|
||||
struct wl_global *xdg_shell_v6; /* Unstable xdg_shell_unstable_v6 protocol. */
|
||||
+ struct wl_global *wl_shell;
|
||||
};
|
||||
|
||||
void
|
||||
@@ -76,6 +77,22 @@ weston_desktop_create(struct weston_compositor *compositor,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
+#ifdef HAVE_DEPRECATED_WL_SHELL
|
||||
+ weston_log("Warning: support for deprecated wl_shell interface is "
|
||||
+ "enabled. Please migrate legacy clients to xdg-shell.\n");
|
||||
+ desktop->wl_shell =
|
||||
+ weston_desktop_wl_shell_create(desktop, display);
|
||||
+ if (desktop->wl_shell == NULL) {
|
||||
+ weston_desktop_destroy(desktop);
|
||||
+ return NULL;
|
||||
+ }
|
||||
+#else
|
||||
+ weston_log("Note: support for the deprecated wl_shell interface is "
|
||||
+ "disabled. If a legacy client still needs it, it can be "
|
||||
+ "re-enabled by passing -Ddeprecated-wl-shell=true to Meson "
|
||||
+ "when building Weston.\n");
|
||||
+#endif
|
||||
+
|
||||
weston_desktop_xwayland_init(desktop);
|
||||
|
||||
return desktop;
|
||||
@@ -89,6 +106,8 @@ weston_desktop_destroy(struct weston_desktop *desktop)
|
||||
|
||||
weston_desktop_xwayland_fini(desktop);
|
||||
|
||||
+ if (desktop->wl_shell != NULL)
|
||||
+ wl_global_destroy(desktop->wl_shell);
|
||||
if (desktop->xdg_shell_v6 != NULL)
|
||||
wl_global_destroy(desktop->xdg_shell_v6);
|
||||
if (desktop->xdg_wm_base != NULL)
|
||||
diff --git a/libweston/desktop/meson.build b/libweston/desktop/meson.build
|
||||
index 4588ad10676f..d8e1a709e04d 100644
|
||||
--- a/libweston/desktop/meson.build
|
||||
+++ b/libweston/desktop/meson.build
|
||||
@@ -4,6 +4,7 @@ srcs_libweston += files([
|
||||
'seat.c',
|
||||
'surface.c',
|
||||
'xwayland.c',
|
||||
+ 'wl-shell.c',
|
||||
'xdg-shell.c',
|
||||
'xdg-shell-v6.c',
|
||||
])
|
||||
diff --git a/libweston/desktop/wl-shell.c b/libweston/desktop/wl-shell.c
|
||||
new file mode 100644
|
||||
index 000000000000..26360de96bde
|
||||
--- /dev/null
|
||||
+++ b/libweston/desktop/wl-shell.c
|
||||
@@ -0,0 +1,497 @@
|
||||
+/*
|
||||
+ * Copyright © 2010-2012 Intel Corporation
|
||||
+ * Copyright © 2011-2012 Collabora, Ltd.
|
||||
+ * Copyright © 2013 Raspberry Pi Foundation
|
||||
+ * Copyright © 2016 Quentin "Sardem FF7" Glidic
|
||||
+ *
|
||||
+ * Permission is hereby granted, free of charge, to any person obtaining a
|
||||
+ * copy of this software and associated documentation files (the "Software"),
|
||||
+ * to deal in the Software without restriction, including without limitation
|
||||
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
+ * and/or sell copies of the Software, and to permit persons to whom the
|
||||
+ * Software is furnished to do so, subject to the following conditions:
|
||||
+ *
|
||||
+ * The above copyright notice and this permission notice (including the next
|
||||
+ * paragraph) shall be included in all copies or substantial portions of the
|
||||
+ * Software.
|
||||
+ *
|
||||
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
+ * DEALINGS IN THE SOFTWARE.
|
||||
+ */
|
||||
+
|
||||
+#include "config.h"
|
||||
+
|
||||
+#include <assert.h>
|
||||
+
|
||||
+#include <wayland-server.h>
|
||||
+
|
||||
+#include <libweston/libweston.h>
|
||||
+#include <libweston/zalloc.h>
|
||||
+
|
||||
+#include <libweston/desktop.h>
|
||||
+#include "internal.h"
|
||||
+
|
||||
+#define WD_WL_SHELL_PROTOCOL_VERSION 1
|
||||
+
|
||||
+enum weston_desktop_wl_shell_surface_state {
|
||||
+ NONE,
|
||||
+ TOPLEVEL,
|
||||
+ MAXIMIZED,
|
||||
+ FULLSCREEN,
|
||||
+ TRANSIENT,
|
||||
+ POPUP,
|
||||
+};
|
||||
+
|
||||
+struct weston_desktop_wl_shell_surface {
|
||||
+ struct wl_resource *resource;
|
||||
+ struct weston_desktop *desktop;
|
||||
+ struct wl_display *display;
|
||||
+ struct weston_desktop_surface *surface;
|
||||
+ struct weston_desktop_surface *parent;
|
||||
+ bool added;
|
||||
+ struct weston_desktop_seat *popup_seat;
|
||||
+ enum weston_desktop_wl_shell_surface_state state;
|
||||
+ struct wl_listener wl_surface_resource_destroy_listener;
|
||||
+};
|
||||
+
|
||||
+static void
|
||||
+weston_desktop_wl_shell_surface_set_size(struct weston_desktop_surface *dsurface,
|
||||
+ void *user_data,
|
||||
+ int32_t width, int32_t height)
|
||||
+{
|
||||
+ struct weston_desktop_wl_shell_surface *surface = user_data;
|
||||
+ struct weston_surface *wsurface =
|
||||
+ weston_desktop_surface_get_surface(surface->surface);
|
||||
+
|
||||
+ if ((wsurface->width == width && wsurface->height == height) ||
|
||||
+ (width == 0 && height == 0))
|
||||
+ return;
|
||||
+
|
||||
+ wl_shell_surface_send_configure(surface->resource,
|
||||
+ WL_SHELL_SURFACE_RESIZE_NONE,
|
||||
+ width, height);
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+weston_desktop_wl_shell_surface_maybe_ungrab(struct weston_desktop_wl_shell_surface *surface)
|
||||
+{
|
||||
+ if (surface->state != POPUP ||
|
||||
+ !weston_desktop_surface_get_grab(surface->surface))
|
||||
+ return;
|
||||
+
|
||||
+ weston_desktop_surface_popup_ungrab(surface->surface,
|
||||
+ surface->popup_seat);
|
||||
+ surface->popup_seat = NULL;
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+weston_desktop_wl_shell_surface_committed(struct weston_desktop_surface *dsurface,
|
||||
+ void *user_data,
|
||||
+ int32_t sx, int32_t sy)
|
||||
+{
|
||||
+ struct weston_desktop_wl_shell_surface *surface = user_data;
|
||||
+ struct weston_surface *wsurface =
|
||||
+ weston_desktop_surface_get_surface(dsurface);
|
||||
+
|
||||
+ if (wsurface->buffer_ref.buffer == NULL)
|
||||
+ weston_desktop_wl_shell_surface_maybe_ungrab(surface);
|
||||
+
|
||||
+ if (surface->added)
|
||||
+ weston_desktop_api_committed(surface->desktop, surface->surface,
|
||||
+ sx, sy);
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+weston_desktop_wl_shell_surface_ping(struct weston_desktop_surface *dsurface,
|
||||
+ uint32_t serial, void *user_data)
|
||||
+{
|
||||
+ struct weston_desktop_wl_shell_surface *surface = user_data;
|
||||
+
|
||||
+ wl_shell_surface_send_ping(surface->resource, serial);
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+weston_desktop_wl_shell_surface_close(struct weston_desktop_surface *dsurface,
|
||||
+ void *user_data)
|
||||
+{
|
||||
+ struct weston_desktop_wl_shell_surface *surface = user_data;
|
||||
+
|
||||
+ if (surface->state == POPUP)
|
||||
+ wl_shell_surface_send_popup_done(surface->resource);
|
||||
+}
|
||||
+
|
||||
+static bool
|
||||
+weston_desktop_wl_shell_surface_get_maximized(struct weston_desktop_surface *dsurface,
|
||||
+ void *user_data)
|
||||
+{
|
||||
+ struct weston_desktop_wl_shell_surface *surface = user_data;
|
||||
+
|
||||
+ return surface->state == MAXIMIZED;
|
||||
+}
|
||||
+
|
||||
+static bool
|
||||
+weston_desktop_wl_shell_surface_get_fullscreen(struct weston_desktop_surface *dsurface,
|
||||
+ void *user_data)
|
||||
+{
|
||||
+ struct weston_desktop_wl_shell_surface *surface = user_data;
|
||||
+
|
||||
+ return surface->state == FULLSCREEN;
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+weston_desktop_wl_shell_change_state(struct weston_desktop_wl_shell_surface *surface,
|
||||
+ enum weston_desktop_wl_shell_surface_state state,
|
||||
+ struct weston_desktop_surface *parent,
|
||||
+ int32_t x, int32_t y)
|
||||
+{
|
||||
+ bool to_add = (parent == NULL);
|
||||
+
|
||||
+ assert(state != NONE);
|
||||
+
|
||||
+ if (to_add && surface->added) {
|
||||
+ surface->state = state;
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ if (surface->state != state) {
|
||||
+ if (surface->state == POPUP)
|
||||
+ weston_desktop_wl_shell_surface_maybe_ungrab(surface);
|
||||
+
|
||||
+ if (to_add) {
|
||||
+ weston_desktop_surface_unset_relative_to(surface->surface);
|
||||
+ weston_desktop_api_surface_added(surface->desktop,
|
||||
+ surface->surface);
|
||||
+ } else if (surface->added) {
|
||||
+ weston_desktop_api_surface_removed(surface->desktop,
|
||||
+ surface->surface);
|
||||
+ }
|
||||
+
|
||||
+ surface->state = state;
|
||||
+ surface->added = to_add;
|
||||
+ }
|
||||
+
|
||||
+ if (parent != NULL)
|
||||
+ weston_desktop_surface_set_relative_to(surface->surface, parent,
|
||||
+ x, y, false);
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+weston_desktop_wl_shell_surface_destroy(struct weston_desktop_surface *dsurface,
|
||||
+ void *user_data)
|
||||
+{
|
||||
+ struct weston_desktop_wl_shell_surface *surface = user_data;
|
||||
+
|
||||
+ wl_list_remove(&surface->wl_surface_resource_destroy_listener.link);
|
||||
+
|
||||
+ weston_desktop_wl_shell_surface_maybe_ungrab(surface);
|
||||
+ weston_desktop_surface_unset_relative_to(surface->surface);
|
||||
+ if (surface->added)
|
||||
+ weston_desktop_api_surface_removed(surface->desktop,
|
||||
+ surface->surface);
|
||||
+
|
||||
+ free(surface);
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+weston_desktop_wl_shell_surface_protocol_pong(struct wl_client *wl_client,
|
||||
+ struct wl_resource *resource,
|
||||
+ uint32_t serial)
|
||||
+{
|
||||
+ struct weston_desktop_surface *surface = wl_resource_get_user_data(resource);
|
||||
+
|
||||
+ weston_desktop_client_pong(weston_desktop_surface_get_client(surface), serial);
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+weston_desktop_wl_shell_surface_protocol_move(struct wl_client *wl_client,
|
||||
+ struct wl_resource *resource,
|
||||
+ struct wl_resource *seat_resource,
|
||||
+ uint32_t serial)
|
||||
+{
|
||||
+ struct weston_desktop_surface *dsurface =
|
||||
+ wl_resource_get_user_data(resource);
|
||||
+ struct weston_seat *seat =
|
||||
+ wl_resource_get_user_data(seat_resource);
|
||||
+ struct weston_desktop_wl_shell_surface *surface =
|
||||
+ weston_desktop_surface_get_implementation_data(dsurface);
|
||||
+
|
||||
+ if (seat == NULL)
|
||||
+ return;
|
||||
+
|
||||
+ weston_desktop_api_move(surface->desktop, dsurface, seat, serial);
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+weston_desktop_wl_shell_surface_protocol_resize(struct wl_client *wl_client,
|
||||
+ struct wl_resource *resource,
|
||||
+ struct wl_resource *seat_resource,
|
||||
+ uint32_t serial,
|
||||
+ enum wl_shell_surface_resize edges)
|
||||
+{
|
||||
+ struct weston_desktop_surface *dsurface =
|
||||
+ wl_resource_get_user_data(resource);
|
||||
+ struct weston_seat *seat = wl_resource_get_user_data(seat_resource);
|
||||
+ struct weston_desktop_wl_shell_surface *surface =
|
||||
+ weston_desktop_surface_get_implementation_data(dsurface);
|
||||
+ enum weston_desktop_surface_edge surf_edges =
|
||||
+ (enum weston_desktop_surface_edge) edges;
|
||||
+
|
||||
+ if (seat == NULL)
|
||||
+ return;
|
||||
+
|
||||
+ weston_desktop_api_resize(surface->desktop, dsurface, seat, serial, surf_edges);
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+weston_desktop_wl_shell_surface_protocol_set_toplevel(struct wl_client *wl_client,
|
||||
+ struct wl_resource *resource)
|
||||
+{
|
||||
+ struct weston_desktop_surface *dsurface =
|
||||
+ wl_resource_get_user_data(resource);
|
||||
+ struct weston_desktop_wl_shell_surface *surface =
|
||||
+ weston_desktop_surface_get_implementation_data(dsurface);
|
||||
+
|
||||
+ weston_desktop_wl_shell_change_state(surface, TOPLEVEL, NULL, 0, 0);
|
||||
+ if (surface->parent == NULL)
|
||||
+ return;
|
||||
+ surface->parent = NULL;
|
||||
+ weston_desktop_api_set_parent(surface->desktop, surface->surface, NULL);
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+weston_desktop_wl_shell_surface_protocol_set_transient(struct wl_client *wl_client,
|
||||
+ struct wl_resource *resource,
|
||||
+ struct wl_resource *parent_resource,
|
||||
+ int32_t x, int32_t y,
|
||||
+ enum wl_shell_surface_transient flags)
|
||||
+{
|
||||
+ struct weston_desktop_surface *dsurface =
|
||||
+ wl_resource_get_user_data(resource);
|
||||
+ struct weston_surface *wparent =
|
||||
+ wl_resource_get_user_data(parent_resource);
|
||||
+ struct weston_desktop_surface *parent;
|
||||
+ struct weston_desktop_wl_shell_surface *surface =
|
||||
+ weston_desktop_surface_get_implementation_data(dsurface);
|
||||
+
|
||||
+ if (!weston_surface_is_desktop_surface(wparent))
|
||||
+ return;
|
||||
+
|
||||
+ parent = weston_surface_get_desktop_surface(wparent);
|
||||
+ if (flags & WL_SHELL_SURFACE_TRANSIENT_INACTIVE) {
|
||||
+ weston_desktop_wl_shell_change_state(surface, TRANSIENT, parent,
|
||||
+ x, y);
|
||||
+ } else {
|
||||
+ weston_desktop_wl_shell_change_state(surface, TOPLEVEL, NULL,
|
||||
+ 0, 0);
|
||||
+ surface->parent = parent;
|
||||
+ weston_desktop_api_set_parent(surface->desktop,
|
||||
+ surface->surface, parent);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+weston_desktop_wl_shell_surface_protocol_set_fullscreen(struct wl_client *wl_client,
|
||||
+ struct wl_resource *resource,
|
||||
+ enum wl_shell_surface_fullscreen_method method,
|
||||
+ uint32_t framerate,
|
||||
+ struct wl_resource *output_resource)
|
||||
+{
|
||||
+ struct weston_desktop_surface *dsurface =
|
||||
+ wl_resource_get_user_data(resource);
|
||||
+ struct weston_desktop_wl_shell_surface *surface =
|
||||
+ weston_desktop_surface_get_implementation_data(dsurface);
|
||||
+ struct weston_output *output = NULL;
|
||||
+
|
||||
+ if (output_resource != NULL)
|
||||
+ output = weston_head_from_resource(output_resource)->output;
|
||||
+
|
||||
+ weston_desktop_wl_shell_change_state(surface, FULLSCREEN, NULL, 0, 0);
|
||||
+ weston_desktop_api_fullscreen_requested(surface->desktop, dsurface,
|
||||
+ true, output);
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+weston_desktop_wl_shell_surface_protocol_set_popup(struct wl_client *wl_client,
|
||||
+ struct wl_resource *resource,
|
||||
+ struct wl_resource *seat_resource,
|
||||
+ uint32_t serial,
|
||||
+ struct wl_resource *parent_resource,
|
||||
+ int32_t x, int32_t y,
|
||||
+ enum wl_shell_surface_transient flags)
|
||||
+{
|
||||
+ struct weston_desktop_surface *dsurface =
|
||||
+ wl_resource_get_user_data(resource);
|
||||
+ struct weston_seat *wseat = wl_resource_get_user_data(seat_resource);
|
||||
+ struct weston_desktop_seat *seat = weston_desktop_seat_from_seat(wseat);
|
||||
+ struct weston_surface *parent =
|
||||
+ wl_resource_get_user_data(parent_resource);
|
||||
+ struct weston_desktop_surface *parent_surface;
|
||||
+ struct weston_desktop_wl_shell_surface *surface =
|
||||
+ weston_desktop_surface_get_implementation_data(dsurface);
|
||||
+
|
||||
+ /* Check that if we have a valid wseat we also got a valid desktop seat */
|
||||
+ if (wseat != NULL && seat == NULL) {
|
||||
+ wl_client_post_no_memory(wl_client);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ if (!weston_surface_is_desktop_surface(parent))
|
||||
+ return;
|
||||
+
|
||||
+ parent_surface = weston_surface_get_desktop_surface(parent);
|
||||
+
|
||||
+ weston_desktop_wl_shell_change_state(surface, POPUP,
|
||||
+ parent_surface, x, y);
|
||||
+ weston_desktop_surface_popup_grab(surface->surface, parent_surface, seat, serial);
|
||||
+ surface->popup_seat = seat;
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+weston_desktop_wl_shell_surface_protocol_set_maximized(struct wl_client *wl_client,
|
||||
+ struct wl_resource *resource,
|
||||
+ struct wl_resource *output_resource)
|
||||
+{
|
||||
+ struct weston_desktop_surface *dsurface =
|
||||
+ wl_resource_get_user_data(resource);
|
||||
+ struct weston_desktop_wl_shell_surface *surface =
|
||||
+ weston_desktop_surface_get_implementation_data(dsurface);
|
||||
+
|
||||
+ weston_desktop_wl_shell_change_state(surface, MAXIMIZED, NULL, 0, 0);
|
||||
+ weston_desktop_api_maximized_requested(surface->desktop, dsurface, true);
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+weston_desktop_wl_shell_surface_protocol_set_title(struct wl_client *wl_client,
|
||||
+ struct wl_resource *resource,
|
||||
+ const char *title)
|
||||
+{
|
||||
+ struct weston_desktop_surface *surface =
|
||||
+ wl_resource_get_user_data(resource);
|
||||
+
|
||||
+ weston_desktop_surface_set_title(surface, title);
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+weston_desktop_wl_shell_surface_protocol_set_class(struct wl_client *wl_client,
|
||||
+ struct wl_resource *resource,
|
||||
+ const char *class_)
|
||||
+{
|
||||
+ struct weston_desktop_surface *surface =
|
||||
+ wl_resource_get_user_data(resource);
|
||||
+
|
||||
+ weston_desktop_surface_set_app_id(surface, class_);
|
||||
+}
|
||||
+
|
||||
+
|
||||
+static const struct wl_shell_surface_interface weston_desktop_wl_shell_surface_implementation = {
|
||||
+ .pong = weston_desktop_wl_shell_surface_protocol_pong,
|
||||
+ .move = weston_desktop_wl_shell_surface_protocol_move,
|
||||
+ .resize = weston_desktop_wl_shell_surface_protocol_resize,
|
||||
+ .set_toplevel = weston_desktop_wl_shell_surface_protocol_set_toplevel,
|
||||
+ .set_transient = weston_desktop_wl_shell_surface_protocol_set_transient,
|
||||
+ .set_fullscreen = weston_desktop_wl_shell_surface_protocol_set_fullscreen,
|
||||
+ .set_popup = weston_desktop_wl_shell_surface_protocol_set_popup,
|
||||
+ .set_maximized = weston_desktop_wl_shell_surface_protocol_set_maximized,
|
||||
+ .set_title = weston_desktop_wl_shell_surface_protocol_set_title,
|
||||
+ .set_class = weston_desktop_wl_shell_surface_protocol_set_class,
|
||||
+};
|
||||
+
|
||||
+static const struct weston_desktop_surface_implementation weston_desktop_wl_shell_surface_internal_implementation = {
|
||||
+ .set_size = weston_desktop_wl_shell_surface_set_size,
|
||||
+ .committed = weston_desktop_wl_shell_surface_committed,
|
||||
+ .ping = weston_desktop_wl_shell_surface_ping,
|
||||
+ .close = weston_desktop_wl_shell_surface_close,
|
||||
+
|
||||
+ .get_maximized = weston_desktop_wl_shell_surface_get_maximized,
|
||||
+ .get_fullscreen = weston_desktop_wl_shell_surface_get_fullscreen,
|
||||
+
|
||||
+ .destroy = weston_desktop_wl_shell_surface_destroy,
|
||||
+};
|
||||
+
|
||||
+static void
|
||||
+wl_surface_resource_destroyed(struct wl_listener *listener,
|
||||
+ void *data)
|
||||
+{
|
||||
+ struct weston_desktop_wl_shell_surface *surface =
|
||||
+ wl_container_of(listener, surface,
|
||||
+ wl_surface_resource_destroy_listener);
|
||||
+
|
||||
+ /* the wl_shell_surface spec says that wl_shell_surfaces are to be
|
||||
+ * destroyed automatically when the wl_surface is destroyed. */
|
||||
+ weston_desktop_surface_destroy(surface->surface);
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+weston_desktop_wl_shell_protocol_get_shell_surface(struct wl_client *wl_client,
|
||||
+ struct wl_resource *resource,
|
||||
+ uint32_t id,
|
||||
+ struct wl_resource *surface_resource)
|
||||
+{
|
||||
+ struct weston_desktop_client *client = wl_resource_get_user_data(resource);
|
||||
+ struct weston_surface *wsurface = wl_resource_get_user_data(surface_resource);
|
||||
+ struct weston_desktop_wl_shell_surface *surface;
|
||||
+
|
||||
+
|
||||
+ if (weston_surface_set_role(wsurface, "wl_shell_surface", resource, WL_SHELL_ERROR_ROLE) < 0)
|
||||
+ return;
|
||||
+
|
||||
+ surface = zalloc(sizeof(struct weston_desktop_wl_shell_surface));
|
||||
+ if (surface == NULL) {
|
||||
+ wl_client_post_no_memory(wl_client);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ surface->desktop = weston_desktop_client_get_desktop(client);
|
||||
+ surface->display = weston_desktop_get_display(surface->desktop);
|
||||
+
|
||||
+ surface->surface =
|
||||
+ weston_desktop_surface_create(surface->desktop, client, wsurface,
|
||||
+ &weston_desktop_wl_shell_surface_internal_implementation,
|
||||
+ surface);
|
||||
+ if (surface->surface == NULL) {
|
||||
+ free(surface);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ surface->wl_surface_resource_destroy_listener.notify =
|
||||
+ wl_surface_resource_destroyed;
|
||||
+ wl_resource_add_destroy_listener(wsurface->resource,
|
||||
+ &surface->wl_surface_resource_destroy_listener);
|
||||
+
|
||||
+ surface->resource =
|
||||
+ weston_desktop_surface_add_resource(surface->surface,
|
||||
+ &wl_shell_surface_interface,
|
||||
+ &weston_desktop_wl_shell_surface_implementation,
|
||||
+ id, NULL);
|
||||
+}
|
||||
+
|
||||
+
|
||||
+static const struct wl_shell_interface weston_desktop_wl_shell_implementation = {
|
||||
+ .get_shell_surface = weston_desktop_wl_shell_protocol_get_shell_surface,
|
||||
+};
|
||||
+
|
||||
+static void
|
||||
+weston_desktop_wl_shell_bind(struct wl_client *client, void *data,
|
||||
+ uint32_t version, uint32_t id)
|
||||
+{
|
||||
+ struct weston_desktop *desktop = data;
|
||||
+
|
||||
+ weston_desktop_client_create(desktop, client, NULL, &wl_shell_interface,
|
||||
+ &weston_desktop_wl_shell_implementation,
|
||||
+ version, id);
|
||||
+}
|
||||
+
|
||||
+struct wl_global *
|
||||
+weston_desktop_wl_shell_create(struct weston_desktop *desktop,
|
||||
+ struct wl_display *display)
|
||||
+{
|
||||
+ return wl_global_create(display,
|
||||
+ &wl_shell_interface,
|
||||
+ WD_WL_SHELL_PROTOCOL_VERSION, desktop,
|
||||
+ weston_desktop_wl_shell_bind);
|
||||
+}
|
||||
diff --git a/meson.build b/meson.build
|
||||
index 7ce2ae7bd0a0..fcc2f1622c28 100644
|
||||
--- a/meson.build
|
||||
+++ b/meson.build
|
||||
@@ -137,6 +137,12 @@ if dep_xkbcommon.version().version_compare('>= 0.5.0')
|
||||
config_h.set('HAVE_XKBCOMMON_COMPOSE', '1')
|
||||
endif
|
||||
|
||||
+if get_option('deprecated-wl-shell')
|
||||
+ warning('Support for the deprecated wl_shell interface is enabled.')
|
||||
+ warning('This feature will be removed in a future version.')
|
||||
+ config_h.set('HAVE_DEPRECATED_WL_SHELL', '1')
|
||||
+endif
|
||||
+
|
||||
dep_wayland_server = dependency('wayland-server', version: '>= 1.20.0')
|
||||
dep_wayland_client = dependency('wayland-client', version: '>= 1.20.0')
|
||||
dep_pixman = dependency('pixman-1', version: '>= 0.25.2')
|
||||
diff --git a/meson_options.txt b/meson_options.txt
|
||||
index 643c6d619371..cb833c2d5146 100644
|
||||
--- a/meson_options.txt
|
||||
+++ b/meson_options.txt
|
||||
@@ -144,6 +144,13 @@ option(
|
||||
description: 'Weston desktop shell: default helper client selection'
|
||||
)
|
||||
|
||||
+option(
|
||||
+ 'deprecated-wl-shell',
|
||||
+ type: 'boolean',
|
||||
+ value: false,
|
||||
+ description: 'Enable the deprecated wl_shell protocol'
|
||||
+)
|
||||
+
|
||||
option(
|
||||
'color-management-lcms',
|
||||
type: 'boolean',
|
||||
|
|
@ -1,92 +0,0 @@
|
|||
From: Haihua Hu <jared.hu@nxp.com>
|
||||
Date: Wed, 3 Aug 2022 16:34:47 +0800
|
||||
Subject: [PATCH] Revert "libweston/libinput-device: Enable/Set pointer
|
||||
capabilities only on pointer movement"
|
||||
|
||||
This reverts commit e825fe389ebd63470028abd828019840c1170a03.
|
||||
|
||||
This commit will cause waylandsink cannot register pointer seat.
|
||||
As a result, mouse cannot move waylandsink window
|
||||
|
||||
Upstream-Status: Inappropriate [DEY specific]
|
||||
|
||||
(cherry picked from commit 3f8f336b5d2cf7ea7aa4e047d669d093fc46dfe6)
|
||||
---
|
||||
libweston/libinput-device.c | 29 +++++------------------------
|
||||
1 file changed, 5 insertions(+), 24 deletions(-)
|
||||
|
||||
diff --git a/libweston/libinput-device.c b/libweston/libinput-device.c
|
||||
index 31b88ac43c3a..207d0075ebb7 100644
|
||||
--- a/libweston/libinput-device.c
|
||||
+++ b/libweston/libinput-device.c
|
||||
@@ -67,21 +67,6 @@ evdev_led_update(struct evdev_device *device, enum weston_led weston_leds)
|
||||
libinput_device_led_update(device->device, leds);
|
||||
}
|
||||
|
||||
-static void
|
||||
-ensure_pointer_capability(struct libinput_device *libinput_device)
|
||||
-{
|
||||
- struct evdev_device *device = libinput_device_get_user_data(libinput_device);
|
||||
- struct weston_seat *seat = device->seat;
|
||||
-
|
||||
- if (!libinput_device_has_capability(libinput_device, LIBINPUT_DEVICE_CAP_POINTER))
|
||||
- return;
|
||||
-
|
||||
- if (!(device->seat_caps & EVDEV_SEAT_POINTER)) {
|
||||
- weston_seat_init_pointer(seat);
|
||||
- device->seat_caps |= EVDEV_SEAT_POINTER;
|
||||
- }
|
||||
-}
|
||||
-
|
||||
static void
|
||||
handle_keyboard_key(struct libinput_device *libinput_device,
|
||||
struct libinput_event_keyboard *keyboard_event)
|
||||
@@ -119,8 +104,6 @@ handle_pointer_motion(struct libinput_device *libinput_device,
|
||||
struct timespec time;
|
||||
double dx_unaccel, dy_unaccel;
|
||||
|
||||
- ensure_pointer_capability(libinput_device);
|
||||
-
|
||||
timespec_from_usec(&time,
|
||||
libinput_event_pointer_get_time_usec(pointer_event));
|
||||
dx_unaccel = libinput_event_pointer_get_dx_unaccelerated(pointer_event);
|
||||
@@ -152,8 +135,6 @@ handle_pointer_motion_absolute(
|
||||
double x, y;
|
||||
uint32_t width, height;
|
||||
|
||||
- ensure_pointer_capability(libinput_device);
|
||||
-
|
||||
if (!output)
|
||||
return false;
|
||||
|
||||
@@ -184,8 +165,6 @@ handle_pointer_button(struct libinput_device *libinput_device,
|
||||
libinput_event_pointer_get_seat_button_count(pointer_event);
|
||||
struct timespec time;
|
||||
|
||||
- ensure_pointer_capability(libinput_device);
|
||||
-
|
||||
/* Ignore button events that are not seat wide state changes. */
|
||||
if ((button_state == LIBINPUT_BUTTON_STATE_PRESSED &&
|
||||
seat_button_count != 1) ||
|
||||
@@ -264,8 +243,6 @@ handle_pointer_axis(struct libinput_device *libinput_device,
|
||||
bool has_vert, has_horiz;
|
||||
struct timespec time;
|
||||
|
||||
- ensure_pointer_capability(libinput_device);
|
||||
-
|
||||
has_vert = libinput_event_pointer_has_axis(pointer_event,
|
||||
LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL);
|
||||
has_horiz = libinput_event_pointer_has_axis(pointer_event,
|
||||
@@ -1025,7 +1002,11 @@ evdev_device_create(struct libinput_device *libinput_device,
|
||||
|
||||
device->seat_caps |= EVDEV_SEAT_KEYBOARD;
|
||||
}
|
||||
-
|
||||
+ if (libinput_device_has_capability(libinput_device,
|
||||
+ LIBINPUT_DEVICE_CAP_POINTER)) {
|
||||
+ weston_seat_init_pointer(seat);
|
||||
+ device->seat_caps |= EVDEV_SEAT_POINTER;
|
||||
+ }
|
||||
if (libinput_device_has_capability(libinput_device,
|
||||
LIBINPUT_DEVICE_CAP_TOUCH)) {
|
||||
if (weston_seat_init_touch(seat) < 0) {
|
||||
|
|
@ -2,13 +2,9 @@
|
|||
FILESEXTRAPATHS:prepend := "${THISDIR}/${BP}:"
|
||||
|
||||
SRC_URI += " \
|
||||
file://0001-Restore-wl_shell-to-weston-12.patch \
|
||||
file://0002-Revert-libweston-libinput-device-Enable-Set-pointer-.patch \
|
||||
file://0003-Revert-g2d-renderer-Support-solid-colour-weston_buff.patch \
|
||||
"
|
||||
|
||||
EXTRA_OEMESON += "-Ddeprecated-wl-shell=true"
|
||||
|
||||
# This package is already in RRECOMMENDS, but it doesn't get included in the
|
||||
# SDK due to it being a soft dependency from a complementary package. Make it a
|
||||
# hard dependency so it gets included.
|
||||
|
|
|
|||
Loading…
Reference in New Issue