How do I embed an X11 target window into a GTK4 Widget

I want to embed the X11 window created by the following code into Gtk4, but I can’t find any reference in Gtk4.

display = XOpenDisplay(NULL);
int screen = DefaultScreen(display);
unsigned int width = DisplayWidth(display, screen);
unsigned int height = DisplayHeight(display, screen);
window = XCreateSimpleWindow(display, DefaultRootWindow(display), 100, 100, width, height, 0, 0, 0);
XMapWindow(display, window);

The short answer is: you don’t.

The longer answer requires asking the question: what are you actually trying to achieve, and why are you using X11 to achieve it?

My implementation: Running a GStreamer pipeline in another process, ultimately using nveglglessink for rendering. I want to display the X11 window of this sink to GTK4.

I know it can be done with egl context and GtkPaintable, but this part takes a lot of time to learn, and I don’t have enough time to learn this part right now. I want to embed the X11 window directly into GTK4.

There’s a reason why the support exists for EGL and GdkPaintable: it’s because you cannot do it with X11 and embedding random window XIDs into GTK4.

Can I do this by using gtk4paintablesink?