aboutsummaryrefslogtreecommitdiffhomepage
path: root/video/out/wayland_common.c
diff options
context:
space:
mode:
Diffstat (limited to 'video/out/wayland_common.c')
-rw-r--r--video/out/wayland_common.c56
1 files changed, 43 insertions, 13 deletions
diff --git a/video/out/wayland_common.c b/video/out/wayland_common.c
index 0ed14687bc..1e0659fc8f 100644
--- a/video/out/wayland_common.c
+++ b/video/out/wayland_common.c
@@ -32,6 +32,9 @@
// Generated from idle-inhibit-unstable-v1.xml
#include "video/out/wayland/idle-inhibit-v1.h"
+// Generated from xdg-decoration-unstable-v1.xml
+#include "video/out/wayland/xdg-decoration-v1.h"
+
// Generated from server-decoration.xml
#include "video/out/wayland/srv-decor.h"
@@ -827,6 +830,10 @@ static void registry_handle_add(void *data, struct wl_registry *reg, uint32_t id
wl->server_decoration_manager = wl_registry_bind(reg, id, &org_kde_kwin_server_decoration_manager_interface, 1);
}
+ if (!strcmp(interface, zxdg_decoration_manager_v1_interface.name) && found++) {
+ wl->xdg_decoration_manager = wl_registry_bind(reg, id, &zxdg_decoration_manager_v1_interface, 1);
+ }
+
if (!strcmp(interface, zwp_idle_inhibit_manager_v1_interface.name) && found++) {
wl->idle_inhibit_manager = wl_registry_bind(reg, id, &zwp_idle_inhibit_manager_v1_interface, 1);
}
@@ -970,18 +977,31 @@ static int create_xdg_surface(struct vo_wayland_state *wl)
static int set_border_decorations(struct vo_wayland_state *wl, int state)
{
- if (!wl->server_decoration)
- return VO_NOTIMPL;
- enum org_kde_kwin_server_decoration_mode mode;
- if (state) {
- MP_VERBOSE(wl, "Enabling server decorations\n");
- mode = ORG_KDE_KWIN_SERVER_DECORATION_MODE_SERVER;
+ if (wl->xdg_toplevel_decoration) {
+ enum zxdg_toplevel_decoration_v1_mode mode;
+ if (state) {
+ MP_VERBOSE(wl, "Enabling server decorations\n");
+ mode = ZXDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE;
+ } else {
+ MP_VERBOSE(wl, "Disabling server decorations\n");
+ mode = ZXDG_TOPLEVEL_DECORATION_V1_MODE_CLIENT_SIDE;
+ }
+ zxdg_toplevel_decoration_v1_set_mode(wl->xdg_toplevel_decoration, mode);
+ return VO_TRUE;
+ } else if (wl->server_decoration) {
+ enum org_kde_kwin_server_decoration_mode mode;
+ if (state) {
+ MP_VERBOSE(wl, "Enabling server decorations\n");
+ mode = ORG_KDE_KWIN_SERVER_DECORATION_MODE_SERVER;
+ } else {
+ MP_VERBOSE(wl, "Disabling server decorations\n");
+ mode = ORG_KDE_KWIN_SERVER_DECORATION_MODE_NONE;
+ }
+ org_kde_kwin_server_decoration_request_mode(wl->server_decoration, mode);
+ return VO_TRUE;
} else {
- MP_VERBOSE(wl, "Disabling server decorations\n");
- mode = ORG_KDE_KWIN_SERVER_DECORATION_MODE_NONE;
+ return VO_NOTIMPL;
}
- org_kde_kwin_server_decoration_request_mode(wl->server_decoration, mode);
- return VO_TRUE;
}
int vo_wayland_init(struct vo *vo)
@@ -1036,12 +1056,16 @@ int vo_wayland_init(struct vo *vo)
wl_data_device_manager_interface.name);
}
- if (wl->server_decoration_manager) {
+ if (wl->xdg_decoration_manager) {
+ wl->xdg_toplevel_decoration = zxdg_decoration_manager_v1_get_toplevel_decoration(wl->xdg_decoration_manager, wl->xdg_toplevel);
+ set_border_decorations(wl, vo->opts->border);
+ } else if (wl->server_decoration_manager) {
wl->server_decoration = org_kde_kwin_server_decoration_manager_create(wl->server_decoration_manager, wl->surface);
set_border_decorations(wl, vo->opts->border);
} else {
- MP_VERBOSE(wl, "Compositor doesn't support the %s protocol!\n",
- org_kde_kwin_server_decoration_manager_interface.name);
+ MP_VERBOSE(wl, "Compositor doesn't support the %s or %s protocols!\n",
+ org_kde_kwin_server_decoration_manager_interface.name,
+ zxdg_decoration_manager_v1_interface.name);
}
if (!wl->idle_inhibit_manager)
@@ -1092,6 +1116,12 @@ void vo_wayland_uninit(struct vo *vo)
if (wl->server_decoration_manager)
org_kde_kwin_server_decoration_manager_destroy(wl->server_decoration_manager);
+ if (wl->xdg_toplevel_decoration)
+ zxdg_toplevel_decoration_v1_destroy(wl->xdg_toplevel_decoration);
+
+ if (wl->xdg_decoration_manager)
+ zxdg_decoration_manager_v1_destroy(wl->xdg_decoration_manager);
+
if (wl->surface)
wl_surface_destroy(wl->surface);