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

From: Mikhael Goikhman <migo_at_homemail.com>
Date: Mon, 29 Dec 2003 00:47:00 +0000

On 28 Dec 2003 23:30:41 +0100, Gert Brinkmann wrote:
>
> while trying to write a resize-function that behaves like the
> ALT+Mouse3-Resizing(*) in other WMs, I have a problem: How can the
> Mouse-Pointer be stored and later be recalled? I am trying it like...
> (see below). Result: The mouse pointer is not moved after resizing. Does
> anybody has an idea how to solve this?
>
>
> (*) How it should work: Press ALT and Mouse3-Button => Resize the window
> at the corner of the window that is nearest to the mouse pointer. After
> this resize operation the mouse pointer should be placed where it has
> been before starting the resize operation. (It would be optimal if this
> initial position would be modified by the value you have moved the mouse
> while resizing.)
>
> ----------------------------------------------
> DestroyFunc MyResize
> AddToFunc MyResize
> + M StoreMousePos
> + M WarpToNearestEdge
> + M Resize
> + M RecallMousePos
>
> DestroyFunc StoreMousePos
> AddToFunc StoreMousePos
> + M SetEnv POINTERX $[pointer.wx]
> + M SetEnv POINTERY $[pointer.wy]
>
> DestroyFunc RecallMousePos
> AddToFunc RecallMousePos
> + M WarpToWindow $[POINTERX] $[POINTERY]
>
> DestroyFunc WarpToNearestEdge
> AddToFunc WarpToNearestEdge
> + M WarpToWindow 100 100
> ----------------------------------------------

You overuse the "M" specifier, such functions are not reusable and this
is usually not what you want.

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

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

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

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.
Received on Sun Dec 28 2003 - 18:49:19 GMT

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