Re: FVWM: Store and Recall MousePosition? (ALT+Mouse3-Resize)

From: Gert Brinkmann <g111_at_netcologne.de>
Date: Tue, 30 Dec 2003 22:10:57 +0100

Mikhael Goikhman wrote:

> I would say any complex function should normally have only one "M",
> like in this sample:

OK. Just one question to be sure to understand how execution of this
complex functions works:

> DestroyFunc MyResizeDispatcher
> AddToFunc MyResizeDispatcher
> + C MyResize0
> + M MyResize
> + H MyResize
> + D MyResize2

All of the lines are walked through sequentially from top to bottom? The
"C" or "M" is just a condition if the line is executed or not, but
execution is not paused until such a condition is fulfilled? Is this right?

> The rest of the configuration is your whole example above with all 8 "M"
> replaced with "I". Then it works. Just don't forget "p" here:
>
> WarpToWindow $[POINTERX]p $[POINTERY]p

Yes, with this hints the function works as expected. Thank you very
much. Here is the current version of the functions:

-----------------------------------------------
DestroyFunc MyResize
AddToFunc MyResize
+ I StoreMousePos
+ I WarpToNearestEdge
+ I Resize
+ I RecallMousePos

DestroyFunc StoreMousePos
AddToFunc StoreMousePos
+ I SetEnv POINTERX $[pointer.wx]
+ I SetEnv POINTERY $[pointer.wy]

DestroyFunc RecallMousePos
AddToFunc RecallMousePos
+ I WarpToWindow $[POINTERX]p $[POINTERY]p

DestroyFunc WarpToNearestEdge
AddToFunc WarpToNearestEdge
+ I WarpToWindow 100 100

Mouse 3 WTSF M MyResize
-----------------------------------------------

What is missing now is to calculate the nearest edge and add the mouse
movement to the POINTERX/Y values. How can you calculate something in a
function? I need something like

DestroyFunc WarpToNearestEdge
AddToFunc WarpToNearestEdge
+ I SetEnv WARPX ($[w.width]/2 - $[pointer.wx] > 0 ? 0 : 100)
+ I SetEnv WARPY ($[w.height]/2 - $[pointer.wy] > 0 ? 0 : 100)
+ I WarpToWindow $[WARPX] $[WARPY]

There does not seem to exist a fvwm internal arithmetic language, so
maybe I have to use a shell command that returns "0" or "100"?

Ciao,

Gert
--
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 Dec 30 2003 - 15:08:52 GMT

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