Last Comment Bug 66519 - Supporting Internet keys in XFree86 4
: Supporting Internet keys in XFree86 4
Product: Core
Classification: Components
Component: Keyboard: Navigation (show other bugs)
: Trunk
: x86 Linux
: -- enhancement with 11 votes (vote)
: mozilla1.9beta4
Assigned To: Michael Ventnor
: Andrew Overholt [:overholt]
: 84868 87238 307034 344089 (view as bug list)
Depends on: 13168
Blocks: atfmeta
  Show dependency treegraph
Reported: 2001-01-25 04:38 PST by Martin Norbäck
Modified: 2010-09-18 07:11 PDT (History)
23 users (show)
See Also:
Crash Signature:
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---

Patch (2.36 KB, patch)
2008-02-01 21:30 PST, Michael Ventnor
no flags Details | Diff | Splinter Review
Patch 2 (4.33 KB, patch)
2008-02-02 08:51 PST, Michael Ventnor
roc: review+
roc: superreview+
mtschrep: approval1.9+
Details | Diff | Splinter Review
Possible new patch (8.47 KB, patch)
2008-02-04 18:37 PST, Michael Ventnor
no flags Details | Diff | Splinter Review

Description Martin Norbäck 2001-01-25 04:38:10 PST
I have a Microsoft Natural Keyboard Pro, which has "internet keys".
They are Back, Forward, Stop, Refresh, Search, Favorites, and Web/Home.
The all correspond nicely to commands in Mozilla.

When using XFree86 4, these keys generate keysyms
XF86Back, XF86Forward, XF86Stop, XF86Refresh, XF86Search, XF86Favorites, and

I imagine it would be a simple task to capture these keysyms.
Comment 1 David Hallowell 2001-01-25 06:47:31 PST
Erm Mozilla doesn't have a refresh or favourites function :)
(please don't dignify that with an answer because I do know what the equiv
functions are - I'm just in one of those weird moods!)

Seriously I didn't know that XF86 v4 supported this but saying that you say it
does then I think it should be supported, although you could say first things
first they don't even work on Windows yet :)

See my Windows bug 64371

I'll confirm this and leave it separate to the Windows bug as it probably
requires different work to be performed.

I'm marking as an enhancement as this isn't really a bug it's a feature request.
Comment 2 Alec Flett 2001-01-25 08:18:05 PST
a cool idea. CC'ing blizzard for help on capturing platform-specific keys. we
could translate these into mozilla-specific "VK_BROWSER_BACK" and so forth so
that other platforms might eventually benefit.
Comment 3 timeless 2001-06-21 21:35:23 PDT
*** Bug 87238 has been marked as a duplicate of this bug. ***
Comment 4 Paul Chen 2001-08-01 14:38:04 PDT
nav triage team:

Would be a very cool feature, but not a mozilla1.0 stopper. Marking mozilla1.1
Comment 5 Alec Flett 2002-04-18 22:26:02 PDT
over to new keyboard owner
Comment 6 Akkana Peck 2002-06-25 13:42:10 PDT
This is mine.  I could use some help, though, in finding out what gtk sends for
those keys (not having one of these keyboards).
Comment 7 Martin Norbäck 2002-06-25 15:24:07 PDT
Just made a small gtk test program, and the results match the #defines in
XFree86keysym.h (not very surprising...) :)

There are more defined there than what's on my keyboard, so you could be ahead
of your time and implement all that fits...

It seems a bit stupid to paste the whole file here, so here is a link to the cvs

It seems there are no corresponding defines in gdk, perhaps a feature request
could be made there.
Comment 8 Akkana Peck 2002-06-25 17:54:28 PDT
Thanks for the list!  I'll look into it.  I'll also see if I can get my hands on
one of these keyboards, to test on.

First, though, we need a decision about what to do about missing keys and
whether the DOM event model will ever give us symbols for them (either bug 62067
or bug 13168, whichever is solved first).
Comment 9 Akkana Peck 2002-08-08 16:26:35 PDT
Bumping out until we get a decision about what to do about bug 13168.
Comment 10 Vladimir Ermakov 2002-12-06 17:00:24 PST
*** Bug 84868 has been marked as a duplicate of this bug. ***
Comment 11 Andrew Hagen 2003-02-18 14:12:47 PST
Is this still broken on current builds?
Comment 12 Kevin Brosnan 2005-09-04 08:34:19 PDT
*** Bug 307034 has been marked as a duplicate of this bug. ***
Comment 13 Michael Stather 2005-09-16 07:39:12 PDT
This has now been requested for years. Is it so difficult to implement or why
isn´t this done? It would be a great usability enhancement for many users!
Comment 14 Ryan Flint [:rflint] (ping via IRC for reviews) 2006-07-10 02:52:54 PDT
*** Bug 344089 has been marked as a duplicate of this bug. ***
Comment 15 bugs1m.wisefool 2007-06-04 15:42:19 PDT
I've seen that the current workaround suggested by ThinkWiki is to assign the symbols "F19" and "F20" for XF86Back/Forward. This seems incredibly weird. Is it hardcoded somewhere to only accept function keys' keysyms?
Comment 16 dukat 2007-07-18 19:57:31 PDT
What a pity this still doesn't work. Such a basic feature, so little work ...
Comment 17 Sébastien Mazy 2007-10-31 07:41:29 PDT
There is a page on thinkwiki related to this problem :

You don't need to map your special keys to F19/F20. For example, you can add the following in chrome/browser.jar/content/browser/browser.xul under section <keyset id="mainKeyset"> :

<key id="goBackKb"  keycode="XF86Back" command="Browser:Back"/>
<key id="goForwardKb"  keycode="XF86Forward" command="Browser:Forward"/>

It works for me and the old shortcuts are still there (backspace, ctrl-left).

Could firefox handle those shortcuts ? A user shouldn't have to mess with xul files.
Comment 18 Sébastien Mazy 2007-10-31 12:07:38 PDT
I spoke too soon. Actually that hack leads to an erratic behaviour of XF86Back and XF86Forward keys (XF86Back still changes the page even when there is no previous page, XF86Forward does change the page but not always for the next page and ALT-GR also changes the page ??).

Under Firefox for Windows, those keys work. Maybe we'll see this bug closed before Firefox 6.0...
Comment 19 Ani 2007-11-29 19:56:45 PST
According to
"XF86Forward and XF86Back do not work correctly in Firefox. You may want to map them to F19 and F20 instead if you use Firefox."
I also added
<key id="goBackKb"  keycode="XF86Back" command="Browser:Back"/>
<key id="goForwardKb"  keycode="XF86Forward" command="Browser:Forward"/>
And at Firefox was also behaving rather strange.
Comment 20 Sébastien Mazy 2007-11-30 00:33:43 PST
Ani, the problem is that other brothers such as Epiphany or Konqueror manage to handle XF86Forward and XF86Back well. I don't want to unmap those keysyms to make Firefox behaves properly (I don't think it is possible to map one key to several keysyms with Xmodmap).
Comment 21 Michael Ventnor 2008-02-01 21:30:51 PST
Created attachment 300980 [details] [diff] [review]

This should work. The conspicuous lack of keyboards with internet keys around me (EVERYONE has a Macbook.... including me) has caused problems with testing but after Googling code I think the keybindings are right. I know the events are sent properly because I changed the switch statement to keys that I do have. This is the exact same thing we do on Windows.
Comment 22 Robert O'Callahan (:roc) (email my personal email if necessary) 2008-02-01 23:10:07 PST
+    nsCOMPtr<nsIAtom> command;

This could be just nsIAtom*.

Instead of structuring your code this way, you could create a helper method DispatchCommandEvent so each switch case would just be e.g. "return DispatchCommandEvent(nsWidgetAtoms::Back)". Then you don't need that ugly boolean.
Comment 23 Michael Ventnor 2008-02-02 08:51:01 PST
Created attachment 301028 [details] [diff] [review]
Patch 2
Comment 24 Robert O'Callahan (:roc) (email my personal email if necessary) 2008-02-02 12:20:17 PST
Comment on attachment 301028 [details] [diff] [review]
Patch 2

considerably nicer, thanks!
Comment 25 Michael Ventnor 2008-02-03 11:54:45 PST
Comment on attachment 301028 [details] [diff] [review]
Patch 2

This is a simple patch to significantly improve accessibility and platform parity.
Comment 26 Michael Ventnor 2008-02-04 18:36:12 PST
Comment on attachment 301028 [details] [diff] [review]
Patch 2

This patch doesn't seem to really work, as other apps must intercept X events to get to these keys.
Comment 27 Michael Ventnor 2008-02-04 18:37:25 PST
Created attachment 301434 [details] [diff] [review]
Possible new patch

Attaching this here so I can test it on a computer with internet keys.
Comment 28 Michael Ventnor 2008-02-04 19:38:46 PST
Comment on attachment 301434 [details] [diff] [review]
Possible new patch

Turns out that is what we want to do after all, its just that this kind of code is used for global listening of special keys (like media players) and properly mapped keyboards will send the event anyway.
Comment 29 Mike Schroepfer 2008-02-06 11:31:17 PST
Comment on attachment 301028 [details] [diff] [review]
Patch 2

Michael are you gunning for the oldest bug fixed award :-P?
Comment 30 Reed Loden [:reed] (use needinfo?) 2008-02-06 13:56:19 PST
Checking in widget/src/gtk2/nsWindow.cpp;
/cvsroot/mozilla/widget/src/gtk2/nsWindow.cpp,v  <--  nsWindow.cpp
new revision: 1.257; previous revision: 1.256
Checking in widget/src/gtk2/nsWindow.h;
/cvsroot/mozilla/widget/src/gtk2/nsWindow.h,v  <--  nsWindow.h
new revision: 1.84; previous revision: 1.83
Comment 31 Reed Loden [:reed] (use needinfo?) 2008-02-18 12:05:47 PST
*** Bug 418276 has been marked as a duplicate of this bug. ***

Note You need to log in before you can comment on or make changes to this bug.