summaryrefslogtreecommitdiffstats
path: root/video
diff options
context:
space:
mode:
authorDudemanguy <random342@airmail.cc>2020-08-12 09:51:51 -0500
committerDudemanguy <random342@airmail.cc>2020-08-14 13:02:01 +0000
commit9bce2367142c266c1a1512494a03495583964c32 (patch)
treece23d5e25d5a9485a558c4dcaff038f6d6c2b81d /video
parent4b5ead0834deaf2896c39952daf2e622a5959b4f (diff)
downloadmpv-9bce2367142c266c1a1512494a03495583964c32.tar.bz2
mpv-9bce2367142c266c1a1512494a03495583964c32.tar.xz
wayland: expose wayland-app-id as a user option
This is extremely similar to x11's WM_CLASS. This commit allows users to set mpv's app-id at runtime for any of the wayland backends.
Diffstat (limited to 'video')
-rw-r--r--video/out/wayland_common.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/video/out/wayland_common.c b/video/out/wayland_common.c
index e00adac338..8e7d8bb7b0 100644
--- a/video/out/wayland_common.c
+++ b/video/out/wayland_common.c
@@ -1060,6 +1060,17 @@ static int create_xdg_surface(struct vo_wayland_state *wl)
return 0;
}
+static void update_app_id(struct vo_wayland_state *wl)
+{
+ if (!wl->xdg_toplevel)
+ return;
+ if (!wl->vo_opts->appid) {
+ wl->vo_opts->appid = talloc_strdup(wl->vo_opts, "mpv");
+ m_config_cache_write_opt(wl->vo_opts_cache, &wl->vo_opts->appid);
+ }
+ xdg_toplevel_set_app_id(wl->xdg_toplevel, wl->vo_opts->appid);
+}
+
static void set_border_decorations(struct vo_wayland_state *wl, int state)
{
if (!wl->xdg_toplevel_decoration) {
@@ -1126,6 +1137,7 @@ int vo_wayland_init(struct vo *vo)
/* Can't be initialized during registry due to multi-protocol dependence */
if (create_xdg_surface(wl))
return false;
+ update_app_id(wl);
const char *xdg_current_desktop = getenv("XDG_CURRENT_DESKTOP");
if (xdg_current_desktop != NULL && strstr(xdg_current_desktop, "GNOME"))
@@ -1511,6 +1523,8 @@ int vo_wayland_control(struct vo *vo, int *events, int request, void *arg)
toggle_maximized(wl);
if (opt == &opts->border)
set_border_decorations(wl, opts->border);
+ if (opt == &opts->appid)
+ update_app_id(wl);
}
return VO_TRUE;
}