diff options
-rw-r--r-- | video/out/wayland_common.c | 56 | ||||
-rw-r--r-- | video/out/wayland_common.h | 2 | ||||
-rw-r--r-- | waftools/checks/custom.py | 2 | ||||
-rw-r--r-- | wscript_build.py | 7 |
4 files changed, 53 insertions, 14 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); diff --git a/video/out/wayland_common.h b/video/out/wayland_common.h index 9aa057fa57..77479bd840 100644 --- a/video/out/wayland_common.h +++ b/video/out/wayland_common.h @@ -75,6 +75,8 @@ struct vo_wayland_state { struct xdg_surface *xdg_surface; struct org_kde_kwin_server_decoration_manager *server_decoration_manager; struct org_kde_kwin_server_decoration *server_decoration; + struct zxdg_decoration_manager_v1 *xdg_decoration_manager; + struct zxdg_toplevel_decoration_v1 *xdg_toplevel_decoration; struct zwp_idle_inhibit_manager_v1 *idle_inhibit_manager; struct zwp_idle_inhibitor_v1 *idle_inhibitor; diff --git a/waftools/checks/custom.py b/waftools/checks/custom.py index 1078746382..8cc701f7f7 100644 --- a/waftools/checks/custom.py +++ b/waftools/checks/custom.py @@ -85,7 +85,7 @@ def check_lua(ctx, dependency_identifier): def check_wl_protocols(ctx, dependency_identifier): def fn(ctx, dependency_identifier): - ret = check_pkg_config_datadir("wayland-protocols", ">= 1.14") + ret = check_pkg_config_datadir("wayland-protocols", ">= 1.15") ret = ret(ctx, dependency_identifier) if ret != None: ctx.env.WL_PROTO_DIR = ret.split()[0] diff --git a/wscript_build.py b/wscript_build.py index 81da9d9aa6..e135a01e6d 100644 --- a/wscript_build.py +++ b/wscript_build.py @@ -129,6 +129,12 @@ def build(ctx): ctx.wayland_protocol_header(proto_dir = ctx.env.WL_PROTO_DIR, protocol = "unstable/idle-inhibit/idle-inhibit-unstable-v1", target = "video/out/wayland/idle-inhibit-v1.h") + ctx.wayland_protocol_code(proto_dir = ctx.env.WL_PROTO_DIR, + protocol = "unstable/xdg-decoration/xdg-decoration-unstable-v1", + target = "video/out/wayland/xdg-decoration-v1.c") + ctx.wayland_protocol_header(proto_dir = ctx.env.WL_PROTO_DIR, + protocol = "unstable/xdg-decoration/xdg-decoration-unstable-v1", + target = "video/out/wayland/xdg-decoration-v1.h") ctx.wayland_protocol_code(proto_dir = "video/out/wayland", protocol = "server-decoration", vendored_protocol = True, @@ -508,6 +514,7 @@ def build(ctx): ( "video/out/w32_common.c", "win32-desktop" ), ( "video/out/wayland/idle-inhibit-v1.c", "wayland" ), ( "video/out/wayland/srv-decor.c", "wayland" ), + ( "video/out/wayland/xdg-decoration-v1.c", "wayland" ), ( "video/out/wayland/xdg-shell.c", "wayland" ), ( "video/out/wayland_common.c", "wayland" ), ( "video/out/win32/displayconfig.c", "win32-desktop" ), |