Bug 672175 part.8 Compute modifier key state in MouseScrollHandler r=jimm

This commit is contained in:
Masayuki Nakano 2012-03-06 12:20:28 +09:00
Родитель eac1fdb5dc
Коммит aa58d1c729
3 изменённых файлов: 23 добавлений и 9 удалений

Просмотреть файл

@ -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);