Commit 43ef1cd6 authored by Daniel P. Berrange's avatar Daniel P. Berrange

Add example using GTK-VNC + virDomainOpenGraphics

parent 6990b441
......@@ -6,6 +6,8 @@ New in 0.9.7:
- Add all new APIs in libvirt 0.9.7
- Add binding for virDomainOpenConsole
- Fix missing $flags in documentation
- Added example integrating Sys::Virt::Domain->open_graphics
GTK3 and GTK-VNC
New in 0.9.5:
......
#!/usr/bin/perl
use Gtk3 -init;
use Sys::Virt;
Glib::Object::Introspection->setup(
basename => 'GtkVnc',
version => '2.0',
package => 'GtkVnc');
Glib::Object::Introspection->setup(
basename => 'GVnc',
version => '1.0',
package => 'GVnc');
GVnc::util_set_debug(true);
my $window = Gtk3::Window->new ('toplevel');
my $display = GtkVnc::Display->new();
my ($SOCK1, $SOCK2);
if (1) {
use IO::Socket;
($SOCK1, $SOCK2) = IO::Socket->socketpair(AF_UNIX, SOCK_STREAM, PF_UNSPEC)
or die "cannot create socketpair: $!";
my $c = Sys::Virt->new(uri => "qemu:///session");
my $d = $c->get_domain_by_name("vm-vnc");
$d->open_graphics(0, $SOCK1->fileno);
$display->open_fd($SOCK2->fileno);
} else {
$display->open_host("localhost", "5900");
}
$window->add($display);
$window->show_all;
Gtk3::main;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment