--- rxvt-unicode/src/perl/automove-background 2006/01/20 15:24:24 1.3 +++ rxvt-unicode/src/perl/automove-background 2006/03/04 23:07:30 1.9 @@ -1,18 +1,39 @@ #! perl +sub xy { + my ($self) = @_; + + $self->XTranslateCoordinates ( + $self->vt, $self->DefaultRootWindow, + 0, 0 + ) +} + +sub on_osc_seq { + my ($self, $op, $args) = @_; + + if ($op == 20) { + my ($pic, $commands) = split(/;/, $args, 2); + if ($pic !~ /^$/ && $commands !~ /[+\-]/) { + my ($x, $y) = $self->XTranslateCoordinates ( + $self->vt, $self->DefaultRootWindow, + 0, 0 + ); + my ($x, $y) = $self->xy; + $self->cmd_parse ("\033]20;$pic;=+$x+$y\007"); + return 1; + } + } + + () +} + sub on_configure_notify { my ($self, $event) = @_; - my ($x, $y); - - if ($event->{send_event}) { - ($x, $y) = ($event->{x}, $event->{y}); - } else { - ($x, $y) = $self->XTranslateCoordinates ( - $self->parent, $self->DefaultRootWindow, - 0, 0 - ); - } + my ($x, $y) = $self->xy; $self->cmd_parse ("\033]20;;=+$x+$y\007"); + + () }