Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Mozilla Firefox and the middle mouse button Web Browsers
Ever since I started using external three-button mice, one thing has really annoyed me. For some reason, the middle mouse button does not work in Firefox. On every other platform that I've used Firefox on, the middle mouse button has been a very convenient way to open a link in a new tab or window. Needless to say, it quickly became one of those "minor kinks" that really gets to you after a while.

Since when using a single-button mouse, you can use Command-Click to open a link in a new tab or window, most people take the route of reprogramming their mice so a middle click is a Command-Click. However, if you actually use programs that use the middle button (i.e. X11), this horribly breaks things -- the middle button is normally simulated by Option-Click, and the right button is normally simulated by Command-Click.

My solution, unlike anyone else on any of dozens of web forums, was to actually look at the Firefox source code and figure out why this problem was happening. As it turns out, Firefox uses the old toolbox "Event Manager" API to handle mouse events. This API does not support multi-button mice by itself, and only handles the right button because MacOS sends a Control-Click when you press it.

The solution I came up with, while pretty much a kludge, was to stick in some code that caused Firefox to use the new Carbon Event Manager system to listen for the middle mouse button events, and dispatch them into the rest of Firefox accordingly. This was implemented as a special case, and all other mouse events were left unchanged. Here is my patched and recompiled version of Firefox 1.0.2 [6.4MB download]. I've included some notes and copies of the files I had to change, in case anyone wants to recompile it again with different options.

Ultimately, Firefox probably needs to totally re-plumb the event management portions of their code for OS X using the Carbon API. My solution here is just a quick and dirty fix.

[robg adds: I downloaded the file, but I haven't yet tested it...]
    •    
  • Currently 3.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (3 votes cast)
 
[31,993 views]  

Mozilla Firefox and the middle mouse button | 23 comments | Create New Account
Click here to return to the 'Mozilla Firefox and the middle mouse button' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Mozilla Firefox and the middle mouse button
Authored by: jasenko on Apr 05, '05 10:48:36AM

The problem is not in Firefox itself, but in the builds we use. I found that in some builds middle click is working and in some it's not. Maybe there is a switch in configure script or the support for this breaks every now and then.



[ Reply to This | # ]
Mozilla Firefox and the middle mouse button
Authored by: unforgivendown on Apr 05, '05 11:16:49AM

While this is a cool hack, and it is appreciated, it's worth noting that the middle mouse button now functions in the nightly builds, as of a month ago or so.



[ Reply to This | # ]
Mozilla Firefox and the middle mouse button
Authored by: octo on Apr 05, '05 01:32:54PM

Interesting. Following your comment, I decided to check the latest CVS code and change info. It appears that not too long ago, someone else got frustrated with this problem and made essentially the same source hack as I did. It works in an almost identical way, but is better integrated/coded, since the person who did it probably knows the relevant API and codebases (while this was my first look at them).

In any case, hopefully the next release of Firefox will have this official version of the kludge in it, and my kludge won't be needed past 1.0.2.



[ Reply to This | # ]
Mozilla Firefox and the middle mouse button
Authored by: stcanard on Apr 05, '05 03:35:26PM

This fix has been known and existed for a long time, but due to politics and a lack of contact points the authors were actually unable to get it included in the source tree. For over a year.

I read the bug a long time ago (can't remember what it is now). It was a really interesting insight into how things can get lost in a large project.

Looks like they finally put the change in!



[ Reply to This | # ]
Re: Mozilla Firefox and the middle mouse button
Authored by: RiotNrrrd on Apr 05, '05 11:29:51AM

Wouldn't it be easier to just get a mouse with per-application programmability?

My 5-button Microsoft Mouse (Intellimouse Explorer) comes with a Control Panel-esque System Preference (IntelliPoint) that lets me customize the mouse button mappings on a per-application basis. That lets me use the middle and right buttons as Copy/Paste for default apps, but when I'm using X11.app it does the "traditional" X11 things (end selection, paste).

(The Intellimouse Explorer has 2 side thumb buttons that are great for Web browsers - I map them to Forward and Back. I can't imagine how anyone could live without a 5-button mouse :-) )



[ Reply to This | # ]
what?
Authored by: Xeo on Apr 05, '05 01:43:40PM

Sorry, but arguing that everyone should go out and buy a new mouse rather than getting the software to work the way it should is just silly.



[ Reply to This | # ]
what?
Authored by: betaInverse on Apr 05, '05 05:26:58PM

I think the point is more that if you're going to buy a new mouse anyway, you might want to pay more attention to the software that comes with it. Kensington MouseWorks has a similar feature, and I've been enjoying it immensely for all kinds of things in lots of applications.



[ Reply to This | # ]
what?
Authored by: sfgecko on Apr 05, '05 10:48:14PM

Logitech also has it's own system preferences control panel where you can specify what the middle wheel click should do (e.g. have it command+click). IMHO this is not the responsibility of firefox developers. They have more important things to work on, like improving the rendering speed of the browser.



[ Reply to This | # ]
what?
Authored by: octo on Apr 06, '05 08:24:44AM

Need I say it again? It is the responsibility of Firefox developers to properly support the user interfaces of the platforms they support. Another common misconception about the open source community is that there is some magical "pool of developers" that needs to concentrate their efforts more on this or that. In reality, different individuals take ownership or maintenence responsibility of different pieces of projects. In fact, as stated elsewhere in this thread, the problem was fixed. But the fix has yet to make it beyond CVS to an actual release and is probably lost in the noise. We may not actually see it in a release version until Firefox 1.1.



[ Reply to This | # ]
Mozilla Firefox and the middle mouse button
Authored by: rexroof on Apr 05, '05 12:17:00PM

one thing I can't stand about the nightly builds of firefox is that if you've got a text selection, as in, the Location bar, and you hit the right or left arrows, the cursor stays on the far right of the selection.

as opposed to earlier firefox builds or any other mac application, left arrow puts you at the left of the selection and right arrow puts you on the right of the selection.



[ Reply to This | # ]
Mozilla Firefox and the middle mouse button
Authored by: JimMueller on Apr 06, '05 10:17:44PM

I have never had the arrow keys work correctly in text fields in any build of Phoenix/FireBird/FireFox from the first one I tried - 0.8 if I recall. This does not stop me from using it as my primary browser.



[ Reply to This | # ]
Mozilla Firefox and the middle mouse button
Authored by: scotty321 on Apr 05, '05 12:41:11PM

What is this guy talking about? My middle mouse button works just fine in Mozilla Firefox! Plus, it's not Firefox's problem to worry about how someone wants to configure their middle mouse button. Simply download the outstanding shareware program USB Overdrive, and assign all of your mouse buttons to do whatever you want in whatever programs you want! Problem solved in less than a minute! I've been using USB Overdrive for about 7 years now, back in the Mac OS 9 days and now in the Mac OS X days! Simply download USB Overdrive and be through with it!! The website is www.usboverdrive.com. Done. Problem fixed.



[ Reply to This | # ]
Mozilla Firefox and the middle mouse button
Authored by: octo on Apr 05, '05 12:59:48PM

Yes, it is Firefox's problem. Using a program like USB Overdrive is just cheating your way around a deficiency in the software. Firefox should support all 3 mouse buttons on OSX just like it does on every other platform. By leaning on hacks like USB Overdrive, you cause the real problem (missing code from the software) to be neglected for a lot time and never fixed. Then it gets really annoying when one finds themselves in a situation where those add-on hacks don't work.



[ Reply to This | # ]
Mozilla Firefox and the middle mouse button
Authored by: Xeo on Apr 05, '05 01:45:25PM

Exactly, well said.



[ Reply to This | # ]
Mozilla Firefox and the middle mouse button
Authored by: TheSpoonman on Apr 05, '05 03:56:23PM

It is a problem with Firefox, as they're using old APIs and thus not taking full advantage of the new system. Regardless of that, why should I have to pay $20 for a piece of software to fix a deficiency in a piece of FREE software?

But, since I did try USB Overdrive, I'll give my opinion: it didn't work for me. Yes, it enabled middle-clicking a link to open in a new tab, but for some reason, middle-clicking a tab did not close it. So, I can open new tabs like I can on every other OS, but I can't close them. To close them I have to double-click. Yeah, it's not a real hassle until I'm trying to work on one of my other machines and that doesn't work. Then, I get frustrated at my poor little Mac which is 25 miles away at home.

In the end, I just bought a really cheap Logitech USB mouse at Staples. I have the same middle-click on tab issue I did with USB Overdrive, but at least I got a new mouse and it was $10 cheaper.

The main problem with your logic is it prolongs the real fix. This problem has existed in Firefox for well over a year. Since the F/OSS community claims they're faster at fixing bugs than proprietary vendors, this is an unacceptable situation. And, let's keep in mind, this isn't a minor bug like IE's inability to view transparent PNGs, this one is a showstopper on the Mac. Until I buckled down and bought the mouse, I came within inches of saying "screw it" and using Opera on all my machines.

I'm glad to see from other posters though that the Mozilla tem finally got off their high horses and allowed a "klugey fix" that fixes the problem rather than whining that they don't want to do that and will eventually get to it.

---
Answering the age-old question: which is more painful, going to work or gouging your eye out with a spoon?
www.workorspoon.com



[ Reply to This | # ]
Crashes on my TiBook
Authored by: ars on Apr 05, '05 12:47:07PM

When installed the patched version Firefox crashes immediately on launching. Looking at the console I found the following line:
dyld: /Applications/Firefox.app/Contents/MacOS/firefox-bin can't open library: @executable_path/libmozjs.dylib (No such file or directory, errno = 2)

Well I'll have to redownload the original Firefox I guess. The missing middle button was a major annoyance to me too and I also use X11 so that the solution seemed to be exactly what I needed.
Too bad. Hopefully the original poster can fix this.



[ Reply to This | # ]
Crashes on my TiBook (fixed)
Authored by: octo on Apr 05, '05 01:12:57PM

Thanks for pointing out the problem. Apparently, the libraries in the app bundle I sent out were actually just symlinks to them in my build directories. Thus, it worked fine for me and no one else :-)

I've since fixed the app bundle, made a new zip file, and uploaded it. So download again with the link in the article posting, and it should work fine.

FYI, the download size has grown to 8.6M as a result of this fix.



[ Reply to This | # ]
Mozilla Firefox and the middle mouse button
Authored by: vandil on Apr 05, '05 03:38:06PM

Indeed, the latest nightly build seems to support the middle mouse button. Thank goodness. I was getting tired of Safari's slowness or beachballing when one tab is loading and refusing to let you browse another, already-loaded tab, until the current one finishes.

Mozilla needs to put the middle-wheel fix in the next main release. Running a background "mapping" process to get the middle-button functionality is unreasonable.

The more TSRs & processes you have going, the less available memory to other programs.



[ Reply to This | # ]
Mozilla Firefox and the middle mouse button
Authored by: BohrMe on Apr 05, '05 11:12:56PM

I've been using the nightly build with middle-button support for a week or two and to be honest, I still don't like Firefox. I can't put my finger on it but there's just something not right about it on the Mac and Windows platform.

I much, much prefer Camino over Firefox. I like the way it renders pages and it's sometimes faster. But for general page browsing Safari is still my favorite.



[ Reply to This | # ]
Mozilla Firefox and the middle mouse button
Authored by: jhirbour on Apr 06, '05 07:48:32AM

I recently bought a microsoft optical mouse (USB) and had a fine working middle button (clicking the wheel) and right click buttons. (running os 10.3.8)

After I loaded the driver that came with the mouse... now I don't have a working middle clickable button it instead works as an ALT click. There seems to be a crap load of options in the preference panel it added... but I think it would be easier to just uninstall the driver LOL

Bottom line I think my case has more do with mouse driver and the OS than with particular applications... :-(



[ Reply to This | # ]
Mozilla Firefox and the middle mouse button
Authored by: octo on Apr 06, '05 08:27:37AM

Regardless, the Firefox issue most definitely had to do with the application code itself. Thankfully this problem was finally fixed in CVS, and we should see it go away in the future. Still kinda interesting though, that I took a stab at it myself without even realizing the CVS fix existed, and even took the same approach. (of course the only other approach would require a lot more development effort than one could be willing to put in for a quick fix)



[ Reply to This | # ]
Mozilla Firefox and the middle mouse button
Authored by: octo on Apr 06, '05 08:34:13AM

On Windows, Firefox has one kink that really annoys me. Windows seems VERY eager to swap the process out of RAM, and as such you always have an annoying thrashing lag when you havn't been using the browser for a while.

On MacOS, I can see where you're coming from as to odd kinks. When I originally got my PowerBook, I tried Safari. It worked well, but its total and utter lack of configurability was starting to drive me nuts. Firefox was a natrual choice, as since 1.0PR it had become my de facto browser of choice on all the other OSes I use.

Lately I've begun trying Camino myself. One feature of it that I really like is its password remembering kinks. One site I have to frequent is designed to change its name in the password dialog so you can't have your browser remember the password. Well, Camino is the only browser not fooled by this, making my life a lot easier :)
Then again, it to has some minor kinks that bother me. Right now, they are mainly 2 things. First, I like my tab-bar to be left-justified and not centered. Second, it seems to like displaying "Loading..." in window tabs even after the page is loaded, if something didn't happen just perfectly. In the end, though, I think the main reason I keep going back to Firefox is that its what I use everywhere else. Of course with the next few releases of Camino, that could easily change.



[ Reply to This | # ]
Mozilla Firefox and the middle mouse button
Authored by: qwerty denzel on Apr 07, '05 02:21:06AM

Middle button (scroll) clicking seems to work in Safari, which I didn't know. It can also be used for clicking the title bar of the window, bringing up the menu of directories for the site (like what command clicking does).
It works on links too, of course.
Also scroll clicking in the part of the scroll bar that doesn't have the scroller in it works, as does clicking on the scroll arrows (which seems to be useless as you cannot hold down on it, it only performs one click).
None of this works in the Finder, and it doesn't work on the Safari menu bar, suggesting that it's not mapping a command click (Also it does nothing with the menu extras).
Disabling all internet plugins doesn't affect it.

Since when could Safari do this?



[ Reply to This | # ]