On Sun, Dec 01, 2002 at 12:48:46AM -0600, Jason White wrote:
> I've recently started using FvwmScript and have noticed that a couple
> fairly simple scripts I've written keep eating memory.  
Yes. ChangeTitle leaks was fixed for 2.4.x but I forgot to fix
the Change{Fore,Back}Color was not (and ChangeIcon was only
partially fixed). This will be fixed in 2.4.15. Thanks
> Having no idea
> why and not finding any answers in the archives, I thought I'd ask here.
> The scripts are available at:
> 
>  http://www.jdwhite.org/~jdwhite/FvwmApplet-BattMon
>  http://www.jdwhite.org/~jdwhite/FvwmApplet-WLANMon
> 
> Any thoughts would be appreciated.
There are workarounds.
For FvwmApplet-BattMon create 3 widgets with each the desired color
charging, ac-on, ac-off, then show/hide the widget depending
of the state.
A similar workaround can be used for WLANMon
Regards, Olivier
Here the modified version BattMon:
WindowTitle {FvwmApplet-BattMon}
WindowSize 70 25
#Font		-*-lucida-bold-r-normal-*-11-*-*-*-*-*-*
Font		-*-helvetica-bold-r-normal-*-12-*-*-*-*-*-*
# Use the FvwmScript default colors.
#BackColor {rgb:a0/90/80}
#ForeColor {black}
#ShadowColor	{black}
#HilightColor	{rgb:a0/90/80}
Init
 Begin
  Set $MainColorset=(GetScriptArgument 1)
  If $MainColorset <> {} Then
  Begin
   ChangeColorset 0 $MainColorset
   ChangeColorset 1 $MainColorset
   ChangeTitle 1 {BattMon}
  End
End
PeriodicTasks
 Begin
  If (RemainderOfDiv (GetTime) 5)==0 Then
  Begin
    Set $save_ac_bat = $ac_bat
    Set $save_charging = $charging
    Set $changed = 0
    Set $batcharge = (GetOutput {cat /proc/apm} 1 7)
    Set $remaining = (GetOutput {cat /proc/apm} 1 8)
    Set $ac_batt  =  (GetOutput {cat /proc/apm} 1 4)
    Set $charging =  (GetOutput {cat /proc/apm} 1 5)
    Set $remain_hrs = (Div $remaining 60)
    Set $raw_remain_min = (RemainderOfDiv $remaining 60)
    Set $cmd = {printf %02d }$raw_remain_min
    Set $remain_min = (GetOutput $cmd 1 -1)
    If $ac_batt <> $save_ac_batt Then
      Set $changed = 1
    If $save_charging <> $charging Then
      Set $changed = 1
    If $changed == 1 Then
    Begin
      If $ac_batt=={0x01} Then
      Begin
        # On AC power
        If $charging=={0x03} Then
        Begin
          ShowWidget 1
          HideWidget 2
          HideWidget 3
          #ChangeForeColor 1 {#ff0028}
        End
        Else
        Begin
          ShowWidget 2
          HideWidget 1
          HideWidget 3
          #ChangeForeColor 1 {black}
        End
      End
      Else
      Begin
        ShowWidget 3
        HideWidget 1
        HideWidget 2  
        #ChangeForeColor 1 {#ff6400}
        #ChangeForeColor 1 {blue}
      End
    End
   
    Set $title = $batcharge{ }$remain_hrs{:}$remain_min
    If $save_title <> $title Then
    Begin
      Set $save_title= $title
      ChangeTitle 1 $title
      ChangeTitle 2 $title
      ChangeTitle 3 $title
   End
 End  
End
Widget 1
Property
 Position 0 0
 Size 70 25
 Type ItemDraw
 Flags NoReliefString
 Title {}
 ForeColor {#ff0028}
Main
 Case message of
  SingleClic :
  Begin
  End
End
Widget 2
Property
 Position 0 0
 Size 70 25
 Type ItemDraw
 Flags NoReliefString
 Title {}
 ForeColor {black} 
 Main
  Case message of
  SingleClic :
  Begin
  End
End
Widget 3
Property
 Position 0 0
 Size 70 25
 Type ItemDraw
 Flags NoReliefString
 Title {}
 ForeColor {blue}
 Main
  Case message of
  SingleClic :
  Begin
  End
 End
            
> Thank you.
> 
> -- 
> Jason White (jdwhite_at_jdwhite.org)  http://www.jdwhite.org/~jdwhite
> AIM:jdwhite90125  Yahoo:jdwhite89  ICQ:9295078  MSN:jdwhite89_at_hotmail.com
> Jabber:jdwhite_at_jabber.org  IRC:irc.netbsd.org/{jdwhite,jdw}
> --
> Visit the official FVWM web page at <URL: http://www.fvwm.org/>.
> To unsubscribe from the list, send "unsubscribe fvwm" in the body of a
> message to majordomo_at_fvwm.org.
> To report problems, send mail to fvwm-owner_at_fvwm.org.
> 
--
Visit the official FVWM web page at <URL: http://www.fvwm.org/>.
To unsubscribe from the list, send "unsubscribe fvwm" in the body of a
message to majordomo_at_fvwm.org.
To report problems, send mail to fvwm-owner_at_fvwm.org.
Received on Sun Dec 01 2002 - 03:51:55 GMT