Enlightenment CVS committal

Author  : kwo
Project : e16
Module  : e

Dir     : e16/e/sample-scripts


Modified Files:
        bouncingball.pl lcdmover.sh shade-pagers.pl testroller.pl 


Log Message:
Make old sample scripts work.

===================================================================
RCS file: /cvs/e/e16/e/sample-scripts/bouncingball.pl,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -3 -r1.5 -r1.6
--- bouncingball.pl     19 Jan 2004 22:30:26 -0000      1.5
+++ bouncingball.pl     28 Jan 2007 04:37:43 -0000      1.6
@@ -27,46 +27,26 @@
 # then when it's done bouncing it gets rid of it.
 
 
-$screen_size = `eesh -ewait \"general_info screen_size\"`;
+$s = `eesh screen size`;
+chomp($s);
 
-chomp($screen_size);
-
-($crap,$width,$height) = split(/\s+/,$screen_size);
-
-
-# we'll create the ball here and by process of elimination determine what
-# the winid is.
[EMAIL PROTECTED] = `eesh -ewait window_list`;
-
-`eesh -e \"dialog_ok Follow the Bouncing Ball\"`;
[EMAIL PROTECTED] = `eesh -ewait window_list`;
-
-# run through the two lists and figure out which one is new.
-
-foreach $item1 (@winlist2) {
-       $inside = 0;
-       foreach $item2 (@winlist1) {
-               $inside = 1 if($item1 eq $item2);
-       }
-       $ballwininfo = $item1 if(!$inside);
+($crap,$width,$height) = split(/\s+/,$s);
+if ($s =~ /.*size\s+(\d+)x(\d+)/) {
+  $width = $1; $height = $2;
 }
 
-# call the ball, ace
-# (now we have the windowid of our ball)
-
-($ball,$message) = split(/ \: /,$ballwininfo);
-$ball =~ s/\s+//g;
-
-$ballloc = `eesh -ewait \"win_op $ball move ?\"`;
-$ballsize = `eesh -ewait \"win_op $ball resize ??\"`;
+`eesh dialog_ok \"Follow the Bouncing Ball\"`;
+$ball = "Message";
 
-$ballloc =~ s/^.*\: //g;
-$ballloc =~ s/\n//g;
-$ballsize =~ s/^.*\: //g;
-$ballsize =~ s/\n//g;
-
-($ballx,$bally) = split(/\s+/,$ballloc);
-($ballw,$ballh) = split(/\s+/,$ballsize);
+$s = `eesh win_op $ball move "?"`;
+if ($s =~ /.*:\s+(\d+)\s+(\d+)/) {
+  $ballx = $1; $bally = $2;
+}
+$s = `eesh win_op $ball size "??"`;
+if ($s =~ /.*:\s+(\d+)\s+(\d+)/) {
+  $ballw = $1; $ballh = $2;
+}
+#print "x,y=$ballx,$bally wxh=$ballw x $ballh\n";
 
 # now for the fun part.  make that baby bounce up and down.
 # we're going to open a big pipe for this one and just shove data
@@ -86,6 +66,7 @@
                        $bally = $height - $ballh;
                }
                print IPCPIPE "win_op $ball move $ballx $bally\n";
+               system("usleep 20000");
        }
 
        if($fallspeed[i+1]) {
@@ -102,6 +83,7 @@
                        $bally = $originalbally + int($originalbally * 
(1/$#fallspeed));
                }
                print IPCPIPE "win_op $ball move $ballx $bally\n";
+               system("usleep 20000");
        }
        $i++;
 }
===================================================================
RCS file: /cvs/e/e16/e/sample-scripts/lcdmover.sh,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -3 -r1.5 -r1.6
--- lcdmover.sh 19 Jan 2004 22:30:27 -0000      1.5
+++ lcdmover.sh 28 Jan 2007 04:37:43 -0000      1.6
@@ -25,38 +25,24 @@
 # Instructions: move the top window and see what happends to the lower one.
 #
 
-# The very wierd and bad way of getting the windowids of the two message
-# windows in bash, there must be a better way!
-
-# Open a window then get the windowid of it (hopefully)
+# Open dialog 1
 eesh -e "dialog_ok Move this window"
-window=`eesh -ewait window_list|grep Message`
-a=0
-for i in $window;do
-       a=$(($a + 1))
-       if [ $a = 1 ];then
-               windowid=$i
-       fi
-done
+usleep 100000
+eesh -e "wop Message title Dlg1"
+usleep 100000
 
-# open a new dialog, then get the windowids of all windows named "Message" then
-# get the id that's not equal the first window we created
+# Open dialog 2
 eesh -e "dialog_ok Watch me follow the above window"
-window2=`eesh -ewait window_list|grep Message|grep -v $windowid`
-a=0
-for i in $window2;do
-    a=$(($a + 1))
-       if [ $a = 1 ];then
-      windowid2=$i
-       fi
-done
+usleep 100000
+eesh -e "wop Message title Dlg2"
+usleep 100000
 
 # In one endless loop, get window position of the first window, then move the
 # second one accordingly...
-while true;do
-
+while true
+do
        # Get position
-       pos=`eesh -ewait "win_op $windowid move ? ?"`
+       pos=`eesh wop Dlg1 move "?"`
        a=0
        for i in $pos;do
                a=$(($a + 1))
@@ -69,5 +55,5 @@
        done
                
        # Move the second window to the new position
-       eesh -e "win_op $windowid2 move $xpos $(($ypos + 74))"
+       eesh wop Dlg2 move $xpos $(($ypos + 74))
 done
===================================================================
RCS file: /cvs/e/e16/e/sample-scripts/shade-pagers.pl,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- shade-pagers.pl     19 Jan 2004 22:30:27 -0000      1.4
+++ shade-pagers.pl     28 Jan 2007 04:37:43 -0000      1.5
@@ -24,9 +24,6 @@
 # This is a hack of mandrake's "testroller.pl" that shades/unshades all your
 # pager windows
 
[EMAIL PROTECTED] = `eesh -ewait window_list`;
[EMAIL PROTECTED] = `eesh -ewait \"internal_list internal_ewin\"`;
-
 # here we're going to test to see whether we are shading or unshading
 # the window.
 
@@ -41,29 +38,24 @@
 
 # make sure that we're not an internal window in our list
 
[EMAIL PROTECTED] = `eesh window_list`;
 foreach(@winlist_temp) {
     chomp;
-    @stuff = split /\:/;
-    $insert = 0;
-    foreach $member (@intlist_temp) {
-        chomp($member);
-        $stuff[0] =~ s/\s+//g;
-        $member =~ s/\s+//g;
-        if(($member eq $stuff[0]) && ($stuff[1] =~ /^\s*\d+\s*$/)) {
-            $insert = 1;
-        }
-    }
-    if($insert) {
-        push @winlist,$stuff[0] if($stuff[0]);
+    @stuff = split /\s*\:\s*/;
+#   print ">$stuff[0]<>$stuff[1]<\n";
+    if ($stuff[1] =~ /^Pager-.*/) {
+        push @winlist,$stuff[0] if ($stuff[0]);
     }
 }
 
-open IPCPIPE,"| eesh";
-
 # now we're going to walk through each of these windows and
 # shade them
 
+open IPCPIPE,"| eesh";
 foreach $window (@winlist) {
     print IPCPIPE "win_op $window shade $shade\n";
 }
 close IPCPIPE;
+
+# Alternatively, simply do
+#$ eesh wop Pager* shade [on|off]
===================================================================
RCS file: /cvs/e/e16/e/sample-scripts/testroller.pl,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -3 -r1.5 -r1.6
--- testroller.pl       19 Jan 2004 22:30:27 -0000      1.5
+++ testroller.pl       28 Jan 2007 04:37:43 -0000      1.6
@@ -30,9 +30,6 @@
 #
 # --Mandrake
 
[EMAIL PROTECTED] = `eesh -ewait window_list`;
[EMAIL PROTECTED] = `eesh -ewait \"internal_list internal_ewin\"`;
-
 # here we're going to test to see whether we are shading or unshading
 # the window.
 
@@ -42,85 +39,61 @@
        $shade = 0;
 }
 
-
-# make sure that we're not an internal window in our list
-
-foreach(@winlist_temp) {
-       chomp;
-       @stuff = split /\:/;
-       $insert = 1;
-       foreach $member (@intlist_temp) {
-               chomp($member);
-               $stuff[0] =~ s/\s+//g;
-               $member =~ s/\s+//g;
-               if($member eq $stuff[0]) {
-                       $insert = 0;
-               }
-       }
-       if($insert) {
-               push @winlist,$stuff[0] if($stuff[0]);
-       }
-}
-
 # here we'll retreive the current desk we're on
 
-$current_desk = `eesh -ewait \"goto_desktop ?\"`;
[EMAIL PROTECTED] = split(/\:/,$current_desk);
-$current_desk = $stuff[1];
-$current_desk =~ s/\n//g;
-$current_desk =~ s/^\s+//;
+$_ = `eesh desk`;
[EMAIL PROTECTED] = split(/\s*:\s*/);
[EMAIL PROTECTED] = split(/\s*\/\s*/, $stuff[1]);
+$current_desk = $stuff[0];
 
 # here we'll retreive the current area we're on
 
-$current_area = `eesh -ewait \"goto_area ?\"`;
[EMAIL PROTECTED] = split(/\:/,$current_area);
+$_ = `eesh area`;
[EMAIL PROTECTED] = split(/\s*\n\s*/);
[EMAIL PROTECTED] = split(/\s*:\s*/, $stuff[0]);
 $current_area = $stuff[1];
 $current_area =~ s/\n//g;
-$current_area =~ s/^\s+//;
 
 
 # get the old shadespeed so that we can set it back later
 # because we want this to happen fairly quickly, we'll set
 # the speed to something really high
 
-$shadespeed = `eesh -ewait \"fx window_shade_speed ?\"`;
[EMAIL PROTECTED] = split(/\: /,$shadespeed);
+$_ = `eesh show misc.shading.speed`;
[EMAIL PROTECTED] = split(/\s*\n\s*/);
[EMAIL PROTECTED] = split(/\s*=\s*/, $stuff[0]);
 $shadespeed = $stuff[1];
-chomp($shadespeed);
 
 open IPCPIPE,"| eesh";
-print IPCPIPE "fx window_shade_speed 10000000\n";
+print IPCPIPE "set misc.shading.speed 10000000\n";
 
 # now we're going to walk through each of these windows and
 # shade them
 
-foreach $window (@winlist) {
-       $cur_window_desk = `eesh -ewait \"win_op $window desk ?\"`;
-       @stuff = split(/\:/,$cur_window_desk);
-       $cur_window_desk = $stuff[1];
-       $cur_window_desk =~ s/\n//g;
-       $cur_window_desk =~ s/^\s+//;
-       if($cur_window_desk eq $current_desk) {
-               $cur_window_area = `eesh -ewait \"win_op $window area ?\"`;
-               @stuff = split(/\:/,$cur_window_area);
-               $cur_window_area = $stuff[1];
-               $cur_window_area =~ s/\n//g;
-               $cur_window_area =~ s/^\s+//;
-               if($cur_window_area eq $current_area) {
-                       if($shade) {
-                               print IPCPIPE "win_op $window shade on\n";
-                       } else {
-                               print IPCPIPE "win_op $window shade off\n";
-                       }
-
[EMAIL PROTECTED] = `eesh window_list a`;
+foreach (@winlist) {
+       if (/\s*(\w+)\s* : .* :: \s*(-*\d+)\s* : (.*) : (.*)$/) {
+               $window = $1;
+               $desk = $2;
+               $area = $3;
+               $name = $4;
+
+               # Skip pagers, iconboxes, systrays, and epplets
+               next if ($name =~ /^Pager-|Iconbox|Systray|E-/);
+#              next unless (($desk == -1) and ($desk eq $current_desk));
+               next unless ($desk eq $current_desk);
+               next unless ($area eq $current_area);
+               if ($shade) {
+                       print IPCPIPE "win_op $window shade on\n";
+               } else {
+                       print IPCPIPE "win_op $window shade off\n";
                }
        }
 }
 
 # now we're going to set the shade speed back to what it was originally
 
-print IPCPIPE "fx window_shade_speed $shadespeed\n";
+print IPCPIPE "set misc.shading.speed $shadespeed\n";
 close IPCPIPE;
-
 
 # that's it!



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to