unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Making Windows key meta
@ 2004-06-09 16:18 Alex Viskovatoff
  2004-06-10 13:00 ` Alex Viskovatoff
  0 siblings, 1 reply; 2+ messages in thread
From: Alex Viskovatoff @ 2004-06-09 16:18 UTC (permalink / raw)


Hi,

This issue has come up many times before on discussion groups, but the
specific problem I run into has not, as far as I am aware.

Because the laptop I use has a narrow space bar, it is inconvenient for me
to use the alt keys for meta, since the alt keys are awkwardly far away
from the control keys. I am running xorg-x11 6.7 (equivalent to XFree86
4.4) under Fedora Core 2 with Gnome 2.6, and that allows me to modify the
xkb options in my user settings. In the Gnome "Keyboard Preferences"
configuration, I select "Meta is mapped to the Win-keys", which makes the
options "altwin altwin:meta_win" sent to xkb. In an xterm, this makes the
Windows key act as meta. With this configuration, xev shows that pressing
the left Windows key yields "keycode 115 (keysym 0xffe7, Meta_L)", while
pressing the left alt key yields "keycode 64 (keysym 0xffe9, Alt_L)". This
is what I expect, and what I want.

In the previous version of Emacs I used, this configuration also made the
Windows key act as meta under Emacs. Now however, under this
configuration, pressing both the (left) Windows key or the alt key doesn't
do anything. (If I don't give the "altwin altwin:meta_win" option to xkb,
Emacs treats the alt key as meta.) Using "C-h k" shows what the problem
is. What it yields for "win-b" (pressing "b" while holding the Windows key
down) is "H-M-s-b is undefined". In other words, when one presses the
Windows key, in Emacs, not only the meta bit gets set, but also the hyper
and super bits.

On the other hand, if I don't give the "altwin altwin:meta_win" option to
xkb, pressing "b" with the Windows key down in Emacs makes "C-h k" yield
"H-S-b is undefined". Under this configuration, xev reports the Windows
key as "keycode 115 (keysym 0xffeb, Super_L)", while it continues to
report the left alt key as "keycode 64 (keysym 0xffe9, Alt_L)". Again, X
is behaving exactly as expected, since the default behavior for X is that
the Windows key is super.

So what Emacs does is the following. When the Windows key is mapped to
super (the default), Emacs treats it as "H-s". When the Windows key is
mapped to meta, emacs treats it as "H-M-s". So Emacs is aware of the
Windows key being remapped under X. But why, when the Windows key is
mapped to meta under X, does Emacs set the hyper and super bits, while not
just setting the meta bit, which would be the expected, "reasonable"
behavior?

A workaround would be to associate, for instance, the "backward-word"
command with the "H-M-s-b" keystroke, instead of "M-b". But that would be
highly kludgey, as well as breaking emacs when it is not run under X.

I thought that this strange behavior might be caused by one of Red Hat's
patches to Emacs, so I compiled the emacs 21.3 myself. The behavior is
exactly the same.

Does anyone know why Emacs behaves in this bizarre way? (As far as I can
tell, the entry "After upgrading to a newer version of Emacs, the Meta key
stops working" in the emacs "PROBLEMS" file does not lead one to expect
this behavior.) And does anyone know a reasonably easy way to make Emacs
behave in a straightforward way, that is, to interpret keyboard events
from X with the Windows key down as just having the meta bit set, as
opposed to having the hyper, meta, and super bits set?

Any clarification will be much appreciated.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Making Windows key meta
  2004-06-09 16:18 Making Windows key meta Alex Viskovatoff
@ 2004-06-10 13:00 ` Alex Viskovatoff
  0 siblings, 0 replies; 2+ messages in thread
From: Alex Viskovatoff @ 2004-06-10 13:00 UTC (permalink / raw)


On Wed, 09 Jun 2004 12:18:41 -0400, Alex Viskovatoff wrote:

> does anyone know a reasonably easy way to make Emacs
> behave in a straightforward way, that is, to interpret keyboard events
> from X with the Windows key down as just having the meta bit set, as
> opposed to having the hyper, meta, and super bits set?
> 
> Any clarification will be much appreciated.

I got a reply by email explaining what the problem was. It turns out that
xev was not giving a complete picture of what was happening. For the
record, here is the solution that was sent to me:

I had the same problem after installation of xorg-x11 6.7. In my
case it was due to mapping Meta keys as Mod4 in 
/<path_to_X11>/lib/X11/xkb/symbols/altwin:

  partial modifier_keys 
  xkb_symbols "meta_win" {
      key <LALT> {        [       Alt_L,  Alt_L           ]       };
      key <RALT> {        [       Alt_R,  Alt_R           ]       };
      key <LWIN> {        [       Meta_L                  ]       };
      key <RWIN> {        [       Meta_R                  ]       };
      modifier_map Mod1   { Alt_L, Alt_R };
      modifier_map Mod4 { <META>, Meta_L, Meta_R };
   };

If you don't need the Meta keys to act as Mod4, commenting out the
"modifier_map Mod4" line should help.  

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-06-10 13:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-06-09 16:18 Making Windows key meta Alex Viskovatoff
2004-06-10 13:00 ` Alex Viskovatoff

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).