[gst-devel] Re: using foreign windows
Havoc Pennington
hp at redhat.com
Wed Sep 26 20:58:02 CEST 2001
vishnu at pobox.com writes:
> i'm using Gtk 1.3.x and i'm curious if someone knows the correct
> way to embed foreign windows in my app.
>
> The gstreamer library does XOpenDisplay, creates a window, and uses
> this window for XPutImage (or the Xv equivalent). My app creates
> a GtkSocket and stuffs the foreign window inside with gtk_socket_steal.
> It works, somewhat, but it is easy to crash the app with:
>
> Xlib: unexpected async reply (sequence 0x12d7)!
>
> i believe this error indicates that two separate threads are using
> the same X connection (not sure though). Certainly the app has
> multiple threads, but i call gdk_threads_enter() before entering
> the main loop.
I believe you're supposed to call gdk_threads_leave() before entering
the main loop, but I could be wrong. See the FAQ on this topic.
> So the problem must be caused by directly accessing
> Xlib (not by gdk/gtk). This makes sense, because gstreamer calls
> Xlib directly.
>
> So, what is the correct way to make these two processes work
> together? How do panel applets solve this problem?
GtkSocket doesn't embed arbitrary X windows, it embeds X windows that
support the plug side of the XEMBED protocol. (see www.freedesktop.org
for the protocol.) In GTK 1.2 it embeds X windows that support the
plug side of a custom GTK protocol.
Panel applets use plug on the applet side. Panel also has a feature to
swallow arbitrary X windows, but it doesn't work worth a damn, because
you need a protocol to make it work.
Havoc
More information about the gstreamer-devel
mailing list