#!/usr/bin/perl -w
use strict;
my @defaultres=(1024,768);
my $normx=1024;
my $normy=768;
my $juximg="/usr/share/juxlala/images/juxlalabg.png";
my $juxscale="/home/knoppix/.juxscale";

my $normratio=1.0 * $normx/$normy;
# system("wavp /usr/share/sounds/KDE_Click.wav > /dev/null 2>/dev/null");

sub getres {
  my @res=(0,0);
  open(W,"xwininfo -root|") or return(@defaultres); 
  while(<W>) {
    chomp;
    if (/Width: (\d+)/) {
      $res[0]=$1;
    } elsif (/Height: (\d+)/) {
      $res[1]=$1;
    }
  }
  close(W);
  return @res;
}

(my $wd,my $hg)=getres();

my $ratio=1.0 * $wd/$hg ;

print "normratio $normratio, ratio=$ratio\n";

my $xscale=int(0.5 + 100 * $wd / $normx ) ;
my $yscale=int(0.5 + 100 * $hg / $normy ) ;
open(S,">$juxscale");
print S "XSCALE=$xscale\n";
print S "YSCALE=$yscale\n";
close(S);

print "xscale=$xscale\nyscale=$yscale\n";
exec('/usr/bin/xli','-onroot','-xzoom',$xscale,'-yzoom',$yscale,$juximg);



