On Mon, 7 Sep 2009, Thomas Adam wrote:
> 2009/9/7 Lucio Chiappetti <
lucio@lamb...>:
>> What I'd want to do is to redefine the F4 F5 F6 so that instead of
>> issuing a Style command to a pre-existing "Laser" window, they create
>> one, and use the rePointLaser function/event passing to it a different
>> shift size (actually a couple of xsize,ysize).
> If F4, F5 and F6 have the predefined sizes already...
Well ... the size of the icon is given by the png file associated to the
style ...
>
> Key F4 .... PipeRead `echo "SetEnv xsize 2" && echo "SetEnv ysize 4"
> && start_application_name -options`
I was baffled by the fact you used backquotes `` instead of ''. The former
freeze everything.
I am not fully there yet. What I wanted were two triplets of commands.
Shift-F1/F2/F3 should CREATE a new "pseudocursor" of a given shape.
Unshifted F1/F2/F3 should CHANGE the shape of the pseudocursor under the
mouse.
I thought to define a base style, three variants (LaserA/B/C) associated
to the three icons, and a "current/default" style
Style LaserBase StickyIcon, StickyAcrossDesks, Layer 9, !IconTitle,
IconBox none, PositionPlacement UnderMouse
Style LaserA Icon beam.png , UseStyle LaserBase
Style LaserB Icon circle.png, UseStyle LaserBase
Style LaserC Icon ellipse.png , UseStyle LaserBase
Style Laser UseStyle LaserA
The creation function will imply the initial style via the -name
DestroyFunc PointLaser
AddToFunc PointLaser
+ I Exec xterm -name Laser$0 -iconic
I originally defined shift-F4/F5/F6 to invoke PointLaser B/C/A. It did
work but ... see below. Now I use PointLaser (which means only style
Laser) and pass the icon name as another environment variable
PointerKey F4 A S PipeRead 'echo "SetEnv xof 50" &&
echo "SetEnv yof 50" &&
echo "SetEnv ik circle" &&
echo "PointLaser "'
PointerKey F5 A S PipeRead 'echo "SetEnv xof 100" &&
echo "SetEnv yof 50" &&
echo "SetEnv ik ellipse" &&
echo "PointLaser "'
PointerKey F6 A S PipeRead 'echo "SetEnv xof 40" &&
echo "SetEnv yof 40" &&
echo "SetEnv ik beam" &&
echo "PointLaser "'
(it's a bit verbose, I hoped I could call something like "MyF 50 50
circle" and move all the PipeRead stuff in the function MyF, but I'm not
too versed with PipeRead (euphemism, it's the first time I use it,
though the use of "transient environment variables" is not unlike some
techniques of shell programming I used).
This way the event handler is like this
DestroyFunc rePointLaser
AddToFunc rePointLaser
+ I ThisWindow ("Laser*") Move m-$[xof]p m-$[yof]p
+ I ThisWindow ("Laser*") Style Laser Icon $[ik].png
+ I UnsetEnv xof
+ I UnsetEnv yof
+ I UnsetEnv ik
DestroyModuleConfig Event-PL: *
*Event-PL: Cmd Function
*Event-PL: add_window rePointLaser
The point is that the unshifted F4/F5/F6 change SHAPE to all existing
pseudocursors (if more than one exist). Not surprising since now one
common style Laser is used. Actually even the creation shift-F4/5/6 have
the side effect that all pre-existing pseudocursors are changed to the
last shape invoked.
PointerKey (Laser*) F4 I N Style Laser Icon circle.png
PointerKey (Laser*) F5 I N Style Laser Icon ellipse.png
PointerKey (Laser*) F6 I N Style Laser Icon beam.png
What I'd ideally need is a way to change the icon per window from the
outside (having styles named Lasernnn with a sequential number ?)
PointerKey (Laser*) F4 I N Style <of the current window only> Icon
circle.png
For the time being I'd live with what I have, since the real videoconf is
coming soon, and I won't plan to have more than one pseudocursor at a
time. But I'd like a smarter way to do this.
--
------------------------------------------------------------------------
Lucio Chiappetti - INAF/IASF - via Bassini 15 - I-20133 Milano (Italy)
For more info :
http://www.iasf-milano.inaf.it/~lucio/personal.html
opensubscriber is not affiliated with the authors of this message nor responsible for its content.