зеркало из https://github.com/mozilla/pjs.git
Bug 672175 part.8 Compute modifier key state in MouseScrollHandler r=jimm
This commit is contained in:
Родитель
c420e187b8
Коммит
99686018e1
|
@ -167,6 +167,20 @@ MouseScrollHandler::DispatchEvent(nsWindow* aWindow, nsGUIEvent& aEvent)
|
|||
return aWindow->DispatchWindowEvent(&aEvent);
|
||||
}
|
||||
|
||||
/* static */
|
||||
nsModifierKeyState
|
||||
MouseScrollHandler::GetModifierKeyState()
|
||||
{
|
||||
nsModifierKeyState result;
|
||||
// Assume the Control key is down if the Elantech touchpad has sent the
|
||||
// mis-ordered WM_KEYDOWN/WM_MOUSEWHEEL messages. (See the comment in
|
||||
// MouseScrollHandler::Device::Elantech::HandleKeyMessage().)
|
||||
if (!result.mIsControlDown) {
|
||||
result.mIsControlDown = Device::Elantech::IsZooming();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* EventInfo
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
|
||||
class nsWindow;
|
||||
class nsGUIEvent;
|
||||
struct nsModifierKeyState;
|
||||
|
||||
namespace mozilla {
|
||||
namespace widget {
|
||||
|
@ -33,6 +34,13 @@ public:
|
|||
LRESULT *aRetValue,
|
||||
bool &aEatMessage);
|
||||
|
||||
/**
|
||||
* GetModifierKeyState() returns current modifier key state.
|
||||
* Note that some devices need some hack for the modifier key state.
|
||||
* This method does it automatically.
|
||||
*/
|
||||
static nsModifierKeyState GetModifierKeyState();
|
||||
|
||||
private:
|
||||
MouseScrollHandler();
|
||||
~MouseScrollHandler();
|
||||
|
|
|
@ -6295,21 +6295,13 @@ nsWindow::OnMouseWheelInternal(UINT aMessage, WPARAM aWParam, LPARAM aLParam,
|
|||
// means we process this message
|
||||
*aRetValue = eventInfo.ComputeMessageResult(true);
|
||||
|
||||
nsModifierKeyState modKeyState;
|
||||
nsModifierKeyState modKeyState = MouseScrollHandler::GetModifierKeyState();
|
||||
|
||||
// Our positive delta value means to bottom or right.
|
||||
// But positive native delta value means to top or right.
|
||||
// Use orienter for computing our delta value with native delta value.
|
||||
PRInt32 orienter = eventInfo.IsVertical() ? -1 : 1;
|
||||
|
||||
// Assume the Control key is down if the Elantech touchpad has sent the
|
||||
// mis-ordered WM_KEYDOWN/WM_MOUSEWHEEL messages. (See the comment in
|
||||
// MouseScrollHandler::Device::Elantech::HandleKeyMessage().)
|
||||
if (!modKeyState.mIsControlDown) {
|
||||
modKeyState.mIsControlDown =
|
||||
MouseScrollHandler::Device::Elantech::IsZooming();
|
||||
}
|
||||
|
||||
// Create line (or page) scroll event.
|
||||
nsMouseScrollEvent scrollEvent(true, NS_MOUSE_SCROLL, this);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче