Re: plug and socket?



On 05/18/01 John McDermott wrote:
Has anyone created a plug/socket combo to allow an arbitrary
program(e.g. xcalc) to be displayed in gtk window of a perl script
(using gtk-perl)? I do not necessarily have source to the program I want
to display in the window.

=cut cut=
use Gtk;
init Gtk;

$id = int(shift);

$mw = new Gtk::Window;
$mw->set_title('stealed window');
$mw->signal_connect('destroy', sub {main_quit Gtk;});
$sock = new Gtk::Socket;
$mw->add($sock);
$mw->show_all;
$sock->steal($id);
main Gtk;
=cut cut=

You need to give it the window ID of the window to swallow on the 
command line.
Note that the window manager may interfere with the process
sometimes: this code works for me, though, with sawfish.
To get the window ID if you don't control the app you want
to embed, you may need to use xwininfo or xlsclients.

lupus

-- 
-----------------------------------------------------------------
lupus debian org                                     debian/rules
lupus ximian com                             Monkeys do it better




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]