Subject: Re: FVWM: Java and Alt-? Hot Keys

From: Dan Espen <[email-masked]>
Date: Wed, 01 Nov 2000 11:17:44 -0500

Paul Powell <[email-masked]> writes:
> Hello,
> 
> I am having problems under FVWM2 using Alt-? hot keys
> with Java GUI interfaces.  It doesn't work.  For
> example, I have a File menu where the user can hit
> Alt-F to bring up the File menu interface.  This works
> fine under Gnome / Enlightenment but fails under
> FVWM2.
> 
> I'm using IBM's JDK 1.1.8 and Swing 1.1.1.
> 
> I used the "xmodmap" command as suggested in the JDK
> README file and that did the trick under Enlightenment
> but under FVWM it failed.
> 
> Anyone have any experience using Java and FVWM that
> could help me out?

I can try.  I'm a bit of a Java novice though.

Using your sample program, I was unable to get ALT-F  to pull down the
file menu the same as you.  I ran Java traces, and the keys
are clearly getting to the Java app.

After reading some docs, I tried hitting F10 instead.  Sure enough,
F10 will make the file menu pull down.

What this seems to be related to is something Java calls "LookAndFeel".
The values for this seem to be: "Motif", "Windows", "Mac", "Metal"

In Fvwm's case, it seems to be using "Metal".  I think thats where
the F10 comes in.

I don't understand the LookAndFeel class docs well enough to know
if you can set the LookAndFeel yourself.  I don't know yet, how
Gnome/Enlightenment manage to convince Java to use a different
LookAndFeel either (if thats whats happening).

Perhaps someone on this list can correct me, or if I'm on the right
track, supply some more input.

--
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: Bob Woodside <[email-masked]>
Date: Sun, 05 Nov 2000 20:52:57 -0500

Dan Espen wrote:
> > with Java GUI interfaces....
> >
> > I used ..."xmodmap"...and that did the trick under
> > Enlightenment but under FVWM it failed.
> >
> ...
> if you can set the LookAndFeel yourself.

	Yes, you can. I've done that in the past to get around some quirks in
the Metal implementation. I was about to send a short code snippet
illustrating how, but see below.

> ...

	I thought Dan was on the right track, but I tried the program on my
system and both Alt-F and F10 bring up the File menu just fine...no
fiddling with xmodmap, nor with the Pluggable LookAndFeel. Dan, you may
well be on the right track, but I can't reproduce the problem.

	I'm running JDK 1.2 (the Blackdown Linux port, from sometime early this
year I believe) on a more-or-less Slackware 7.0 system. Unfortunately, I
don't have a pre-1.2 JDK lying around anywhere to experiment with
anymore. I do recall having some trouble with IBM's JDK on a SuSE 6.4
system back around June (I don't remember whether it was 1.1.8 or 1.1.7)
- not related to this problem, but several things didn't work right and
I had about 10 minutes to decide whether to scrap that project - no time
to research it; that was the last pre-1.2 system I've fiddled with.

	It's puzzling that this would work under Gnome/E - I believe Dan has
demonstrated that it's really not a WM issue (absent any key bindings in
your .fvwm2rc).

	Paul, do you use the other Gnome stuff when you run FVWM - is the only
difference the choice of window manager to start up? Or is there a bunch
of other Gnome startup stuff that isn't getting run with FVWM? And can
you verify which LookAndFeel is being used? And what flavor of OS are
you using?

	I seem to recall that you can set the default LAF (normally Metal) in
Java's config file, but I may be dreaming. Brad...are you out there?
Does that ring a bell with you? (Yes, I'm grasping at straws.)

Cheers,
Bob

---

From: Brad Giaccio <[email-masked]>
Date: Mon, 6 Nov 2000 08:35:18 -0500

> Does that ring a bell with you? (Yes, I'm grasping at straws.)

Yes I'm lurking about.  Somewhere either in your main if its a program
or in the init of the Applet do the following to change L&F

      try { 
        //UIManager.setLookAndFeel(
        //          UIManager.getSystemLookAndFeelClassName());
        // If you want the Cross Platform L&F instead, comment out
        //the above line and uncomment the following:
        UIManager.setLookAndFeel(
                  UIManager.getCrossPlatformLookAndFeelClassName()); 
      } catch (UnsupportedLookAndFeelException exc) {
        System.err.println("Warning: UnsupportedLookAndFeel: " + laf);
      } catch (Exception exc) { 
        System.err.println("Error loading " + laf + ": " + exc);
      }

After a brief walk through the java source I think I see the problem if
you run the attached code and type into the frame that comes up you will
see the key events printed out on stderr.  If you try something like alt
+ F.  You will notice the modifiers element is something like Meta+Alt

My guess is that the code that actually processes the events is looking
at a different KeyStroke object than you passed in.  So the real
question is what is E passing that fvwm isn't if it works under one and
not the other.

So if you wouldn't mind try this code out under both and examine the 
results.

-- 
--- There are two kinds of knowledge, you either know the answer or
			you know where to find it
		      -Kane, Johnson, and anonymous