Subject: Patch: A new way to handle Stroke

From: Olivier Chapuis <[email-masked]>
Date: Sun, 07 Nov 1999 23:29:31 +0100

Hello,

Attached to this message a patch which concerns the Stroke patch.
In fact this patch contains a new way to handle mouse Stroke.

I have add a new builtin function called StrokeFunc. Here the man
page between the two ------ lines:

----------
.TP
.B "StrokeFunc [\fIOptions\fP]"
This command causes fvwm to "wait" for a mouse stroke. The cursor
is modified to the STROKE context of the CursorStyle command.
When the stroke is "finished" StrokeFunc looks to a Stroke 
binding of the form
.EX
Stroke sequence 0 Context Modifiers action
.EE
and execute the action accordingly (Note the 0). Normal use of this
function is via a Mouse or Key command. E.g.:
.EX
Mouse 3 A M StrokeFunc
Key x R N StrokeFunc
.EE
If you press mouse button 3 and Alt anywhere (respectively, press the key
x when the pointer is on the root window), then fvwm will record the
mouse motions until the mouse button 3 (respectively, the x key) is 
released and then check if the recorded \fIsequence\fP correspond
to a Stroke binding of the form  "Stroke \fIsequence\fP 0 A M action"
(respectively, "Stroke \fIsequence\fP 0 R N action"). Note that the 
\fIContext\fP and \fIModifiers\fP are taken at the beginning of the 
execution of the StrokeFunc command (so you can release the modifiers 
before the end of the stroke recording in the case of a mouse binding 
and with, say, a TitleBar context the mouse motion can go through an 
application window). The keys Escape and Delete allow to abort the command.

The StrokeFunc command has two options \fINotStayPressed\fP and 
\fIEchoSequence\fP. \fIEchoSequence\fP causes fvwm to Echo the recorded 
stroke sequence.

\fINotStayPressed\fP has effect only if StrokeFunc is used via a Mouse 
or a Key command. This option causes that we do not need to have the 
button or the key pressed during the mouse stroke, but we have to do a 
mouse click or press the Return or Space key to finish the mouse motion 
recording (these keys also work without the \fINotStayPressed\fP option).

You can use the StrokeFunc "alone". In this case it will work as above
with the \fINotStayPressed\fP option enabled. However, \fIModifiers\fP 
will probably do not work as expected (i.e., in this case use A or N as 
\fIModifiers\fP in Stroke bindings).

Note that some computers do not support key release events. If it is the
case the StrokeFunc used via a Key command will work as if the 
\fINotStayPressed\fP option is enabled (I hope).
-----------

I have do so that there is "backward compatibility". However, I think
that we can completely replace the current method to handle mouse stroke
with the one of the patch. Since 
i) It works better: Context and Modifiers works find with the StrokeFunc
(to do so that Modifiers works with the current version of the stroke patch
is a 5 characters patch, but I do not see how to do for that Context works
really).  
ii) It gives more possibilities to the users (and the "default" is the same as before). StrokeFunc via a Key command with a touch pad is a real pleasure ! 
iii) the "stroke patch" can be almost concentred in one builtin
function. E.g., if we suppress the "old" method we can suppress all
the stroke stuff of fvwm/events.c.
iv) It will be more easy to add features to the stroke patch.

So, this patch is an half patch. If there are no objection I will send
the second part which removes the old way to handle mouse stroke. 
The problems here is that we probably lost the "backward compatibility" 
from the config point of view.
However, I do not think it is a real problem since the Stroke command
appear only in the 2.3.x series.

So, any comments will be strongly appreciated.

Olivier

ChangeLog:

fvwm/builtins.{c,h} (strokeFunc): New builtin function StrokeFunc.
fvwm/cursor.{c,h}: New context CRS_STROKE (XC_plus)
fvwm/functions.{c,h}: New builtin function StrokeFunc.
fvwm/fvwm2.1: StrokeFunc doc. Update CursorStyle and Stroke entries.
libs/Bindings.c (CheckBinding): Check for the button in Stroke bindings.