Subject: czech keyboard and fvwm

From: Jan Martinek <[email-masked]>
Date: Sun, 27 Jan 2002 17:09:31 +0100

Hello,

some time ago I tried to send a bugreport (incoming, #837) but
I claimed rather missleading and vague information.
Let me please try to define the problem once more, from scratch:

Fvwm does not respond to key bindings if this condition is met:
 Czech keyboard layout is selected AND no window has focus.

This is the contents of my /.fvwm2rc 
It contains only one line defining key for starting rxvt
(shift+ctrl+r).

#beginning of /.fvwm2rc
Key r           A      SC      Exec exec rxvt
#end of /.fvwm2rc

this is the contents of .xinitrc

#beginning of /.xinitrc
setxkbmap 'cz(us_cz_prog)'
exec fvwm2
#end of /.xinitrc

(in case of XFree86-4.1.0-3 there must be
setxkbmap 'cz'
instead)

How to reproduce the behaviour:

1) startx
2) Left Shift + Right Shift simultaneously
   this activates Czech keyboard layout
3) shift+ctrl+r simultaneously - this should exec rxvt, but is does not!

Other interesting behaviour:
1) startx
2) shift+ctrl+r - runs rxvt
3) Left Shift + Right Shift simultaneously
   this activates Czech keyboard layout
4) if some window has focus, shift+ctrl+r runs another rxvt
   but if no window has focus, nothing happens.

Operating system:
Redhat 7.x
X server: XFree86-4.0.3-5 or XFree86-4.1.0-3

As for Fvwm, I tried these versions:

fvwm2-2.2.5-4     ....... OK
fvwm2-2.2.4-9     ....... OK
fvwm-2.4.0        ....... bug
fvwm-2.4.3        ....... bug
fvwm-2.4.4        ....... bug

As you can see, this problem was NOT present in older version of fvwm.

--
Jan Martinek
--
Visit the official FVWM web page at <URL:http://www.fvwm.org/>.
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: Dominik Vogt <[email-masked]>
Date: Sun, 27 Jan 2002 17:39:20 +0100

> (in case of XFree86-4.1.0-3 there must be

When I use

  setxkbmap 'cz'

I get this error message:

  > Error:            Can't find file "cz" for symbols include
  >                   Exiting
  >                   Abandoning symbols file "default"

And when I use

the X server crashes with a floating point exception as soon as I
press any key.  How do I get that working?

> 3) shift+ctrl+r simultaneously - this should exec rxvt, but is does not!

Does the keycode of the r key change when you switch the layout?
Fvwm is not aware of nor does it handle this situation.

>    but if no window has focus, nothing happens.

Bye

Dominik ^_^  ^_^

 --
Dominik Vogt, [email-masked]
Reply-To: [email-masked]

---

From: Dominik Vogt <[email-masked]>
Date: Sun, 27 Jan 2002 18:44:02 +0100

On Sun, Jan 27, 2002 at 06:10:36PM +0100, Jan Martinek wrote:

Please always reply to our mailing list, no to me personally.

> I really have no idea why it crashes. It should work on plain Redhat
> installation. But I will try this also on other distributions.

SuSE 7.2 here.

> No, this is not the reason. "r" remains on its position even on czech layout.
> Fvwm ignores all key bindings. I tried many of them (F11, F12, Alt+Tab,
> Ctrl+Shift+arrows, ...)
> And, if some window has the focus, fvwm does what I want no matter what
> the keyboard layout is. Keycode does not change.
> Something must have been changed since version 2.2.4 that could influence
> this. Would it be possible to find something in patches?

With CVS access and a lot of patience - yes.  You'd have to
download the 2.3.x releases (35 releases) and see where it
appeared first, look at the ChangeLog entries and try to find the
guilty patch by downloading the CVS code from specific dates and
then run a diff between the two versions.

> > >    but if no window has focus, nothing happens.

That's really funny.  Obviously, the keyboard grabs are still
there, but they don't work on the root window.  If you issue the
fvwm command

  Recapture

after switching the layout, does it work then?  Does restarting
fvwm (without restarting the X server) help?

Please add these lines to the HandleKeyPress() function in
events.c, recompile and reinstall to see if fvwm gets the key
strokes at all:

  void HandleKeyPress(void)
  {
    ...
    /* Here's a real hack - some systems have two keys with the
     * same keysym and different keycodes. This converts all
     * the cases to one keycode. */
  fprintf(stderr, "key press: kc1 0x%x, mods 0x%x ", Event.xkey.keycode, Event.xkey.state);
    Event.xkey.keycode =
      XKeysymToKeycode(dpy,XKeycodeToKeysym(dpy,Event.xkey.keycode,0));
  
    /* Check if there is something bound to the key */
    action = CheckBinding(Scr.AllBindings, STROKE_ARG(0) Event.xkey.keycode,
			  Event.xkey.state, GetUnusedModifiers(), Context,
			  KEY_BINDING);
  fprintf(stderr, "kc2 0x%x, action '%s'\n", Event.xkey.keycode, (action)?action:"");
    ...
  }

The two lines with the fprintf's are new; this is the latest code
from CVS, but older Versions should look similar enough.

Bye

Dominik ^_^  ^_^

---

From: Jan Martinek <[email-masked]>
Date: Sun, 27 Jan 2002 18:10:36 +0100

---

From: Jan Martinek <[email-masked]>
Date: Mon, 28 Jan 2002 15:31:50 +0100

> > installation. But I will try this also on other distributions.

I tried the same on my friend's SuSE 7.3:

command
failed with this error:

Error loading new keyboard description

so I tried

setxkbmap 'cz'

and this worked OK. It activated the czech keyboard layout.
The difference is probably in X server version. SuSE 7.3 has
xf86-4.1.0-52

SuSE 7.2 seems to have something older (4.0.3 maybe?).

But on SuSE I found something that makes me to change the description
of the strange behaviour. It worked fine with the czech keyboard
but wrong with the US layout! So on SuSE it was like this:

fvwm ignores key bindings if the keyboard was toggled from czech to US
AND no window has the focus.

And another thing:

fvwm ignores key bindings if the numlock was toggled on
AND no window has the focus. No matter what the keyboard
layout was.

HEY! NOW I found something similar on my system:

fvwm ignores key bindings if the capslock was toggled on
AND no window has the focus. No matter what the keyboard
layout is.

I cannot check out the numlock on my system, because I remapped
numlock to something else.

> then run a diff between the two versions.

I tested several versions which I downloaded from CVS. The bug
appeared probably somewhere between versions fvwm-2.3.6 and
2.2.5. I could not localize it better, because I was unable
to compile versions older than 2.3.6. But I have two rpm's
(2.2.4 and 2.2.5) that work fine.

fvwm2-2.2.5-4.i386.rpm   OK
fvwm2-2.2.4-9.i386.rpm   OK
fvwm-2.3.29-1            BUG
fvwm-2.3.10              BUG
fvwm-2.3.6               BUG
fvwm-2.3.2               unable to compile
fvwm-2.3.5               unable to compile
fvwm-2.2.5 (from CVS)    unable to compile
fvwm-2.2.4 (from CVS)    unable to compile

I followed these instructions:

autoreconf
automake --add-missing
./configure
make
make install

On versions that I was unable to compile I got this error:

> there, but they don't work on the root window.  If you issue the

I will do it later, as soon as I figure out how to do it.

> from CVS, but older Versions should look similar enough.

Please have patience with me, I must ask someone more experienced to help
me with that.

---

From: Dominik Vogt <[email-masked]>
Date: Mon, 28 Jan 2002 17:04:35 +0100

> I will do it later, as soon as I figure out how to do it.

Just start the FvwmConsole module (e.g. from a menu) and type the
command directly into its window.

> Please have patience with me, I must ask someone more experienced to help

No problem.  If cou can tell me the exact version number you're
using right now I can make you a patch that can be easily
applied without knowing anything about C programming.

Bye

Dominik ^_^  ^_^

-- 
Dominik Vogt, email: [email-masked]
LifeBits Aktiengesellschaft, Albrechtstr. 9, D-72072 Tuebingen
fon: ++49 (0) 7071/7965-0, fax: ++49 (0) 7071/7965-20
--
Visit the official FVWM web page at <URL:http://www.fvwm.org/>.
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: Dominik Vogt <[email-masked]>
Date: Mon, 28 Jan 2002 22:42:58 +0100

> numlock to something else.

Hm, that sounds like the old problem with modifiers an bindings.
Perhaps one of the modifiers is activated when you switch the
keyboard layout.  Then, many bindings stop working until the
modifier key is disabled (see question 0.1 in our FAQ, you'll
also find a solution there).

You can verify this with xev.  Run xev, then give it the focus
and hit return once.  YOu should get some output like this:

  KeyRelease event, serial 32, synthetic NO, window 0x2400001,
      root 0x57, subw 0x0, time 2936665917, (70,80), root:(820,102),
      state 0x0, keycode 36 (keysym 0xff0d, Return), same_screen YES,
  "   XLookupString gives 1 characters:  "

The only interesting thing is the value behind "state".  If any
modifiers were active when you released the return key, the value
will be some value not equal to 0x0 if its any value except 0x0 or
0x2 (Caps-Lock), this is the problem.

Bye

Dominik ^_^  ^_^