Subject: FVWM: Drag to create an xterm

From: Uwe Pross <[email-masked]>
Date: Thu, 31 Mar 2005 14:02:10 +0200

Hi there,

recently I saw a demonstration of plan 9 where the
presenter clicked on the root window and dragged a
rectangle to start a terminal with position and size of the
drag gesture. I think this is a really nice way to start
and place xterms or other apps.

I am thinking of writing a fvwm function to achieve this
and stuck currently at following points. 
- A grid should be drawn while dragging.
- Xterm (or another app) should be started on key release.

Any suggestions how to achieve the desired behaviour?

Thanks in advance.

Regards, Uwe
-- 
  ,_,   For personal reply/mail put "fvwm"
 (O,O)  in the subject.
 (   )  Otherwise your mail is discarded by a filter.
=-"-"-= http://www.tu-chemnitz.de/~uwp
--
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 [email-masked].
To report problems, send mail to [email-masked].

---

From: Tavis Ormandy <[email-masked]>
Date: Thu, 31 Mar 2005 14:49:07 +0100

> Any suggestions how to achieve the desired behaviour?

Wow, that's a really cool idea!

The fist part is no problem, it's easy to start an xterm when drawing a
rectangle and identifying the pointer position when you started, but I'm
not sure how you could find the length and width of the rectangle.

Something like this should start an xterm at the stroke start position when
you draw a rectangle on the root window:

AddToFunc StrokeFuncWrapper
+ I SetEnv StrokeStart +$[pointer.x]+$[pointer.y]
+ I StrokeFunc DrawMotion FeedBack StrokeWidth 2 EchoSequence

AddToFunc StartStrokeXterm I Exec exec xterm -g $[StrokeStart]

Mouse 3 R A StrokeFuncWrapper
Stroke N741236987 0 R N StartStrokeXterm

I can't think of anyway to identify the geometry of the drawn rectangle,
my first thought was to capture the output of EchoSequence, but
unfortunately that isn't much use.

-- 
-------------------------------------
[email-masked] | finger me for my gpg key.
-------------------------------------------------------
--
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 [email-masked].
To report problems, send mail to [email-masked].

---

From: Stephen Dennison <[email-masked]>
Date: Thu, 31 Mar 2005 13:24:46 -0500

> unfortunately that isn't much use.

Cool, indeed.

I dont appear to have stroke support compiled into mine, but I was
able to create an effect sort of like what you describe.  I use
FvwmEvent in conjunction with a variable to decide whether or not to
immediately resize the last window created.  Then I bind the middle
mouse button to set that variable and to spawn an xterm at the cursor
position.

##### .fvwm2rc modifications #####
# set default to not resize new windows
SetEnv doResizeStuff false

Mouse 2 R A PlaceTermWithResize

DestroyFunc PlaceTermWithResize
AddToFunc PlaceTermWithResize
+ H Exec exec xterm -geom 10x1+$[pointer.x]+$[pointer.y]
+ H SetEnv doResizeStuff True

#following requires that FvwmEvent has been started already
*FvwmEvent: add_window CheckXtermResize

DestroyFunc CheckXtermResize
AddToFunc CheckXtermResize
+ I Test ($[doResizeStuff]) Resize
+ I SetEnv doResizeStuff False
#########################

To use it, you click the middle mouse button, drag diagonally, release
the button at any time, and click again to set the lower right bounds.

I use M instead of I in PlaceTermWithResize because it seemed slightly
more correct in appearance.  Not entirely correct.  With I, you had to
click to do the resize.  With M, it's already doing the resize, but
you have to let go of the button before it will show you the
outline... and then you have to click again for it to finish the
resize.

--s.r.d.
p.s.: Oops!  I did a reply to the wrong address the first time around...