compositor-wayland: use xdg_shell stable instead of v6

Better to excercise the current rather than outdated protocol.

Pekka:
- split the patch, rewrote commit message
- rename xdg_shell_ping to xdg_wm_base_ping
- rename xdg_shell_listener to wm_base_listener
- fix continued line alignment

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
dev
ant8me 6 years ago committed by Daniel Stone
parent f99fac22ab
commit 30a285748d
  1. 4
      Makefile.am
  2. 104
      libweston/compositor-wayland.c
  3. 4
      libweston/meson.build

@ -457,8 +457,8 @@ wayland_backend_la_SOURCES = \
nodist_wayland_backend_la_SOURCES = \
protocol/fullscreen-shell-unstable-v1-protocol.c \
protocol/fullscreen-shell-unstable-v1-client-protocol.h \
protocol/xdg-shell-unstable-v6-protocol.c \
protocol/xdg-shell-unstable-v6-client-protocol.h
protocol/xdg-shell-protocol.c \
protocol/xdg-shell-client-protocol.h
endif
if ENABLE_HEADLESS_COMPOSITOR

@ -55,7 +55,7 @@
#include "shared/cairo-util.h"
#include "shared/timespec-util.h"
#include "fullscreen-shell-unstable-v1-client-protocol.h"
#include "xdg-shell-unstable-v6-client-protocol.h"
#include "xdg-shell-client-protocol.h"
#include "presentation-time-server-protocol.h"
#include "linux-dmabuf.h"
#include "windowed-output-api.h"
@ -71,7 +71,7 @@ struct wayland_backend {
struct wl_registry *registry;
struct wl_compositor *compositor;
struct wl_shell *shell;
struct zxdg_shell_v6 *xdg_shell;
struct xdg_wm_base *xdg_wm_base;
struct zwp_fullscreen_shell_v1 *fshell;
struct wl_shm *shm;
@ -104,8 +104,8 @@ struct wayland_output {
uint32_t global_id;
struct wl_shell_surface *shell_surface;
struct zxdg_surface_v6 *xdg_surface;
struct zxdg_toplevel_v6 *xdg_toplevel;
struct xdg_surface *xdg_surface;
struct xdg_toplevel *xdg_toplevel;
int configure_width, configure_height;
bool wait_for_configure;
} parent;
@ -661,12 +661,12 @@ wayland_backend_destroy_output_surface(struct wayland_output *output)
assert(output->parent.surface);
if (output->parent.xdg_toplevel) {
zxdg_toplevel_v6_destroy(output->parent.xdg_toplevel);
xdg_toplevel_destroy(output->parent.xdg_toplevel);
output->parent.xdg_toplevel = NULL;
}
if (output->parent.xdg_surface) {
zxdg_surface_v6_destroy(output->parent.xdg_surface);
xdg_surface_destroy(output->parent.xdg_surface);
output->parent.xdg_surface = NULL;
}
@ -810,11 +810,11 @@ wayland_output_resize_surface(struct wayland_output *output)
wl_region_destroy(region);
if (output->parent.xdg_surface) {
zxdg_surface_v6_set_window_geometry(output->parent.xdg_surface,
ix,
iy,
iwidth,
iheight);
xdg_surface_set_window_geometry(output->parent.xdg_surface,
ix,
iy,
iwidth,
iheight);
}
frame_opaque_rect(output->frame, &ix, &iy, &iwidth, &iheight);
@ -837,11 +837,11 @@ wayland_output_resize_surface(struct wayland_output *output)
wl_region_destroy(region);
if (output->parent.xdg_surface) {
zxdg_surface_v6_set_window_geometry(output->parent.xdg_surface,
0,
0,
width,
height);
xdg_surface_set_window_geometry(output->parent.xdg_surface,
0,
0,
width,
height);
}
}
@ -902,7 +902,7 @@ wayland_output_set_windowed(struct wayland_output *output)
wayland_output_resize_surface(output);
if (output->parent.xdg_toplevel) {
zxdg_toplevel_v6_unset_fullscreen(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 {
@ -925,7 +925,7 @@ wayland_output_set_fullscreen(struct wayland_output *output,
wayland_output_resize_surface(output);
if (output->parent.xdg_toplevel) {
zxdg_toplevel_v6_set_fullscreen(output->parent.xdg_toplevel, target);
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);
@ -1116,18 +1116,18 @@ err_output:
}
static void
handle_xdg_surface_configure(void *data, struct zxdg_surface_v6 *surface,
handle_xdg_surface_configure(void *data, struct xdg_surface *surface,
uint32_t serial)
{
zxdg_surface_v6_ack_configure(surface, serial);
xdg_surface_ack_configure(surface, serial);
}
static const struct zxdg_surface_v6_listener xdg_surface_listener = {
static const struct xdg_surface_listener xdg_surface_listener = {
handle_xdg_surface_configure
};
static void
handle_xdg_toplevel_configure(void *data, struct zxdg_toplevel_v6 *toplevel,
handle_xdg_toplevel_configure(void *data, struct xdg_toplevel *toplevel,
int32_t width, int32_t height,
struct wl_array *states)
{
@ -1141,7 +1141,7 @@ handle_xdg_toplevel_configure(void *data, struct zxdg_toplevel_v6 *toplevel,
}
static void
handle_xdg_toplevel_close(void *data, struct zxdg_toplevel_v6 *xdg_toplevel)
handle_xdg_toplevel_close(void *data, struct xdg_toplevel *xdg_toplevel)
{
struct wayland_output *output = data;
struct weston_compositor *compositor = output->base.compositor;
@ -1152,7 +1152,7 @@ handle_xdg_toplevel_close(void *data, struct zxdg_toplevel_v6 *xdg_toplevel)
weston_compositor_exit(compositor);
}
static const struct zxdg_toplevel_v6_listener xdg_toplevel_listener = {
static const struct xdg_toplevel_listener xdg_toplevel_listener = {
handle_xdg_toplevel_configure,
handle_xdg_toplevel_close,
};
@ -1173,19 +1173,19 @@ wayland_backend_create_output_surface(struct wayland_output *output)
output->parent.draw_initial_frame = true;
if (b->parent.xdg_shell) {
if (b->parent.xdg_wm_base) {
output->parent.xdg_surface =
zxdg_shell_v6_get_xdg_surface(b->parent.xdg_shell,
output->parent.surface);
zxdg_surface_v6_add_listener(output->parent.xdg_surface,
&xdg_surface_listener, output);
xdg_wm_base_get_xdg_surface(b->parent.xdg_wm_base,
output->parent.surface);
xdg_surface_add_listener(output->parent.xdg_surface,
&xdg_surface_listener, output);
output->parent.xdg_toplevel =
zxdg_surface_v6_get_toplevel(output->parent.xdg_surface);
zxdg_toplevel_v6_add_listener(output->parent.xdg_toplevel,
&xdg_toplevel_listener, output);
xdg_surface_get_toplevel(output->parent.xdg_surface);
xdg_toplevel_add_listener(output->parent.xdg_toplevel,
&xdg_toplevel_listener, output);
zxdg_toplevel_v6_set_title(output->parent.xdg_toplevel, output->title);
xdg_toplevel_set_title(output->parent.xdg_toplevel, output->title);
wl_surface_commit(output->parent.surface);
@ -1194,7 +1194,7 @@ wayland_backend_create_output_surface(struct wayland_output *output)
while (output->parent.wait_for_configure)
wl_display_dispatch(b->parent.wl_display);
weston_log("wayland-backend: Using xdg_shell_v6\n");
weston_log("wayland-backend: Using xdg_wm_base\n");
}
else if (b->parent.shell) {
output->parent.shell_surface =
@ -1539,10 +1539,10 @@ wayland_output_setup_fullscreen(struct wayland_output *output,
return -1;
/* What should size be set if conditional is false? */
if (b->parent.xdg_shell || b->parent.shell) {
if (b->parent.xdg_wm_base || b->parent.shell) {
if (output->parent.xdg_toplevel)
zxdg_toplevel_v6_set_fullscreen(output->parent.xdg_toplevel,
output->parent.output);
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);
@ -1774,8 +1774,8 @@ input_handle_button(void *data, struct wl_pointer *pointer,
if (frame_status(input->output->frame) & FRAME_STATUS_MOVE) {
if (input->output->parent.xdg_toplevel)
zxdg_toplevel_v6_move(input->output->parent.xdg_toplevel,
input->parent.seat, serial);
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);
@ -2130,8 +2130,8 @@ input_handle_touch_down(void *data, struct wl_touch *wl_touch,
if (first_touch && (frame_status(output->frame) & FRAME_STATUS_MOVE)) {
input->touch_points--;
if (output->parent.xdg_toplevel)
zxdg_toplevel_v6_move(output->parent.xdg_toplevel,
input->parent.seat, serial);
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);
@ -2528,13 +2528,13 @@ wayland_parent_output_destroy(struct wayland_parent_output *output)
}
static void
xdg_shell_ping(void *data, struct zxdg_shell_v6 *shell, uint32_t serial)
xdg_wm_base_ping(void *data, struct xdg_wm_base *shell, uint32_t serial)
{
zxdg_shell_v6_pong(shell, serial);
xdg_wm_base_pong(shell, serial);
}
static const struct zxdg_shell_v6_listener xdg_shell_listener = {
xdg_shell_ping,
static const struct xdg_wm_base_listener wm_base_listener = {
xdg_wm_base_ping,
};
static void
@ -2548,12 +2548,12 @@ registry_handle_global(void *data, struct wl_registry *registry, uint32_t name,
wl_registry_bind(registry, name,
&wl_compositor_interface,
MIN(version, 4));
} else if (strcmp(interface, "zxdg_shell_v6") == 0) {
b->parent.xdg_shell =
} else if (strcmp(interface, "xdg_wm_base") == 0) {
b->parent.xdg_wm_base =
wl_registry_bind(registry, name,
&zxdg_shell_v6_interface, 1);
zxdg_shell_v6_add_listener(b->parent.xdg_shell,
&xdg_shell_listener, b);
&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,
@ -2629,8 +2629,8 @@ wayland_destroy(struct weston_compositor *ec)
if (b->parent.shm)
wl_shm_destroy(b->parent.shm);
if (b->parent.xdg_shell)
zxdg_shell_v6_destroy(b->parent.xdg_shell);
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);

@ -307,8 +307,8 @@ if get_option('backend-wayland')
fullscreen_shell_unstable_v1_protocol_c,
presentation_time_protocol_c,
presentation_time_server_protocol_h,
xdg_shell_unstable_v6_client_protocol_h,
xdg_shell_unstable_v6_protocol_c,
xdg_shell_server_protocol_h,
xdg_shell_protocol_c,
]
deps_wlwl = [

Loading…
Cancel
Save