зеркало из https://github.com/mozilla/pjs.git
Bug 58589 - groundwork for horizontal mousewheel scrolling. r=jkobal, sr=scc.
This commit is contained in:
Родитель
3b482f3e1e
Коммит
0a5e763a08
|
@ -928,7 +928,7 @@ nsEventStateManager::PostHandleEvent(nsIPresContext* aPresContext,
|
|||
&aBool);
|
||||
if (aBool) {
|
||||
numLines = msEvent->delta;
|
||||
if (msEvent->isPageScroll)
|
||||
if (msEvent->scrollFlags & nsMouseScrollEvent::kIsFullPage)
|
||||
action = MOUSE_SCROLL_PAGE;
|
||||
}
|
||||
else
|
||||
|
@ -940,7 +940,7 @@ nsEventStateManager::PostHandleEvent(nsIPresContext* aPresContext,
|
|||
&aBool);
|
||||
if (aBool) {
|
||||
numLines = msEvent->delta;
|
||||
if (msEvent->isPageScroll)
|
||||
if (msEvent->scrollFlags & nsMouseScrollEvent::kIsFullPage)
|
||||
action = MOUSE_SCROLL_PAGE;
|
||||
}
|
||||
else
|
||||
|
@ -951,7 +951,7 @@ nsEventStateManager::PostHandleEvent(nsIPresContext* aPresContext,
|
|||
mPrefService->GetBoolPref("mousewheel.withaltkey.sysnumlines", &aBool);
|
||||
if (aBool) {
|
||||
numLines = msEvent->delta;
|
||||
if (msEvent->isPageScroll)
|
||||
if (msEvent->scrollFlags & nsMouseScrollEvent::kIsFullPage)
|
||||
action = MOUSE_SCROLL_PAGE;
|
||||
}
|
||||
else
|
||||
|
@ -962,7 +962,7 @@ nsEventStateManager::PostHandleEvent(nsIPresContext* aPresContext,
|
|||
mPrefService->GetBoolPref("mousewheel.withnokey.sysnumlines", &aBool);
|
||||
if (aBool) {
|
||||
numLines = msEvent->delta;
|
||||
if (msEvent->isPageScroll)
|
||||
if (msEvent->scrollFlags & nsMouseScrollEvent::kIsFullPage)
|
||||
action = MOUSE_SCROLL_PAGE;
|
||||
}
|
||||
else
|
||||
|
@ -1030,7 +1030,6 @@ nsEventStateManager::PostHandleEvent(nsIPresContext* aPresContext,
|
|||
if (!focusContent)
|
||||
break;
|
||||
|
||||
// Get the content's view and scroll it.
|
||||
presShell->GetPrimaryFrameFor(focusContent, &focusFrame);
|
||||
if (!focusFrame)
|
||||
break;
|
||||
|
|
|
@ -928,7 +928,7 @@ nsEventStateManager::PostHandleEvent(nsIPresContext* aPresContext,
|
|||
&aBool);
|
||||
if (aBool) {
|
||||
numLines = msEvent->delta;
|
||||
if (msEvent->isPageScroll)
|
||||
if (msEvent->scrollFlags & nsMouseScrollEvent::kIsFullPage)
|
||||
action = MOUSE_SCROLL_PAGE;
|
||||
}
|
||||
else
|
||||
|
@ -940,7 +940,7 @@ nsEventStateManager::PostHandleEvent(nsIPresContext* aPresContext,
|
|||
&aBool);
|
||||
if (aBool) {
|
||||
numLines = msEvent->delta;
|
||||
if (msEvent->isPageScroll)
|
||||
if (msEvent->scrollFlags & nsMouseScrollEvent::kIsFullPage)
|
||||
action = MOUSE_SCROLL_PAGE;
|
||||
}
|
||||
else
|
||||
|
@ -951,7 +951,7 @@ nsEventStateManager::PostHandleEvent(nsIPresContext* aPresContext,
|
|||
mPrefService->GetBoolPref("mousewheel.withaltkey.sysnumlines", &aBool);
|
||||
if (aBool) {
|
||||
numLines = msEvent->delta;
|
||||
if (msEvent->isPageScroll)
|
||||
if (msEvent->scrollFlags & nsMouseScrollEvent::kIsFullPage)
|
||||
action = MOUSE_SCROLL_PAGE;
|
||||
}
|
||||
else
|
||||
|
@ -962,7 +962,7 @@ nsEventStateManager::PostHandleEvent(nsIPresContext* aPresContext,
|
|||
mPrefService->GetBoolPref("mousewheel.withnokey.sysnumlines", &aBool);
|
||||
if (aBool) {
|
||||
numLines = msEvent->delta;
|
||||
if (msEvent->isPageScroll)
|
||||
if (msEvent->scrollFlags & nsMouseScrollEvent::kIsFullPage)
|
||||
action = MOUSE_SCROLL_PAGE;
|
||||
}
|
||||
else
|
||||
|
@ -1030,7 +1030,6 @@ nsEventStateManager::PostHandleEvent(nsIPresContext* aPresContext,
|
|||
if (!focusContent)
|
||||
break;
|
||||
|
||||
// Get the content's view and scroll it.
|
||||
presShell->GetPrimaryFrameFor(focusContent, &focusFrame);
|
||||
if (!focusFrame)
|
||||
break;
|
||||
|
|
|
@ -239,7 +239,14 @@ struct nsCompositionEvent : public nsInputEvent {
|
|||
};
|
||||
|
||||
struct nsMouseScrollEvent : public nsInputEvent {
|
||||
PRBool isPageScroll;
|
||||
|
||||
enum nsMouseScrollFlags {
|
||||
kIsFullPage = 1 << 0,
|
||||
kIsVertical = 1 << 1,
|
||||
kIsHorizontal = 1 << 2
|
||||
};
|
||||
|
||||
PRInt32 scrollFlags;
|
||||
PRInt32 delta;
|
||||
};
|
||||
|
||||
|
|
|
@ -1906,7 +1906,10 @@ nsWidget::OnButtonPressSignal(GdkEventButton * aGdkButtonEvent)
|
|||
nsMouseScrollEvent scrollEvent;
|
||||
PRUint32 eventType = 0;
|
||||
|
||||
if ( HandlePopup(aGdkButtonEvent->x_root, aGdkButtonEvent->y_root) )
|
||||
/* We don't want to force a rollup here on mousewheel events.
|
||||
This is taken care of in the XP code in nsEventStateManager */
|
||||
if (aGdkButtonEvent->button != 4 && aGdkButtonEvent->button != 5 &&
|
||||
HandlePopup(aGdkButtonEvent->x_root, aGdkButtonEvent->y_root))
|
||||
return;
|
||||
|
||||
// Switch on single, double, triple click.
|
||||
|
@ -1935,7 +1938,7 @@ nsWidget::OnButtonPressSignal(GdkEventButton * aGdkButtonEvent)
|
|||
|
||||
case 4:
|
||||
case 5:
|
||||
scrollEvent.isPageScroll = PR_FALSE;
|
||||
scrollEvent.scrollFlags = nsMouseScrollEvent::kIsVertical;
|
||||
if (aGdkButtonEvent->button == 4)
|
||||
scrollEvent.delta = -3;
|
||||
else
|
||||
|
|
|
@ -2431,25 +2431,23 @@ PRBool nsWindow::OnVScroll( MPARAM mp1, MPARAM mp2)
|
|||
scrollEvent.isControl = WinIsKeyDown( VK_CTRL);
|
||||
scrollEvent.isAlt = WinIsKeyDown( VK_ALT) || WinIsKeyDown( VK_ALTGRAF);
|
||||
scrollEvent.isMeta = PR_FALSE;
|
||||
scrollEvent.scrollFlags = nsMouseScrollEvent::kIsVertical;
|
||||
switch (SHORT2FROMMP(mp2)) {
|
||||
case SB_LINEUP:
|
||||
scrollEvent.isPageScroll = PR_FALSE;
|
||||
scrollEvent.delta = -1;
|
||||
break;
|
||||
case SB_LINEDOWN:
|
||||
scrollEvent.isPageScroll = PR_FALSE;
|
||||
scrollEvent.delta = 1;
|
||||
break;
|
||||
case SB_PAGEUP:
|
||||
scrollEvent.isPageScroll = PR_TRUE;
|
||||
scrollEvent.scrollFlags |= nsMouseScrollEvent::kIsFullPage;
|
||||
scrollEvent.delta = -1;
|
||||
break;
|
||||
case SB_PAGEDOWN:
|
||||
scrollEvent.isPageScroll = PR_TRUE;
|
||||
scrollEvent.scrollFlags |= nsMouseScrollEvent::kIsFullPage;
|
||||
scrollEvent.delta = 1;
|
||||
break;
|
||||
default:
|
||||
scrollEvent.isPageScroll = PR_FALSE;
|
||||
scrollEvent.delta = 0;
|
||||
break;
|
||||
}
|
||||
|
@ -2470,26 +2468,24 @@ PRBool nsWindow::OnHScroll( MPARAM mp1, MPARAM mp2)
|
|||
scrollEvent.isControl = WinIsKeyDown( VK_CTRL);
|
||||
scrollEvent.isAlt = WinIsKeyDown( VK_ALT) || WinIsKeyDown( VK_ALTGRAF);
|
||||
scrollEvent.isMeta = PR_FALSE;
|
||||
scrollEvent.scrollFlags = nsMouseScrollEvent::kIsHorizontal;
|
||||
switch (SHORT2FROMMP(mp2)) {
|
||||
case SB_LINELEFT:
|
||||
scrollEvent.isPageScroll = PR_FALSE;
|
||||
scrollEvent.delta = -1;
|
||||
break;
|
||||
case SB_LINERIGHT:
|
||||
scrollEvent.isPageScroll = PR_FALSE;
|
||||
scrollEvent.delta = 1;
|
||||
break;
|
||||
case SB_PAGELEFT:
|
||||
scrollEvent.isPageScroll = PR_TRUE;
|
||||
scrollEvent.scrollFlags |= nsMouseScrollEvent::kIsFullPage;
|
||||
scrollEvent.delta = -1;
|
||||
break;
|
||||
case SB_PAGERIGHT:
|
||||
scrollEvent.isPageScroll = PR_TRUE;
|
||||
scrollEvent.deltaColumns = 1;
|
||||
scrollEvent.scrollFlags |= nsMouseScrollEvent::kIsFullPage;
|
||||
scrollEvent.delta = 1;
|
||||
break;
|
||||
default:
|
||||
scrollEvent.isPageScroll = PR_FALSE;
|
||||
scrollEvent.deltaColumns = 0;
|
||||
scrollEvent.delta = 0;
|
||||
break;
|
||||
}
|
||||
DispatchWindowEvent(&scrollEvent);
|
||||
|
|
|
@ -3390,14 +3390,14 @@ PRBool nsWindow::ProcessMessage(UINT msg, WPARAM wParam, LPARAM lParam, LRESULT
|
|||
}
|
||||
|
||||
nsMouseScrollEvent scrollEvent;
|
||||
scrollEvent.scrollFlags = nsMouseScrollEvent::kIsVertical;
|
||||
if (ulScrollLines == WHEEL_PAGESCROLL) {
|
||||
scrollEvent.isPageScroll = PR_TRUE;
|
||||
scrollEvent.scrollFlags |= nsMouseScrollEvent::kIsFullPage;
|
||||
if (msg == WM_MOUSEWHEEL)
|
||||
scrollEvent.delta = (((short) HIWORD (wParam)) > 0) ? -1 : 1;
|
||||
else
|
||||
scrollEvent.delta = ((int) wParam > 0) ? -1 : 1;
|
||||
} else {
|
||||
scrollEvent.isPageScroll = PR_FALSE;
|
||||
if (msg == WM_MOUSEWHEEL)
|
||||
scrollEvent.delta = -((short) HIWORD (wParam) / iDeltaPerLine);
|
||||
else
|
||||
|
|
|
@ -711,7 +711,7 @@ nsAppShell::HandleButtonEvent(XEvent *event, nsWidget *aWidget)
|
|||
case 4:
|
||||
case 5:
|
||||
scrollEvent.delta = (event->xbutton.button == 4) ? -3 : 3;
|
||||
scrollEvent.isPageScroll = PR_FALSE;
|
||||
scrollEvent.scrollFlags = nsMouseScrollEvent::kIsVertical;
|
||||
scrollEvent.message = NS_MOUSE_SCROLL;
|
||||
scrollEvent.widget = aWidget;
|
||||
scrollEvent.eventStructType = NS_MOUSE_SCROLL_EVENT;
|
||||
|
|
Загрузка…
Ссылка в новой задаче