From 51f8b997f0bb1f2ed912b50222b77aa3058b6ca2 Mon Sep 17 00:00:00 2001 From: Harvie Date: Thu, 8 Jul 2010 00:56:51 +0200 Subject: [PATCH] example of embeding xterm into gtk2 app --- perl/gtk2/xterm-embed.pl | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100755 perl/gtk2/xterm-embed.pl diff --git a/perl/gtk2/xterm-embed.pl b/perl/gtk2/xterm-embed.pl new file mode 100755 index 0000000..0d12884 --- /dev/null +++ b/perl/gtk2/xterm-embed.pl @@ -0,0 +1,20 @@ +#!/usr/bin/env perl +use strict; +use warnings; +use Gtk2 -init; + +my $window = Gtk2::Window->new ('toplevel'); +$window->set_default_size(640, 480); +$window->signal_connect( destroy => sub { + Gtk2->main_quit(); +}); + +my $xterm = new Gtk2::Socket; +$xterm->signal_connect_after( realize => sub { + my $xid = $_[0]->window->get_xid; + system "xterm -bg black -fg white -into $xid -e 'ls -l; bash' &"; +}); + +$window->add($xterm); +$window->show_all; +Gtk2->main; -- 2.30.2