Closed Bug 24117 Opened 25 years ago Closed 24 years ago

[gfx scrollbar] Middle mouse button click should position scrollbar

Categories

(Core :: XUL, enhancement, P5)

x86
Linux
enhancement

Tracking

()

RESOLVED FIXED
Future

People

(Reporter: rzach, Assigned: eric)

References

Details

(Keywords: helpwanted, Whiteboard: [feature])

Attachments

(7 files)

On X Windows, you expect the scroll bar grabber to jump to the mouse position
when you click the middle mouse button.  This works in NS 4.7.

To reproduce:
1. Go to a longish page
2. Middle-click in the scrollbar area beneath the grabber

Actual result: Nothing happens
Expected result: Grabber should jump to where you clicked, so that middle of
grabber is under the mouse pointer.

Linux 2000.01.15.08
Assignee: trudelle → evaughan
Severity: normal → enhancement
Priority: P3 → P5
Whiteboard: [feature]
Target Milestone: M20
I don't think this was ever made a requirement, which would make it an
unexpected feature for us.  assigning to evaughan as p5 for m20.  Setting
severity to enhancement, cc pavlov.
bug 24196 is the same, assigned to blizzard, you can fight over who gets it.
*** Bug 24196 has been marked as a duplicate of this bug. ***
Now (20000210) when i middle click on gfx-scrollbar, it pastes clipbord
to browser. Should only do this on content area.

Would be nice to have same function than in NS 4.x. This works ok with native
(gtk) scrollbars.
Middle-clicking works with both Motif and GTK scrollbars. Even xterms do
something with middle-clicks. Mozilla certainly should be compatible with
(almost) all the other Unix GUI apps.
*IGNORE* - more massive spam, changing open XPToolkit bug's QA contact to
jrgm@netscape.com

QA Contact: paulmac → jrgm
*IGNORE* - massive spam changing open XPToolkit bug's QA contact to
jrgm@netscape.com
Mass move of all M20 bugs to M30.
Note: this would be a good project for someone who wants to see this behavior. 
It could probably be done nearly all in XBL (I hope!).  Adding a helpwanted
keyword (hope that's okay, Peter).
Keywords: helpwanted
Mass move of M20 bugs to M30
Target Milestone: M20 → M30
In the future yes. But at the moment much of scrollbar behavior is still in C++ 
as XBL matures we are moving more and more out. We eventually want most of the 
widget to be entirely written in XBL and javascript. When that happens this will 
indeed be an easy thing to do. But I don't think its quite ripe yet.
Status: NEW → ASSIGNED
I've been unsuccessfully trying to figure out how the middle-button event gets
handled by the view instead of the scrollbar, and if anyone could give me some
pointers on where to look, I'd really appreciate it. As far as I can tell,
mozilla/layout/html/base/src/nsGfxScrollFrame.cpp is where the GFX scrollbars
should be created (the GFX ones only are exhibiting this behaviour -- turning
off the "gfx scrollbars" option in Debug preferences, thus using GTK ones, works
fine). But for the life of me, I couldn't track where they get registered for
events and where their event handlers should be. 
Mass-moving all M20-M30 XPToolkit bugs to Future
Target Milestone: M30 → Future
These two patches (submitted separately as attachments) seem to fix the problem
for me. The one to layout/xul/base/src/nsSliderFrame.cpp moves the scrollbar
thumb to the location of the middle-click, while the the other, to
xpfe/browser/resources/content/navigator.js, checks whether a middle-click was
in a scrollbar before attempting to paste.
Patches were great. But you cant drag after middle click, so hacked
a little more to make it more like 4.x. Also put #ifdef XP_UNIX around
changes. Patch attached.
I found a case that's still problematic: trying to middle-click in a scrollbar
on a text field that's become long enough for a scrollbar to be added. (Such as
a Bugzilla report, for example. :-) What happens is that the thumb gets
positioned properly, but the paste is also executed. I haven't yet figured out
where, but it's not from xpfe/browser/resources/content/navigator.js -- I
checked, and the browserHandleMiddleClick function from there doesn't seem to
even get called.
I think that textfield problem is more general bug with textfield; if you click
on textfield scrollbar's up/down/left/right arrow, you loose your selection,
or selection is changed. This doesnt happen on other scrollbars, just on
textfield.
This looks good. I'm not sure we can check it in for beta2 unless it it deemed a 
stability or performance fix. You might want to talk to brendan@mozilla.org or 
waterson@mozilla.org and see what they think. But its a nice fix. We should get 
it into the build if we can.
Why ifdef XP_UNIX?  This sounds great for any platform that has a middle mouse
(thanks for doing it!)  If some non-Unix users don't want it, why not pref it
the same way all the other middle mouse stuff has been prefed?
Good point about dragging, Tomo. I've never really paid too much attention to
it, so I didn't even think of that part when I started on the patch. I noticed
one more difference in its behaviour: the thumb should be placed on middle-down,
not up, and from there the dragging should go on exactly like with the left
button. The attached patch should do this, as well as clean up the code a bit.

The patch is against v2, I hope that's OK. Is that's how it's supposed to be
done, as opposed to doing it against what's currently in the CVS?
Actually a diff against the current version in CVS would be the easiest to 
integrate.
Davor, i think you get my patch wrong, my patch is against cvs, not
against your patch. I think my patch already did what that v3 patch does?

Try removing nsSliderFrame.cpp and 'cvs update nsSliderFrame.cpp' and then
apply my patch.
My apologies for the confusion about applying patches. This is my first
contribution to Mozilla and I carelessly (not knowing better) applied Tomi's
patch over mine, instead of on a fresh file. Tomi is right, his patch already
did the same as my v3 -- with one exception: when middle-clicking on the thumb
slider, it should first position the middle of the thumb under the click, and
then start dragging from there (at least that's how Motif does it, and I think
it's a sensible thing to do). The attached patch (v4) should fix that.
I changed those #ifdef XP_UNIX to pref "middlemouse.scrollbarPosition".
To get this working, put:
user_pref("middlemouse.scrollbarPosition", true);
to your prefs.js file.

When this goes to tree, i think modules/libpref/src/init/all.js should
read:
pref("middlemouse.scrollbarPosition", false);

and modules/libpref/src/unix/unix.js:
pref("middlemouse.scrollbarPosition", true);
I just checked in this patch.

I patched 
nsSliderFrame.cpp
nsSliderFrame.h
unix.js
all.js
navigator.js

And put your names in as contributors. Thanks for all the great work.
Status: ASSIGNED → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: