Subject: Animated Menus, Animated Moves, Improved Menus, and More!

From: Greg Badros <[email-masked]>
Date: 21 Apr 1997 17:21:58 -0700

I spent the weekend rewriting the menu code for fvwm-2.0.45 to better
support the keyboard (improving on my earlier patch).  In the process I
added several other useful features.  The description of the patch
appears below.  The actual patch is available at:
<A HREF="
http://www.cs.washington.edu/homes/gjb/patches/fvwm-2.0.45-menus-animation-gjb.patch
"> patch </A>

To apply the patch, do something like

cd fvwm-2.0.45
patch -p1 <fvwm-2.0.45-menus-animation-gjb.patch

Look for *.rej files, then rebuild.  The description and patch are also
available on my web page under "Newer stuff."  I tested the changes and
applying the patch on a slackware-like Linux 2.0.29. The patch should
apply cleanly to an unmodified 2.0.45 tree.

Please cc: comments to me.  I read the fvwm-workers list regularly, but
I don't subscribe to the fvwm list currently.

Greg J. Badros
[email-masked]
Seattle, WA  USA
http://www.cs.washington.edu/homes/gjb

DESCRIPTION:
------------
This patch includes lots:

Added new commands:

  AnimatedMove -- works like move

  SetAnimation -- customizes how the animated moves (and menu movement) looks

  SetMenuDelay -- change how long to delay before popping up a submenu
                  when resting on a menu item (ala the famous win OS's menus)

  SetEnv       -- Allow setting of environment which processes started
                  by fvwm2 will inherit.  This uses "putenv" system call.

Changed commands:

  Move   -- added greater flexibility so you can give destination
positions as stuff like "w+5p" to mean current window position + 5
pixels or "-2" to mean its right edge should be 2% of the screen height
> from the bottom [works for horizonal, too, of course].  See new man page

  MenuStyle -- added "animated" qualifier, along with type "win" to
               emulate more closely the famous win OS's menus look and feel

  AddToMenu --  Menus titles take side-pixmaps between "@" (at) characters and
		side-pixmap background colors between "^" (caret) characters.  Also,
		substrings denoting regular pixmaps (between "%" characters) are removed
		even if that pixmap cannot be located; thus your menu still looks ok.  A
		warning is printed to stderr, instead.

Almost complete rewrite of menus code:
--------------------------------------
These new menus support the keyboard much better than before.  See the
improved man page.  They also can animate out of your way when at the
right edge of the screen.  Use animated menustyle and try it-- it's
easier to watch than explain.  Also now supported is a delay before
popping up child menus when you rest on a menu item.

Note that the animation and the menu delay require the "usleep"
(micro-second sleep) system call.  If you don't have it, "select" can
probably be contorted to do the right thing.  See the man page for
"select" for your OS.

Internal Changes
----------------
I reindent some places where the indentation was not uniform and
confusing.  I also changed a lot of #define-s to enum-s. Menu code is
*way* better now (though certainly could get even better-- in
particular, I didn't do anything specific to facilitate sticky menus).

Uses gperf to build "fvwm-command-hasher.c" which gets included by
functions.c.  Reworked functions.c to use a hash lookup on a built-in's
name instead of linear lookup.  Reduced my startup time by 15% or so.
You may need to give -DNO_GPERF if you have problems with this.

BUGS?
-----
Sure, there's gotta be plenty.  Email me at [email-masked] and let
me know.  In particular, send me a minimal startup file and descriptions
of what to do to see the problem.  Also send me your configure.h, I
suppose and tell me what platform you're working on.

USE AT YOUR OWN RISK!  I am not responsible for the use of, the misuse
of, or anything to do with this patch.
--
Visit the official FVWM web page at <URL:http://www.hpc.uh.edu/fvwm/>.
To unsubscribe from the list, send "unsubscribe fvwm-workers" in the
body of a message to [email-masked].
To report problems, send mail to [email-masked].

---

From: Dan Espen <[email-masked]>
Date: Fri, 25 Apr 1997 09:22:43 -0400

> I don't subscribe to the fvwm list currently.

I tried this patch.

I used Solaris 2.4 on a Sun.

> http://www.cs.washington.edu/homes/gjb

Keyboarding worked great.  Animation was neat.

The default animation backup and  then move forward effect didn't seem
to add anything for me, but I was using a  slow machine (Sparc 1+).  I
didn't experiment with other animation values.

I was torn between the reverse imaging effect from the "win" menus and
the 3d appearance from  the "mwm" menus.   I'm  not sure how  it would
look  but too bad I couldn't  use both 3d  appearance and the stronger
feedback from reverse imaging the current selection.

By creating menu styles of "fvwm", "mwm"  and "win", we sort of create
packages  of effects.  If  you want "auto-popup", you  can get it with
mwm or win.  If you want 3d you can get it with fvwm or mwm.  It might
be nice to just specify the effects wanted.

I was  able to fool  the animation logic  that tries to put  the mouse
pointer back where it  started by moving  the pointer out of  the left
side of a menu.  I had to go out of  my way to do  this, and don't see
how anyone could be disturbed by this.

> probably be contorted to do the right thing.  See the man page for

I had linking problems with usleep.  I read that if I use Solaris 2.5,
usleep would have been  OK.  I changed  the code to  use select, and I
read that I could have used poll.  I guess that using usleep is OK.

> Internal Changes

I  think this is   a great package  of changes.   I  don't see why  it
shouldn't be incorporated into a future release.

--
Dan Espen                                    Phone: (908) 699-5570
[email-masked]
444 Hoes Lane  Room RRC 1C-214
Piscataway, NJ 08854
--
Visit the official FVWM web page at <URL:http://www.hpc.uh.edu/fvwm/>.
To unsubscribe from the list, send "unsubscribe fvwm-workers" in the
body of a message to [email-masked].
To report problems, send mail to [email-masked].

---

From: Greg Badros <[email-masked]>
Date: 25 Apr 1997 09:04:39 -0700

Glad you liked it.  Please let me know if you notice any bugs or
anomalies in the menuing code.  There are a few left, but I've not spent
time yet to figure out how to reproduce them reliably.

Also, can you send be a diff -c (or -u) of the changes you made to use
select?

I like your suggestion about making the menu features orthogonal and
just picking which ones you want.  Unfortunately, the drawing code isn't
implemented as cleanly as you'd like to support such elegance.
Definitely separating behaviour from physical appearance would be useful
and not too hard to do (I almost did it, but decided there was enough
else in my changes to warrant not touching more code).  It'd be nice to
be able to independently decide whether you want

A) FVWM-look menus
B) MWM-look menus (slightly deeper shadow)
C) Win-look menus (reversed background)
D) A fourth (currently non-existing) mix of Win + MWM, perhaps

and also how you want your popup behaviour

A) Delay?
B) Location of mouse pointer?
C) Animation vs. Left menus

[Currently A and C are independent. B is tied to FVWM vs. MWM/Win]

You didn't mention the spiffy side pixmaps (like fvwm95).

Also, did you notice any faster startup?  Another performance
possibility is to use Quarks (X's string hashing mechanism) for all the
lookups;  gperf is a static, compile-time deal.  With runtime hashing
the lookups for menu names, complex-function names, etc. could all be
done in constant time instead of linearly.  I've not profiled fvwm to
see if it's worth it, but for the built-in functions, gperf made a
difference for me.

Thanks,
Greg