From 990d12479029ed22ffa04218583f1d433bea7c50 Mon Sep 17 00:00:00 2001 From: Daniels Umanovskis Date: Wed, 26 Oct 2022 10:25:43 +0200 Subject: [PATCH] ximagesink, xvimagesink: set the _NET_WM_PID atom on the window This makes it easier for X11 window management to work with windows created by these sinks Part-of: --- subprojects/gst-plugins-base/sys/ximage/ximagesink.c | 9 +++++++++ subprojects/gst-plugins-base/sys/xvimage/xvcontext.c | 8 ++++++++ 2 files changed, 17 insertions(+) diff --git a/subprojects/gst-plugins-base/sys/ximage/ximagesink.c b/subprojects/gst-plugins-base/sys/ximage/ximagesink.c index 6b1b487923..4fd9070538 100644 --- a/subprojects/gst-plugins-base/sys/ximage/ximagesink.c +++ b/subprojects/gst-plugins-base/sys/ximage/ximagesink.c @@ -112,6 +112,9 @@ /* Debugging category */ #include +/* For getpid */ +#include + /* for XkbKeycodeToKeysym */ #include @@ -433,6 +436,12 @@ gst_x_image_sink_xwindow_set_title (GstXImageSink * ximagesink, XSetClassHint (ximagesink->xcontext->disp, xwindow->win, hint); } XFree (hint); + + unsigned long pid = getpid (); + Atom _NET_WM_PID = + XInternAtom (ximagesink->xcontext->disp, "_NET_WM_PID", 0); + XChangeProperty (ximagesink->xcontext->disp, xwindow->win, + _NET_WM_PID, _NET_WM_PID, 32, 0, (unsigned char *) &pid, 1); } } } diff --git a/subprojects/gst-plugins-base/sys/xvimage/xvcontext.c b/subprojects/gst-plugins-base/sys/xvimage/xvcontext.c index fbaee4e309..75bebd9887 100644 --- a/subprojects/gst-plugins-base/sys/xvimage/xvcontext.c +++ b/subprojects/gst-plugins-base/sys/xvimage/xvcontext.c @@ -30,6 +30,9 @@ /* Debugging category */ #include +/* for getpid */ +#include + /* for XkbKeycodeToKeysym */ #include @@ -1039,6 +1042,11 @@ gst_xvcontext_create_xwindow (GstXvContext * context, gint width, gint height) g_free (hints); } + unsigned long pid = getpid (); + Atom _NET_WM_PID = XInternAtom (context->disp, "_NET_WM_PID", 0); + XChangeProperty (context->disp, window->win, + _NET_WM_PID, _NET_WM_PID, 32, 0, (unsigned char *) &pid, 1); + window->gc = XCreateGC (context->disp, window->win, 0, NULL); XMapRaised (context->disp, window->win);