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: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3267>
This commit is contained in:
Daniels Umanovskis 2022-10-26 10:25:43 +02:00 committed by GStreamer Marge Bot
parent 8a8fe360a2
commit 990d124790
2 changed files with 17 additions and 0 deletions

View file

@ -112,6 +112,9 @@
/* 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);
}
}
}

View 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);