weird inconsistent behavior with custom keylayout and command-shortcuts in firefox

58 views
Skip to first unread message

lanzz

unread,
Apr 16, 2010, 4:46:40 PM4/16/10
to Ukelele Users
I have a custom keyboard layout, which has latin keybindings when Caps
Lock is off, and cyrillic when Caps Lock is on. This setup works fine
everywhere, except in Firefox and other Mozilla-based apps
(Thunderbird, for example). There, shortcuts involving the Command key
do not work at all when Caps Lock is down - when I press the shortcut,
the menu item that contains the shortcut gets briefly highlighted (as
it should), but nothing happens.

I have examined the Unicode/USExtended.keylayout in the System
Keyboards folder distributed with Ukelele, and I can't figure out what
I'm doing wrong. The USExtended keylayout has lowercase latin letters
for all keys when Command is held, regardless of the state of Caps
Lock and Shift, and this is exactly how I have implemented my custom
keyboard layout too, but Firefox still does not handle the shortcuts
correctly.

I had a guess that Firefox is somehow ignoring the keyboard layout and
doing keyboard handling at some lower level and is getting thrown off
by Caps Lock being on in itself, but that's not so - with the standard
system keyboard layouts, Command-key shortcuts work in Firefox
regardless of the Caps Lock state.

I have uploaded the problematic layout in the group, it's called
Cyrlatin.keylayout. I'll appreciate any suggestions.


--
Subscription settings: http://groups.google.com/group/ukelele-users/subscribe?hl=en

lanzz

unread,
Apr 20, 2010, 4:35:16 AM4/20/10
to Ukelele Users
Hello? Anybody?

I would really appreciate any help with this.

John Brownie

unread,
Apr 21, 2010, 1:41:37 AM4/21/10
to ukelel...@googlegroups.com
I've done some looking at the Firefox source to see if I can work this
one out. I think that the culprit is some code which has the following
comment:

// characters generated with Cmd key
// XXX we should remove CapsLock state, which changes characters from
// Latin to Cyrillic with Russian layout on 10.4 only when Cmd key
// is pressed.

It would appear to be a hack to handle an Apple keyboard layout, and
your keyboard layout unfortunately reverses this behaviour, causing
Firefox to look at the Cyrillic.

Other than getting Firefox fixed, maybe you have to make the command key
combinations Latin rather than Cyrillic.

Does that help you to solve it?

John
--
John Brownie, john_b...@sil.org or j.br...@sil.org.pg
Summer Institute of Linguistics | Mussau-Emira language, Mussau Is.
Ukarumpa, Eastern Highlands Province | New Ireland Province
Papua New Guinea | Papua New Guinea

lanzz

unread,
Apr 21, 2010, 7:17:52 AM4/21/10
to Ukelele Users
> Other than getting Firefox fixed, maybe you have to make the command key
> combinations Latin rather than Cyrillic.
>
> Does that help you to solve it?

Not really. The thing is, the command-key combinations in my layout
already are Latin, not Cyrillic. When I view the Keyboard Viewer,
there is absolutely no difference in the Caps Lock + Command state
between my layout and U.S. Extended, for example; and yet, shortcuts
work in Firefox with U.S. Extended, and do not work with my layout.

Geke

unread,
Apr 21, 2010, 10:57:05 AM4/21/10
to Ukelele Users
The Apple layout for Russian already outputs lower-case Latin
characters when the Cmd key is pressed, whether CapsLock is down or
not. This works the same in my Firefox (version 3.6.3 in OS 10.4.11)
as in other apps. So I'm asking myself why they put in this hack at
all???

In Lanzz' situation, for sure, it doesn't do what it's meant for:
probably it cancels the CapsLock modifier and from your description,
it seems to send a keyboard event, but in effect that event doesn't
arrive where it should.

Maybe you can try if this works: make the layout for the Unicode
script (instead of Cyrillic), thereby preventing Firefox from using
that hack. Just a guess...

Anyway, thank God for OpenSource, so such stuff can be tracked down at
all!

Geke

John Brownie

unread,
Apr 21, 2010, 6:40:47 PM4/21/10
to ukelel...@googlegroups.com
On Wed Apr 21 2010 21:17:52 GMT+1000 (PGT) lanzz wrote:

> Not really. The thing is, the command-key combinations in my layout
> already are Latin, not Cyrillic. When I view the Keyboard Viewer,
> there is absolutely no difference in the Caps Lock + Command state
> between my layout and U.S. Extended, for example; and yet, shortcuts
> work in Firefox with U.S. Extended, and do not work with my layout.

Digging further, there is a lot of trickery going on in the Firefox
code. What happens is that, further down, there is code which has this
comment:

// If we can make a good guess at the characters that the user would
// expect this key combination to produce (with and without Shift) then
// use those characters. This also corrects for CapsLock, which was
// ignored above.

This code then "corrects" the key equivalent to be the key without
command, but with caps lock, which gives the wrong result with your
keyboard layout. So I conclude that it is a Firefox problem. The only
way in their code to avoid this is to make the key with command only
different to the key alone, which is not what you want.

Given these facts, you may just have to live without key equivalents
working in Firefox with the caps lock key down. I don't see any other
simple solutions, I'm afraid.

John
--
John Brownie, john_b...@sil.org or j.br...@sil.org.pg
Summer Institute of Linguistics | Mussau-Emira language, Mussau Is.
Ukarumpa, Eastern Highlands Province | New Ireland Province
Papua New Guinea | Papua New Guinea


Reply all
Reply to author
Forward
0 new messages