Subject: FVWM: A patch and two bugs

From: "Andrew Morton" <[email-masked]>
Date: Wed, 12 May 1999 06:30:42 +0000

Hello.

I use FVWM2 and the KDE file manager.  As KFM is a single-click browser
I have configured FVWM2 to be single-clickable as well.  This works OK,
except you need a very steady hand to deiconify an icon with a single
click.

This is because the hard-wired three pixel thresholds in
function.c:IsClick() are too small.

The attached patch against fvwm-snap-19990511 makes this distance
configurable (default is still three).  The .fvwm2rc syntax is

MoveDistance 9

I hope I did the diff thing right...

BTW: which Makefile target cleans _everything_ into a diffable form???

Bug reports on fvwm-snap-19990511:

1: I get "Some command line modules have not quit, Starting up after
timeout.`" and a long hang at startup

2: When I run KFM, KFM's icons are _always_ on top of FVWM's windows.

System info:

Pretty stock RedHat 5.2/x86

pwold011:~> rpm -qf /opt/kde/bin/kfm
kdebase-1.1-3rh5x

Cheers,
Andrew.

diff -Naur fvwm-snap-19990511/fvwm/builtins.c fvwm.akpm/fvwm/builtins.c
--- fvwm-snap-19990511/fvwm/builtins.c	Thu May  6 21:30:18 1999
+++ fvwm.akpm/fvwm/builtins.c	Wed May 12 15:48:16 1999
@@ -993,6 +993,19 @@
   Scr.MoveResistance = val[1];
 }
 
+void SetMoveDistance(F_CMD_ARGS)
+{
+  int val[1];
+
+  if (GetIntegerArguments(action, NULL, val, 1) != 1)
+  {
+    fvwm_msg(ERR,"SetMoveDisistance","MoveDistance requires one argument");
+    return;
+  }
+
+  Scr.MoveDistance = val[0];
+}
+
 void SetColormapFocus(F_CMD_ARGS)
 {
   if (MatchToken(action,"FollowsFocus"))
diff -Naur fvwm-snap-19990511/fvwm/functions.c fvwm.akpm/fvwm/functions.c
--- fvwm-snap-19990511/fvwm/functions.c	Fri May  7 21:30:20 1999
+++ fvwm.akpm/fvwm/functions.c	Wed May 12 15:46:09 1999
@@ -167,6 +167,7 @@
   {"modulepath",   setModulePath,    F_MODULE_PATH,         0},
   {"mouse",        mouse_binding,    F_MOUSE,               0},
   {"move",         move_window,      F_MOVE,                FUNC_NEEDS_WINDOW},
+  {"movedistance",SetMoveDistance, F_MOVE_DIST,           0},
   {"movetodesk",   move_window_to_desk,F_MOVE_TO_DESK,      FUNC_NEEDS_WINDOW},
   {"movetopage",   move_window_to_page,F_MOVE_TO_PAGE,      FUNC_NEEDS_WINDOW},
   {"next",         NextFunc,         F_NEXT,                0},
@@ -382,16 +383,18 @@
 {
   int xcurrent,ycurrent,total = 0;
   Time t0;
+  int dist;
   extern Time lastTimestamp;
 
   xcurrent = x;
   ycurrent = y;
   t0 = lastTimestamp;
+  dist = Scr.MoveDistance;
 
   while(((total < Scr.ClickTime && lastTimestamp - t0 < Scr.ClickTime) ||
 	 !may_time_out) &&
-	x - xcurrent < 3 && x - xcurrent > -3 &&
-	y - ycurrent < 3 && y - ycurrent > -3)
+	x - xcurrent < dist && x - xcurrent > -dist &&
+	y - ycurrent < dist && y - ycurrent > -dist)
     {
       usleep(20000);
       total+=20;
diff -Naur fvwm-snap-19990511/fvwm/fvwm.c fvwm.akpm/fvwm/fvwm.c
--- fvwm-snap-19990511/fvwm/fvwm.c	Tue May 11 21:30:19 1999
+++ fvwm.akpm/fvwm/fvwm.c	Wed May 12 15:42:45 1999
@@ -1568,6 +1568,7 @@
 
   Scr.EdgeScrollX = Scr.EdgeScrollY = 100;
   Scr.ScrollResistance = Scr.MoveResistance = 0;
+  Scr.MoveDistance = 3;
   Scr.SnapAttraction = -1;
   Scr.SnapMode = 0;
   Scr.SnapGridX = 1;
diff -Naur fvwm-snap-19990511/fvwm/fvwm2.1 fvwm.akpm/fvwm/fvwm2.1
--- fvwm-snap-19990511/fvwm/fvwm2.1	Sat May  8 21:30:21 1999
+++ fvwm.akpm/fvwm/fvwm2.1	Wed May 12 16:05:57 1999
@@ -2300,6 +2300,14 @@
 See also the "AnimatedMove" command, above.

+.IP "MoveDistance \fIpixels"
+When the user presses a mouse button upon an object \fIfvwm2\fP
+waits to see if the action is a click or a drag.  If the mouse
+moves by more than \fIpixels\fP pixels it is assumed to be a drag.
+
+Previous versions of \fIfvwm2\fP hardwired \fIpixels\fP to 3, which
+is now the default value.
+
 .IP "MoveToDesk \fIarg1\fP [ \fIarg2\fP ] [ \fImin max\fP ]"
 Moves the selected window to another desktop (workspace, room).
 
diff -Naur fvwm-snap-19990511/fvwm/misc.h fvwm.akpm/fvwm/misc.h
--- fvwm-snap-19990511/fvwm/misc.h	Thu May  6 21:30:21 1999
+++ fvwm.akpm/fvwm/misc.h	Wed May 12 15:37:53 1999
@@ -151,6 +151,7 @@
 void copy_config(FILE **config_fd);
 void SetEdgeScroll(F_CMD_ARGS);
 void SetEdgeResistance(F_CMD_ARGS);
+void SetMoveDistance(F_CMD_ARGS);
 void CursorStyle(F_CMD_ARGS);
 void ButtonStyle(F_CMD_ARGS);
 #ifdef MULTISTYLE
diff -Naur fvwm-snap-19990511/fvwm/parse.h fvwm.akpm/fvwm/parse.h
--- fvwm-snap-19990511/fvwm/parse.h	Sun Apr 18 21:30:25 1999
+++ fvwm.akpm/fvwm/parse.h	Wed May 12 15:36:44 1999
@@ -122,6 +122,7 @@
   F_DESTROY,
   F_DELETE,
   F_MOVE,
+  F_MOVE_DIST,
   F_MOVE_TO_PAGE,
   F_ICONIFY,
   F_STICK,
diff -Naur fvwm-snap-19990511/fvwm/screen.h fvwm.akpm/fvwm/screen.h
--- fvwm-snap-19990511/fvwm/screen.h	Tue May 11 21:30:20 1999
+++ fvwm.akpm/fvwm/screen.h	Wed May 12 15:42:10 1999
@@ -327,6 +327,7 @@
   int ClickTime;               /*Max button-click delay for Function built-in*/
   int ScrollResistance;        /* resistance to scrolling in desktop */
   int MoveResistance;          /* res to moving windows over viewport edge */
+  int MoveDistance;            /* number of pixels of mouse motion to decide it's a move operation */
   int SnapAttraction;          /* attractiveness of window edges */
   int SnapMode;                /* mode of snap attraction */
   int SnapGridX;               /* snap grid X size */

---

From: Tim Phipps <[email-masked]>
Date: Wed, 12 May 1999 08:58:12 +0100

> timeout.`" and a long hang at startup
It's not a bug, it's a feature.  What's the command line you start fvwm
with?  If it has any modules on it other than FvwmM4 or FvwmCpp then you
should be getting a pause. Modules other than FvwmM4 and FvwmCpp should
be started in the .fvwm2rc file (preferably in the InitFunction so you
can re-read the file to pick up any changes without starting a second
copy of the modules). See question 4.3 in the FAQ that comes with the
snapshot.  If you aren't starting any modules with the fvwm command line
then it may be a bug.

Cheers,
Tim.
--
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: Dominik Vogt <[email-masked]>
Date: Wed, 12 May 1999 12:55:19 +0200

> configurable (default is still three).  The .fvwm2rc syntax is

Sounds like a good enhancement. I'll rename it to 'MoveThreshold' however.
And you forgot menus. The same value is used there. Don't care to send
the patch again, I know where the changes have to be done.

> BTW: which Makefile target cleans _everything_ into a diffable form???

There is none, I think. 'make distclean' may help, but it forces you to
run 'configure' and 'make' again.

Bye

Dominik ^_^

-- 
Dominik Vogt, Hewlett-Packard GmbH, Dept. BVS
Herrenberger Str.130, 71034 Boeblingen, Germany
phone: 07031/14-4596, fax: 07031/14-3883, [email-masked]
--
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: Dominik Vogt <[email-masked]>
Date: Wed, 12 May 1999 13:04:00 +0200

> the patch again, I know where the changes have to be done.

Oops, I wanted to ask you something in the first place (I'm just curious):
Why is three pixels not enough? I could imagine a number of reasons:

 - very sensitive mouse acceleration/speed
 - large screen resolution
 - shaky hand
 - you're using a trackball and keep the hand on the ball while pressing
   the button
 - ...

Bye

Dominik ^_^

---

From: "Andrew Morton" <[email-masked]>
Date: Fri, 14 May 1999 08:20:39 +0000

Hi, Tim.

Tim Phipps wrote:
> with?

I could have been misleading people.  I normally run fvwm2-2.2-1 and I
had that installed when I decided to have a quick hack at it.  I did a
'make' and a 'make install', but it's possible I picked up an old
module??

My modulepath is commented out, so it's not likely.

The only module I use is FvwmPager, and that's from $HOME/.fvwm2rc.  I
just 'exec fvwm2' from my .xinitrc.

It's probably a Heisenbug.  Best to let it go...

---

From: "Andrew Morton" <[email-masked]>
Date: Fri, 14 May 1999 08:26:47 +0000

>  - very sensitive mouse acceleration/speed

Yes

>  - large screen resolution

1800x1350

>  - shaky hand

I turn 40 this year :-)

>  - you're using a trackball and keep the hand on the ball while pressing

No.

I'm kinda scratching my head over it.  Has anyone spent any time
configuring fvwm to allow single-click deiconification?  I set ClickTime
to 75 for this.

I find that I often end up moving an icon rather than opening it. 
Stretching the move threshold distance like this seems to help.

The other problem, of course, is that with shaped icons it's easy to
click on a "hole" in the image.  I believe it'd be expensive to put a
transparent window around the icon boundary to avoid this.

Cheers,
Andrew.

---

From: Teemu Hirsimaki <[email-masked]>
Date: Fri, 14 May 1999 12:12:35 +0300 (EET DST)

Andrew Morton writes:

> configuring fvwm to allow single-click deiconification?

Sure, I have the following.

############################################################
Mouse 1 I A move-or-iconify

DestroyFunc move-or-iconify
AddToFunc move-or-iconify
+ "M" Move
+ "C" Iconify
############################################################

-- 
Teemu Hirsimäki
[email-masked]

---

From: Dominik Vogt <[email-masked]>
Date: Fri, 14 May 1999 11:46:44 +0200

> >  - large screen resolution

Wow, that explains everything.

> configuring fvwm to allow single-click deiconification?  I set ClickTime

fvwm doesn't work very well with double clicks, so I try to avoid them at all.
(The problem is that I need a hight ClickTime to get the double clicks right,
but then executing functions with a double click action take too long to execute).
Unfortunately I don't see a way around that.

> transparent window around the icon boundary to avoid this.

Well, as a last resort you can override the icon with your own.
Other window managers draw a background behind each icon. We have this as
an enhancement request already, but didn't find the time to do anything.
I could imagine this:

  Style * IconBackground <colour>

and

  Style * IconBackground pixmap foo.xpm

as the syntax.

The first would simply create a 3d background in the given colour (with
the setting from the DefaultBackground command as the default). We'll
get request for gradient backgrounds soon if we start this, so putting
this stuff in the library should be done first.

Bye

Dominik ^_^

---

From: Dan Espen <[email-masked]>
Date: Fri, 14 May 1999 07:58:27 -0400

> just 'exec fvwm2' from my .xinitrc.

Even when FvwmPager is started from the .fvwm2rc, it now has to be
started this way to avoid the delay:

AddToFunc InitFunction "I" Module FvwmPager ...

not

Module FvwmPager

--
Dan Espen
444 Hoes Lane  Room RRC 1C-214           E-mail: [email-masked]
Piscataway, NJ 08854                     Phone: (732) 699-5570
--
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: Dominik Vogt <[email-masked]>
Date: Sat, 15 May 1999 00:17:35 +0200

> function.c:IsClick() are too small.

I've applied the patch.

Bye

Dominik ^_^

--
Dominik Vogt, [email-masked]
Reply-To: [email-masked]
--
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: Tim Phipps <[email-masked]>
Date: Mon, 17 May 1999 17:07:28 +0100

> transparent window around the icon boundary to avoid this.

If you don't mind losing the ability to have shaped windows you could
compile fvwm with shapes disabled (./configure --disable-shape) to get
rid of the holes in pixmap-icons.

Cheers.
Tim.

---

From: Tim Phipps <[email-masked]>
Date: Mon, 17 May 1999 17:13:57 +0100

>   Style * IconBackground pixmap foo.xpm
Don't forget that since fvwm can now use non-default visuals that you
can't simply combine a client supplied icon pixmap with fvwm's graphics.
Fvwm will be using whatever visual the use asked for and the client
pixmap will use the default visual.

To draw anything with client supplied icon pixmaps you would have to
create a window with the fvwm visuals that fvwm could draw into and then
create a window with the default visuals that is a child of the previous
window to copy the icon pixmap into (and shape).

Cheers,
Tim.

---

From: Tim Phipps <[email-masked]>
Date: Mon, 17 May 1999 17:41:10 +0100

> > just 'exec fvwm2' from my .xinitrc.

You must have picked up something strange because version 2.2 doesn't
have this error message in it.  Version 2.3.0 was prone to pausing,
version 2.3.1 onwards is less likely to pause (you have to do `fvwm -cmd
FvwmButtons' to get a pause).

> AddToFunc InitFunction "I" Module FvwmPager ...
Not any more.  Version 2.3.1 onwards only waits for modules started from
the command line and ignores modules started from inside rc files. If
this isn't the case let me know because I think I fixed it.

Cheers,
Tim.

---

From: Dan Espen <[email-masked]>
Date: Tue, 18 May 1999 11:26:29 -0400

> this isn't the case let me know because I think I fixed it.

I'm letting you know...

it doesn't appear to be "fixed".

The only modules I invoke are FvwmBanner and FvwmAnimate.

If I invoke FvwmAnimate from a file read by my .fvwm2rc, as

Module FvwmAnimate

the banner and a recapture happen after about 60 seconds.

This is with 2.3.2 from a day or 2 ago.

---

From: Tim Phipps <[email-masked]>
Date: Wed, 19 May 1999 10:58:02 +0100

> This is with 2.3.2 from a day or 2 ago.

Oh poo! I thought it was all fixed. Shows how much testing I do.

I've committed a fix, it's in CVS now and in the snapshot
ftp://ftp.fvwm.org/pub/fvwm/devel/snapshots/fvwm-snap-19990518.tar.gz
but won't appear in a release until 2.3.4

What happens now is that the variable DoingCommandLine is set before
every command line arg is run and both Read and ReadPipe unset it.  Only
modules that are started when DoingCommandLine is set are waited for. 
Does this sound OK?

Cheers,
Tim.

---

From: Tim Phipps <[email-masked]>
Date: Wed, 19 May 1999 11:11:34 +0100

I'm having a bad morning

Tim Phipps wrote:

It's not here it's in

ftp://ftp.fvwm.org/pub/fvwm/devel/snapshots/fvwm-snap-19990519.tar.gz

Sorry

---

From: Dan Espen <[email-masked]>
Date: Wed, 19 May 1999 13:43:24 -0400

> ftp://ftp.fvwm.org/pub/fvwm/devel/snapshots/fvwm-snap-19990519.tar.gz

I  didn't use the  snapshots, but the  latest CVS fixes the problem of
delays with modules being started outside the InitFunction.