ximagesink, xvimagesink: set the _NET_WM_PID atom on the window
authorDaniels Umanovskis <du@axentia.se>
Wed, 26 Oct 2022 08:25:43 +0000 (10:25 +0200)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Wed, 26 Oct 2022 16:10:36 +0000 (16:10 +0000)
This makes it easier for X11 window management to work with windows created by these sinks

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3267>

subprojects/gst-plugins-base/sys/ximage/ximagesink.c
subprojects/gst-plugins-base/sys/xvimage/xvcontext.c

index 6b1b487..4fd9070 100644 (file)
 /* Debugging category */
 #include <gst/gstinfo.h>
 
+/* For getpid */
+#include <unistd.h>
+
 /* for XkbKeycodeToKeysym */
 #include <X11/XKBlib.h>
 
@@ -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);
     }
   }
 }
index fbaee4e..75bebd9 100644 (file)
@@ -30,6 +30,9 @@
 /* Debugging category */
 #include <gst/gstinfo.h>
 
+/* for getpid */
+#include <unistd.h>
+
 /* for XkbKeycodeToKeysym */
 #include <X11/XKBlib.h>
 
@@ -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);