… | |
… | |
393 | not. |
393 | not. |
394 | |
394 | |
395 | Here is a short Gtk2-perl snippet that illustrates how this option can be |
395 | Here is a short Gtk2-perl snippet that illustrates how this option can be |
396 | used (a longer example is in F<doc/embed>): |
396 | used (a longer example is in F<doc/embed>): |
397 | |
397 | |
398 | my $rxvt = new Gtk2::DrawingArea; |
398 | my $rxvt = new Gtk2::Socket; |
399 | $...->add ($rxvt); # important to add it somewhere first |
399 | $rxvt->signal_connect_after (realize => sub { |
400 | $rxvt->realize; # now it can be realized |
|
|
401 | my $xid = $rxvt->window->get_xid; |
400 | my $xid = $_[0]->window->get_xid; |
402 | |
|
|
403 | system "@@RXVT_NAME@@ -embed $xid &"; |
401 | system "@@RXVT_NAME@@ -embed $xid &"; |
|
|
402 | }); |
404 | |
403 | |
405 | =item B<-pty-fd> I<fileno> |
404 | =item B<-pty-fd> I<fileno> |
406 | |
405 | |
407 | Tells @@RXVT_NAME@@ NOT to execute any commands or create a new pty/tty |
406 | Tells @@RXVT_NAME@@ NOT to execute any commands or create a new pty/tty |
408 | pair but instead use the given filehandle as the tty master. This is |
407 | pair but instead use the given filehandle as the tty master. This is |
… | |
… | |
419 | use IO::Pty; |
418 | use IO::Pty; |
420 | use Fcntl; |
419 | use Fcntl; |
421 | |
420 | |
422 | my $pty = new IO::Pty; |
421 | my $pty = new IO::Pty; |
423 | fcntl $pty, F_SETFD, 0; # clear close-on-exec |
422 | fcntl $pty, F_SETFD, 0; # clear close-on-exec |
424 | |
|
|
425 | system "@@RXVT_NAME@@ -pty-fd " . (fileno $pty) . "&"; |
423 | system "@@RXVT_NAME@@ -pty-fd " . (fileno $pty) . "&"; |
|
|
424 | close $pty; |
426 | |
425 | |
427 | # now communicate with rxvt |
426 | # now communicate with rxvt |
428 | my $slave = $pty->slave; |
427 | my $slave = $pty->slave; |
429 | while (<$slave>) { print $slave "got <$_>\n" } |
428 | while (<$slave>) { print $slave "got <$_>\n" } |
430 | |
429 | |