Bug 241646 Shift+Mousewheel (scrollwheel) behavior backwards, unintuitive not correctable with configuration

patch by sand@blarg.net r=bryner sr=roc
This commit is contained in:
timeless%mozdev.org 2004-04-29 07:01:50 +00:00
parent 65ad250d3c
commit 5aec87e773
2 changed files with 33 additions and 13 deletions

View File

@ -1606,8 +1606,8 @@ nsEventStateManager::DoScrollHistory(PRInt32 direction)
if (pcContainer) {
nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(pcContainer));
if (webNav) {
// negative direction to go back one step, nonneg to go forward
if (direction < 0)
// positive direction to go back one step, nonpositive to go forward
if (direction > 0)
webNav->GoBack();
else
webNav->GoForward();
@ -2041,15 +2041,35 @@ nsEventStateManager::PostHandleEvent(nsIPresContext* aPresContext,
}
else
{
// If the scroll event's delta isn't to our liking, we can
// override it with the "numlines" parameter. There are two
// things we can do:
//
// (1) Pick a different number. Instead of scrolling 3
// lines ("delta" in Gtk2), we would scroll 1 line.
// (2) Swap directions. Instead of scrolling down, scroll up.
//
// For the first item, the magnitude of the parameter is
// used instead of the magnitude of the delta. For the
// second item, if the parameter is negative we swap
// directions.
nsCAutoString numLinesKey(baseKey);
numLinesKey.Append(numlinesslot);
mPrefBranch->GetIntPref(numLinesKey.get(),
&numLines);
bool swapDirs = (numLines < 0);
PRInt32 userSize = swapDirs ? -numLines : numLines;
PRInt32 deltaUp = (msEvent->delta < 0);
if (swapDirs) {
deltaUp = ! deltaUp;
}
if ((msEvent->delta < 0) && (numLines > 0))
numLines = -numLines;
numLines = deltaUp ? -userSize : userSize;
}
switch (action) {
case MOUSE_SCROLL_N_LINES:

View File

@ -677,18 +677,18 @@ pref("mousewheel.withcontrolkey.numlines",1);
pref("mousewheel.withcontrolkey.sysnumlines",true);
pref("mousewheel.withshiftkey.action",0);
pref("mousewheel.withshiftkey.numlines",1);
pref("mousewheel.withshiftkey.sysnumlines",false);
pref("mousewheel.withshiftkey.sysnumlines",true);
pref("mousewheel.withaltkey.action",2);
pref("mousewheel.withaltkey.numlines",1);
pref("mousewheel.withaltkey.sysnumlines",false);
pref("mousewheel.horizscroll.withnokey.action",2);
pref("mousewheel.horizscroll.withnokey.numlines",-1);
pref("mousewheel.horizscroll.withnokey.sysnumlines",true);
pref("mousewheel.horizscroll.withcontrolkey.action",0);
pref("mousewheel.horizscroll.withcontrolkey.numlines",1);
pref("mousewheel.horizscroll.withcontrolkey.sysnumlines",true);
pref("mousewheel.horizscroll.withshiftkey.action",0);
pref("mousewheel.horizscroll.withshiftkey.numlines",1);
pref("mousewheel.horizscroll.withnokey.sysnumlines",false);
pref("mousewheel.horizscroll.withcontrolkey.action",2);
pref("mousewheel.horizscroll.withcontrolkey.numlines",-1);
pref("mousewheel.horizscroll.withcontrolkey.sysnumlines",false);
pref("mousewheel.horizscroll.withshiftkey.action",2);
pref("mousewheel.horizscroll.withshiftkey.numlines",-1);
pref("mousewheel.horizscroll.withshiftkey.sysnumlines",false);
pref("mousewheel.horizscroll.withaltkey.action",2);
pref("mousewheel.horizscroll.withaltkey.numlines",-1);