Ah...I see the error of my ways. Each time I fork, it becomes a zombie
when it finishes. So...maybe a little help?
Obviously, detach would be the way to go here, except that FvwmPerl
kills itself when you detach it (at the end of this command). Is there
a nice way to fork with FvwmPerl and have the parent process remain to
collect more input, while the child exits when it feels like it?
I'll look into FvwmPerl myself tonight and see if I can come up with
anything.
Other than that, I think that xwd is not thread-safe for some reason.
I'd prefer not to put a lock on it, but that's what I'm going to try
after getting this forking thing working in some manner.
On Tue, 2004-07-06 at 11:57, Mikhael Goikhman wrote:
> On 06 Jul 2004 11:09:49 -0500, Rusty Phillips wrote:
> >
> > Here's an implementation that makes icon captures based on Scott
> > Smedley's suggestion and Tavis Ormandy's fvwm2rc file.
> >
> > It forks off the stuff that takes a long time and renices it to the
> > lowest possible priority. The downside is that there's a small chance
> > it will result in not getting an icon, and or the wrong icon because
> > there is only one variable to store icon captures. I have yet to cause
> > the second condition, though the first I can cause on my slow machine if
> > I try real hard.
> >
> > I'll try to figure out how to make it thread-safe later on today.
> >
> > This uses FvwmPerl, along with this command for it:
> > DestroyFunc eval
> > AddToFunc eval I SendToModule FvwmPerl eval $*
> >
> > Enjoy!
> >
> > DestroyFunc CaptureIcon
> > AddToFunc CaptureIcon
> > + I raise
> > + I eval open(TEMP12,"xwd -silent -id $[w.id] |"); \
> > local $/; \
> > $e=<TEMP12>; \
> > close(TEMP12);
>
> How is this last eval different from just:
>
> eval $e = `xwd -silent -id $[w.id]`
>
> > DestroyFunc UseCaptured
> > AddToFunc UseCaptured
> > + I eval my $pid; $SIG{'CHLD'}='IGNORE'; if(!($pid=fork)) { \
> > open(TEMP12, "|convert -scale $[fvwm_icon_size] -frame 1x1 \
> > -mattecolor black -quality 0 xwd:- \
> > png:$[HOME]/.fvwm/icon.tmp.$[w.id].png"); \
> > print TEMP12 $e; close(TEMP12); \
> > cmd("WindowId $[w.id] WindowStyle IconOverride, \
> > Icon $[HOME]/.fvwm/icon.tmp.$[w.id].png, StaysOnBottom"); \
> > } else { setpriority 0,$pid,19 }
>
> Don't expect any random fork() to work in FvwmPerl. You probably want:
>
> DestroyFunc UseCaptured
> AddToFunc UseCaptured
> + I eval detach(); setpriority 0, 0, 19; \
> saveFile("$[FVWM_USERDIR]/capture-$[w.id].xwd", \\$e); \
> system("convert -scale $[fvwm_icon_size] -frame 1x1 -quality 0 \
> -mattecolor black $[FVWM_USERDIR]/capture-$[w.id].xwd \
> png:$[FVWM_USERDIR]/icon-$[w.id].png"); \
> cmd("WindowId $[w.id] WindowStyle IconOverride, StaysOnBottom \
> Icon $[FVWM_USERDIR]/icon-$[w.id].png");
>
> Not tested, but something like this should work better.
>
> Of course, you may cause xwd to save directly into the capture file to
> save some megabytes of FvwmPerl's memory.
>
> > DestroyFunc FastThumb
> > AddToFunc FastThumb
> > + I CaptureIcon
> > #Use perl to store the pipe so that it can be used in asynchronous coding.
> > + I Iconify
> > + I UseCaptured
>
> Regards,
> Mikhael.
> --
> 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 Tue Jul 06 2004 - 20:12:19 BST