I was trying (and have now succeeded) to embed VLC into an embedder on a form, then dynamically create multiple instances of that form in dynamically created multiple panels on a host form, or in laymen's terms 'play as many videos as I wanted in one containing window'.
To do this I needed to spawn a video player, find it, then embed it. Spawning the player is no problem, and finding it should also have been easy since I could use the window name. The video player chosen was VLC, and after finding out how to uniquely set the title of the VLC window I ran headlong into the problem of finding that window by what I assumed would be it's unique name under X. This is where the trouble started, and I place the blame squarely on the developers of VLC, I hope this information helps others. Lets say we launch VLC from a bash shell with the following; $ vlc --intf rc --video-title Fred ~/MyVideo.avi This places the VLC interface into Remote Control mode (--intf rc), allowing us to send commands to it by the the console (potentially VERY useful) and puts the title 'Fred' at the top of the window. Now in another command shell type xprop. $ xprop The mouse cursor will turn to a cross-hair, move it over the VLC window and click on it. Have a look at the resulting output... what you're to looking for is WM_NAME(STRING) = "VLC media player" WM_NAME can be the name of the window (in this case it should be 'Fred'), but it does not HAVE to be the same as the (visible) window name. The good folks who develop VLC decided to keep the value of WM_NAME as 'VLC media player' instead of the name that the user (me in this case) wanted; as a result Desktop.Find will never locate a window called 'Fred' because as far as it is concerned 'Fred' does not exist. What to do? As it turns out we CAN change the visible title of an X-Window on the fly, a little program called 'wmctrl' allows us to rename the window, and my first thought was "GREAT! It can set WM_NAME to the value I want... problem solved!". Uh... no. It turns out that 'wmctrl' does indeed change WM_NAME, but it does not set it to the value you pass in... it sets it to nothing, blank, nada, zip, zilch,... bupkus. Great, but... YEAH... we can work with this, here's how; Launch VLC using the shell command, the visible window title doesn't matter at this time. Use desktop.find to locate the window 'VLC media player' and hang onto the handle. Use another shell command to launch wmctrl and change the visible name of the VLC window to whatever you desire. THIS WILL BLANK WM_NAME. Embed the VLC window using the handle we got from desktop.find. Because VLC will create all future instances of itself with the same WM_NAME, the next time you run through the above process (as long as you put a second or so delay in between them) you will correctly find the next instance created and get a handle on it (sic). ------------------------------------------------------------------------------ Get a FREE DOWNLOAD! and learn more about uberSVN rich system, user administration capabilities and model configuration. Take the hassle out of deploying and managing Subversion and the tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2 _______________________________________________ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user