Skip to content

Commit 3419902

Browse files
committed
Switching to zxdg-shell unstable Wayland protocol to the stable xdg-shell as zxdg-shell is no longer implemented by many Wayland compositors.
1 parent 47c4761 commit 3419902

3 files changed

Lines changed: 42 additions & 35 deletions

File tree

src/cmake/presentation.cmake

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -111,12 +111,12 @@ elseif(PRESENTATION_BACKEND MATCHES "wayland")
111111
pkg_get_variable(WAYLAND_PROTOCOLS_DATADIR wayland-protocols pkgdatadir)
112112
pkg_get_variable(WAYLAND_SCANNER wayland-scanner wayland_scanner)
113113

114-
set(PROTOCOL xdg-shell-unstable-v6)
115-
set(PROTOCOL_XML ${WAYLAND_PROTOCOLS_DATADIR}/unstable/xdg-shell/${PROTOCOL}.xml)
114+
set(PROTOCOL xdg-shell)
115+
set(PROTOCOL_XML ${WAYLAND_PROTOCOLS_DATADIR}/stable/xdg-shell/${PROTOCOL}.xml)
116116

117-
if(NOT EXISTS ${PROTOCOL_XML})
118-
message(FATAL_ERROR "xdg-shell-unstable-v6.xml not found in " ${WAYLAND_PROTOCOLS_DATADIR}
119-
"\nYour wayland-protocols package does not " "contain xdg-shell-unstable-v6."
117+
if(NOT EXISTS ${PROTOCOL_XML})
118+
message(FATAL_ERROR "xdg-shell.xml not found in " ${WAYLAND_PROTOCOLS_DATADIR}
119+
"\nYour wayland-protocols package does not " "contain xdg-shell."
120120
)
121121
endif()
122122
add_custom_command(

src/common/gfxwrapper_opengl.c

Lines changed: 34 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2187,50 +2187,57 @@ const struct wl_seat_listener seat_listener = {
21872187
_seat_capabilities_cb,
21882188
};
21892189

2190-
static void _xdg_surface_configure_cb(void *data, struct zxdg_surface_v6 *surface, uint32_t serial) {
2191-
zxdg_surface_v6_ack_configure(surface, serial);
2190+
static void _xdg_surface_configure_cb(void *data, struct xdg_surface *surface, uint32_t serial) {
2191+
xdg_surface_ack_configure(surface, serial);
21922192
}
21932193

2194-
const struct zxdg_surface_v6_listener xdg_surface_listener = {
2194+
const struct xdg_surface_listener xdg_surface_listener = {
21952195
_xdg_surface_configure_cb,
21962196
};
21972197

2198-
static void _xdg_shell_ping_cb(void *data, struct zxdg_shell_v6 *shell, uint32_t serial) { zxdg_shell_v6_pong(shell, serial); }
2198+
static void _xdg_shell_ping_cb(void *data, struct xdg_wm_base *shell, uint32_t serial) { xdg_wm_base_pong(shell, serial); }
21992199

2200-
const struct zxdg_shell_v6_listener xdg_shell_listener = {
2200+
const struct xdg_wm_base_listener xdg_shell_listener = {
22012201
_xdg_shell_ping_cb,
22022202
};
22032203

2204-
static void _xdg_toplevel_configure_cb(void *data, struct zxdg_toplevel_v6 *toplevel, int32_t width, int32_t height,
2204+
static void _xdg_toplevel_configure_cb(void *data, struct xdg_toplevel *toplevel, int32_t width, int32_t height,
22052205
struct wl_array *states) {
22062206
ksGpuWindow *window = (ksGpuWindow *)data;
22072207

22082208
window->windowActive = false;
22092209

2210-
enum zxdg_toplevel_v6_state *state;
2210+
enum xdg_toplevel_state *state;
22112211
wl_array_for_each(state, states) {
22122212
switch (*state) {
2213-
case ZXDG_TOPLEVEL_V6_STATE_FULLSCREEN:
2213+
case XDG_TOPLEVEL_STATE_FULLSCREEN:
22142214
break;
2215-
case ZXDG_TOPLEVEL_V6_STATE_RESIZING:
2215+
case XDG_TOPLEVEL_STATE_RESIZING:
22162216
window->windowWidth = width;
22172217
window->windowWidth = height;
22182218
break;
2219-
case ZXDG_TOPLEVEL_V6_STATE_MAXIMIZED:
2219+
case XDG_TOPLEVEL_STATE_MAXIMIZED:
22202220
break;
2221-
case ZXDG_TOPLEVEL_V6_STATE_ACTIVATED:
2221+
case XDG_TOPLEVEL_STATE_ACTIVATED:
22222222
window->windowActive = true;
22232223
break;
2224+
case XDG_TOPLEVEL_STATE_TILED_LEFT:
2225+
case XDG_TOPLEVEL_STATE_TILED_RIGHT:
2226+
case XDG_TOPLEVEL_STATE_TILED_TOP:
2227+
case XDG_TOPLEVEL_STATE_TILED_BOTTOM:
2228+
break;
2229+
case XDG_TOPLEVEL_STATE_SUSPENDED:
2230+
break;
22242231
}
22252232
}
22262233
}
22272234

2228-
static void _xdg_toplevel_close_cb(void *data, struct zxdg_toplevel_v6 *toplevel) {
2235+
static void _xdg_toplevel_close_cb(void *data, struct xdg_toplevel *toplevel) {
22292236
ksGpuWindow *window = (ksGpuWindow *)data;
22302237
window->windowExit = true;
22312238
}
22322239

2233-
const struct zxdg_toplevel_v6_listener xdg_toplevel_listener = {
2240+
const struct xdg_toplevel_listener xdg_toplevel_listener = {
22342241
_xdg_toplevel_configure_cb,
22352242
_xdg_toplevel_close_cb,
22362243
};
@@ -2240,9 +2247,9 @@ static void _registry_cb(void *data, struct wl_registry *registry, uint32_t id,
22402247

22412248
if (strcmp(interface, "wl_compositor") == 0) {
22422249
window->compositor = wl_registry_bind(registry, id, &wl_compositor_interface, 1);
2243-
} else if (strcmp(interface, "zxdg_shell_v6") == 0) {
2244-
window->shell = wl_registry_bind(registry, id, &zxdg_shell_v6_interface, 1);
2245-
zxdg_shell_v6_add_listener(window->shell, &xdg_shell_listener, NULL);
2250+
} else if (strcmp(interface, "xdg_wm_base") == 0) {
2251+
window->shell = wl_registry_bind(registry, id, &xdg_wm_base_interface, 1);
2252+
xdg_wm_base_add_listener(window->shell, &xdg_shell_listener, NULL);
22462253
} else if (strcmp(interface, "wl_seat") == 0) {
22472254
window->seat = wl_registry_bind(registry, id, &wl_seat_interface, 1);
22482255
wl_seat_add_listener(window->seat, &seat_listener, window);
@@ -2302,7 +2309,7 @@ bool ksGpuWindow_Create(ksGpuWindow *window, ksDriverInstance *instance, const k
23022309
}
23032310

23042311
if (window->shell == NULL) {
2305-
Error("Compositor is missing support for zxdg_shell_v6.");
2312+
Error("Compositor is missing support for xdg_shell.");
23062313
return false;
23072314
}
23082315

@@ -2312,26 +2319,26 @@ bool ksGpuWindow_Create(ksGpuWindow *window, ksDriverInstance *instance, const k
23122319
return false;
23132320
}
23142321

2315-
window->shell_surface = zxdg_shell_v6_get_xdg_surface(window->shell, window->surface);
2322+
window->shell_surface = xdg_wm_base_get_xdg_surface(window->shell, window->surface);
23162323
if (window->shell_surface == NULL) {
23172324
Error("Could not get shell surface.");
23182325
return false;
23192326
}
23202327

2321-
zxdg_surface_v6_add_listener(window->shell_surface, &xdg_surface_listener, window);
2328+
xdg_surface_add_listener(window->shell_surface, &xdg_surface_listener, window);
23222329

2323-
struct zxdg_toplevel_v6 *toplevel = zxdg_surface_v6_get_toplevel(window->shell_surface);
2330+
struct xdg_toplevel *toplevel = xdg_surface_get_toplevel(window->shell_surface);
23242331
if (toplevel == NULL) {
23252332
Error("Could not get surface toplevel.");
23262333
return false;
23272334
}
23282335

2329-
zxdg_toplevel_v6_add_listener(toplevel, &xdg_toplevel_listener, window);
2336+
xdg_toplevel_add_listener(toplevel, &xdg_toplevel_listener, window);
23302337

2331-
zxdg_toplevel_v6_set_title(toplevel, WINDOW_TITLE);
2332-
zxdg_toplevel_v6_set_app_id(toplevel, APPLICATION_NAME);
2333-
zxdg_toplevel_v6_set_min_size(toplevel, width, height);
2334-
zxdg_toplevel_v6_set_max_size(toplevel, width, height);
2338+
xdg_toplevel_set_title(toplevel, WINDOW_TITLE);
2339+
xdg_toplevel_set_app_id(toplevel, APPLICATION_NAME);
2340+
xdg_toplevel_set_min_size(toplevel, width, height);
2341+
xdg_toplevel_set_max_size(toplevel, width, height);
23352342

23362343
wl_surface_commit(window->surface);
23372344

@@ -2363,8 +2370,8 @@ void ksGpuWindow_Destroy(ksGpuWindow *window) {
23632370

23642371
if (window->compositor != NULL) wl_compositor_destroy(window->compositor);
23652372
if (window->registry != NULL) wl_registry_destroy(window->registry);
2366-
if (window->shell_surface != NULL) zxdg_surface_v6_destroy(window->shell_surface);
2367-
if (window->shell != NULL) zxdg_shell_v6_destroy(window->shell);
2373+
if (window->shell_surface != NULL) xdg_surface_destroy(window->shell_surface);
2374+
if (window->shell != NULL) xdg_wm_base_destroy(window->shell);
23682375
if (window->surface != NULL) wl_surface_destroy(window->surface);
23692376
if (window->display != NULL) wl_display_disconnect(window->display);
23702377

src/common/gfxwrapper_opengl.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ Platform headers / declarations
258258
#include <linux/input.h>
259259
#include <poll.h>
260260
#include <unistd.h>
261-
#include "xdg-shell-unstable-v6.h"
261+
#include <xdg-shell.h>
262262

263263
#endif
264264

@@ -671,8 +671,8 @@ typedef struct {
671671

672672
struct wl_registry *registry;
673673
struct wl_compositor *compositor;
674-
struct zxdg_shell_v6 *shell;
675-
struct zxdg_surface_v6 *shell_surface;
674+
struct xdg_wm_base *shell;
675+
struct xdg_surface *shell_surface;
676676

677677
struct wl_keyboard *keyboard;
678678
struct wl_pointer *pointer;

0 commit comments

Comments
 (0)