FVWM: That thing I said last time: asynchronous

From: Rusty Phillips <rustyp_at_freeshell.org>
Date: Tue, 06 Jul 2004 11:09:49 -0500

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);

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 }

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


--
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 - 10:57:49 BST

This archive was generated by hypermail 2.3.0 : Mon Aug 29 2016 - 19:37:56 BST