FvwmPiazza

 view release on metacpan or  search on metacpan

lib/FvwmPiazza/Tiler.pm  view on Meta::CPAN

	foreach my $name (@names)
	{
	    if ($include and $name =~ /$include/i)
	    {
		$included = 1;
	    }
	    if ($exclude and $name =~ /$exclude/i)
	    {
		$excluded = 1;
		$self->debug(sprintf("No interest in 0x%x because excluding '%s'", $wid, $name));
	    }
	}
	if (!$included or $excluded)
	{
	    $interest = 0;
	}
    }

    return $interest;
} # check_interest

=head2 parse_options

Parse the option string, either old-style or new-style.
Return max_win and the options array.

max_win is the first thing in the array which is returned.

=cut
sub parse_options {
    my $self = shift;
    my $opt_str = shift;

    my $max_win = 1;
    my @options = ();
    if ($opt_str)
    {
        if ($opt_str =~ /\s/)
        {
            @options = split(/\s+/, $opt_str);
        }
        else # old-style
        {
            @options = split(/,/, $opt_str);
        }
    }
    else
    {
        # no options given
        return ($max_win);
    }

    # old-style parsing
    if (defined $options[0] and $options[0] =~ /^(\d+)$/)
    {
        $max_win = $1;
        shift @options;
    }
    else # new-style
    {
        local @ARGV = @options;
        my $parser = new Getopt::Long::Parser(
            config => [qw(pass_through)]
            );
        if (!$parser->getoptions("max_win=i" => \$max_win))
        {
            $self->debug("getopt parsing failed");
        }
        @options = @ARGV;
    }
    return ($max_win, @options);
} # parse_options

=head2 dump_properties

Dump the properties of the given window.

=cut
sub dump_properties {
    my $self = shift;
    my %args = (
		window=>undef,
		@_
	       );
    my $wid = $args{window};
    open (XPROP, "xprop -id $wid |") or die "Could not start xprop";
    while (<XPROP>)
    {
	$self->debug("$_");
    }
    close XPROP;

} # dump_properties

=head2 get_page_windows

Get the windows on the given page.

=cut
sub get_page_windows {
    my $self = shift;
    my %args = (
		desk=>undef,
		pagex=>undef,
		pagey=>undef,
		@_
	       );

    # Find all the windows on this page
    my %page_windows = ();
    my $windata = $self->{winTracker}->data();
    while (my ($id, $window) = each %{$windata})
    {
	if (defined $window->{name})
	{
	    $self->debug("\t$id - " . $window->{name});
	}
	next unless (
	    $window->{desk} == $args{desk}
	    and $window->{page_nx} == $args{pagex}
	    and $window->{page_ny} == $args{pagey}



( run in 1.185 second using v1.01-cache-2.11-cpan-5c0b1e786e0 )