mirror of
https://github.com/roytam1/palemoon27.git
synced 2026-05-26 14:30:27 +00:00
c975675694
- Bug 1198459 - Update telemetry data based on the use of the forced enable pref. r=felipe (f33f0efc9a) - Bug 1234210 - Restrict updates for accessibility.lastLoadDate to shutdown. r=trevor (5e484eb7ba) - Bug 1231517 - part 3, Add ZoomToRect function to nsIWidget classes r=kats (57496a18cd) - Bug 1229393 - Ensure that all the touch points from the original touch go to APZCCallbackHelper::SendSetTargetAPZCNotification. r=botond (45ce1737ac) - Bug 1174323 part 1 - Add nsDOMWindowUtils::SendNativeMouseMove and EventUtils.sendNativeMouseMove. r=smaug (527439f71b) - Bug 1180351 - Enable pointerlock tests on Windows and Linux. r=smaug (833fac9ba9) - Bug 1180351 - Followup: Disable pointerlock tests on Windows for frequently failing tests. r=turning off tests (02525d24f4) - Bug 1174323 part 2 - Use native mouse move to improve robustness of screenClientXYConst subtest. r=smaug (7e3fb884d3) - Bug 1231517 - part 4, Add ZoomToFocusedInput function to nsDOMWindowUtils r=kats (a1f3e3b4fd) - Bug 1153156 part.1 Move nsBaseWidget::OverrideSystemMouseScrollSpeed() to WidgetWheelEvent r=smaug, sr=smaug (8a95d65d55) - bug 726265 don't activate ELAN swipe hack unless ScanCode is zero r=heycam (477a5ce06a) - Bug 1235686 part.1 MouseScrollHandler should refresh the cache of system settings at handling wheel messages if the pref doesn't allow to cache system settings r=jimm (6cae8d2b07) - Bug 1235686 part.2 Don't refresh the cache of system settings at handling wheel messages if the scroll amout values are initialized with prefs r=jimm (ead872b6bf) - Bug 1235686 part.3 Don't trust system settings cache if SynTP of Synaptics is installed r=jimm (d56a034a42) - Bug 1235686 part.4 Don't trust system settings cache if Apoint of Alps is installed r=jimm (85cb23e185) - Bug 1153156 part.2 Make WidgetWheelEvent store if overriding system scroll speed is allowed and it shouldn't be allowed if scroll speed isn't system default settings on Windows r=smaug+jimm (3d5fc255db) - Bug 1153156 part.3 Don't allow to override system scroll speed if the wheel event causes too fast scroll r=smaug+jimm (21e10640ac) - Bug 1236750 - Rename ViewTransform to AsyncTransform. r=kats (1ccd8af262) - Bug 1226826 - Record if painted displayport updates were due to repaints from the relevant layer tree or not. r=botond (e28315ec88) - Bug 1228641. Add a initializer_list constructor to nsTArray. r=froydnj (448f69f610) - Bug 962243 - Gtest for being able to pan after lifting a finger from a pinch. r=botond (a1687f190c) - Bug 1031443 - Allow panning in the pinching state even if zooming is disabled;r=botond (aacb1a28bd) - Bug 1231504 - Move some prefs from b2g.js to all.js. r=botond (c9801602ba) - Bug 1092128 - Ensure the tests for touch action disabled actually disable touch action. r=botond (ec3fae4568) - Bug 1014691 - Get TestAsyncPanZoomController to compile in its new location. r=kats (9dd104c6fd) - Bug 1240244 - Split APZ gtests into several files. r=kats (0ce8bd4f80) - Bug 1235994 - Add a flag to wheel events to track if they may have momentum following them. r=mstange (d5b2099244) - Bug 1153156 part.4 Make APZC system scroll speed overriding aware r=mstange (f9d49eb79c) - Bug 1233118 - implement IAccessible2_3::selectionRanges, r=yzen (d85fe6cf64) - bug 1235965 - null check mDoc in AccessibleWrap::Shutdown() r=davidb (cb775e5c00) - Bug 1130096 - Convert embedding/components/find/ to Gecko style. r=mccr8 (83d043e841) - Bug 1164473 - Resolve issue when touches stop working after pen was activated. r=jimm (16ce68b032) - Bug 1171712 - Implement separated InkColletor and InkCollectorEvent classes. r=smaug, r=jimm (8000e742b8) - bug 1198656 interpret null ConvolverNode mBuffer as a buffer of zerosr=padenot (339e1f9904) - bug 930257 finish Oscillator on processing last non-null block r=padenot (2719eee12b) - Bug 1240411: P1. Clean up webaudio headers. r=cpearce (f169dc2789) - Bug 1219711 - Don't rely on timer interval in fake audio track. r=jesup (f140fd848a) - Bug 1223655 - Only check for track end if track exists in MediaEngineDefaultAudioSource. r=jesup (3055b4529f) - Bug 1223655 - Also don't check time of data end if track has ended. r=jesup (bbdf7c5be5) - Bug 1223655 - Fix opt build bustage on a CLOSED TREE. r=bustage (d546f4ba0b) - Bug 1164463 followup: Add missing 'override' keyword to MediaEngineDefault::Shutdown(). rs=ehsan (33bf959d84) - Bug 1240411: P2. Clean up webrtc headers. r=jesup (73c2bdf22d) - Bug 1240411: P4. Clean up readers headers. r=cpearce (748d2bf9e8) - Bug 1232527 - Remove GMPVideoDecoderTrialCreator and friends. r=jwwang (e0decf270f) - Bug 1240411: P5. Clean up GMP headers. r=cpearce (0336b7fd9c) - Bug 1240252: Add missing "mozilla::" namespace prefix before usage of type LayoutDeviceIntRegion, to fix local build bustage. r=njn (54d5a4a553) - Bug 1245241 - part 1 - Close Shmem file handles after mapping them when possible to reduce exhaustion issues. r=billm (631c2b6da5)
624 lines
19 KiB
C++
624 lines
19 KiB
C++
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
/* vim: set ts=2 et sw=2 tw=80: */
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
|
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
#ifndef mozilla_widget_WinMouseScrollHandler_h__
|
|
#define mozilla_widget_WinMouseScrollHandler_h__
|
|
|
|
#include "nscore.h"
|
|
#include "nsDebug.h"
|
|
#include "mozilla/Assertions.h"
|
|
#include "mozilla/EventForwards.h"
|
|
#include "mozilla/TimeStamp.h"
|
|
#include "Units.h"
|
|
#include <windows.h>
|
|
#include "nsPoint.h"
|
|
|
|
class nsWindowBase;
|
|
|
|
namespace mozilla {
|
|
namespace widget {
|
|
|
|
class ModifierKeyState;
|
|
|
|
struct MSGResult;
|
|
|
|
class MouseScrollHandler {
|
|
public:
|
|
static MouseScrollHandler* GetInstance();
|
|
|
|
static void Initialize();
|
|
static void Shutdown();
|
|
|
|
static bool NeedsMessage(UINT aMsg);
|
|
static bool ProcessMessage(nsWindowBase* aWidget,
|
|
UINT msg,
|
|
WPARAM wParam,
|
|
LPARAM lParam,
|
|
MSGResult& aResult);
|
|
|
|
/**
|
|
* See nsIWidget::SynthesizeNativeMouseScrollEvent() for the detail about
|
|
* this method.
|
|
*/
|
|
static nsresult SynthesizeNativeMouseScrollEvent(nsWindowBase* aWidget,
|
|
const LayoutDeviceIntPoint& aPoint,
|
|
uint32_t aNativeMessage,
|
|
int32_t aDelta,
|
|
uint32_t aModifierFlags,
|
|
uint32_t aAdditionalFlags);
|
|
|
|
/**
|
|
* IsWaitingInternalMessage() returns true if MouseScrollHandler posted
|
|
* an internal message for a native mouse wheel message and has not
|
|
* received it. Otherwise, false.
|
|
*/
|
|
static bool IsWaitingInternalMessage()
|
|
{
|
|
return sInstance && sInstance->mIsWaitingInternalMessage;
|
|
}
|
|
|
|
private:
|
|
MouseScrollHandler();
|
|
~MouseScrollHandler();
|
|
|
|
bool mIsWaitingInternalMessage;
|
|
|
|
static MouseScrollHandler* sInstance;
|
|
|
|
/**
|
|
* InitEvent() initializes the aEvent. If aPoint is null, the result of
|
|
* GetCurrentMessagePos() will be used.
|
|
*/
|
|
static void InitEvent(nsWindowBase* aWidget,
|
|
WidgetGUIEvent& aEvent,
|
|
LayoutDeviceIntPoint* aPoint = nullptr);
|
|
|
|
/**
|
|
* GetModifierKeyState() returns current modifier key state.
|
|
* Note that some devices need some hack for the modifier key state.
|
|
* This method does it automatically.
|
|
*
|
|
* @param aMessage Handling message.
|
|
*/
|
|
static ModifierKeyState GetModifierKeyState(UINT aMessage);
|
|
|
|
/**
|
|
* MozGetMessagePos() returns the mouse cursor position when GetMessage()
|
|
* was called last time. However, if we're sending a native message,
|
|
* this returns the specified cursor position by
|
|
* SynthesizeNativeMouseScrollEvent().
|
|
*/
|
|
static POINTS GetCurrentMessagePos();
|
|
|
|
/**
|
|
* ProcessNativeMouseWheelMessage() processes WM_MOUSEWHEEL and
|
|
* WM_MOUSEHWHEEL. Additionally, processes WM_VSCROLL and WM_HSCROLL if they
|
|
* should be processed as mouse wheel message.
|
|
* This method posts MOZ_WM_MOUSEVWHEEL, MOZ_WM_MOUSEHWHEEL,
|
|
* MOZ_WM_VSCROLL or MOZ_WM_HSCROLL if we need to dispatch mouse scroll
|
|
* events. That avoids deadlock with plugin process.
|
|
*
|
|
* @param aWidget A window which receives the message.
|
|
* @param aMessage WM_MOUSEWHEEL, WM_MOUSEHWHEEL, WM_VSCROLL or
|
|
* WM_HSCROLL.
|
|
* @param aWParam The wParam value of the message.
|
|
* @param aLParam The lParam value of the message.
|
|
*/
|
|
void ProcessNativeMouseWheelMessage(nsWindowBase* aWidget,
|
|
UINT aMessage,
|
|
WPARAM aWParam,
|
|
LPARAM aLParam);
|
|
|
|
/**
|
|
* ProcessNativeScrollMessage() processes WM_VSCROLL and WM_HSCROLL.
|
|
* This method just call ProcessMouseWheelMessage() if the message should be
|
|
* processed as mouse wheel message. Otherwise, dispatches a content
|
|
* command event.
|
|
*
|
|
* @param aWidget A window which receives the message.
|
|
* @param aMessage WM_VSCROLL or WM_HSCROLL.
|
|
* @param aWParam The wParam value of the message.
|
|
* @param aLParam The lParam value of the message.
|
|
* @return TRUE if the message is processed. Otherwise, FALSE.
|
|
*/
|
|
bool ProcessNativeScrollMessage(nsWindowBase* aWidget,
|
|
UINT aMessage,
|
|
WPARAM aWParam,
|
|
LPARAM aLParam);
|
|
|
|
/**
|
|
* HandleMouseWheelMessage() processes MOZ_WM_MOUSEVWHEEL and
|
|
* MOZ_WM_MOUSEHWHEEL which are posted when one of our windows received
|
|
* WM_MOUSEWHEEL or WM_MOUSEHWHEEL for avoiding deadlock with OOPP.
|
|
*
|
|
* @param aWidget A window which receives the wheel message.
|
|
* @param aMessage MOZ_WM_MOUSEWHEEL or MOZ_WM_MOUSEHWHEEL.
|
|
* @param aWParam The wParam value of the original message.
|
|
* @param aLParam The lParam value of the original message.
|
|
*/
|
|
void HandleMouseWheelMessage(nsWindowBase* aWidget,
|
|
UINT aMessage,
|
|
WPARAM aWParam,
|
|
LPARAM aLParam);
|
|
|
|
/**
|
|
* HandleScrollMessageAsMouseWheelMessage() processes the MOZ_WM_VSCROLL and
|
|
* MOZ_WM_HSCROLL which are posted when one of mouse windows received
|
|
* WM_VSCROLL or WM_HSCROLL and user wants them to emulate mouse wheel
|
|
* message's behavior.
|
|
*
|
|
* @param aWidget A window which receives the scroll message.
|
|
* @param aMessage MOZ_WM_VSCROLL or MOZ_WM_HSCROLL.
|
|
* @param aWParam The wParam value of the original message.
|
|
* @param aLParam The lParam value of the original message.
|
|
*/
|
|
void HandleScrollMessageAsMouseWheelMessage(nsWindowBase* aWidget,
|
|
UINT aMessage,
|
|
WPARAM aWParam,
|
|
LPARAM aLParam);
|
|
|
|
/**
|
|
* ComputeMessagePos() computes the cursor position when the message was
|
|
* added to the queue.
|
|
*
|
|
* @param aMessage Handling message.
|
|
* @param aWParam Handling message's wParam.
|
|
* @param aLParam Handling message's lParam.
|
|
* @return Mouse cursor position when the message is added to
|
|
* the queue or current cursor position if the result of
|
|
* ::GetMessagePos() is broken.
|
|
*/
|
|
POINT ComputeMessagePos(UINT aMessage,
|
|
WPARAM aWParam,
|
|
LPARAM aLParam);
|
|
|
|
class EventInfo {
|
|
public:
|
|
/**
|
|
* @param aWidget An nsWindow which is handling the event.
|
|
* @param aMessage Must be WM_MOUSEWHEEL or WM_MOUSEHWHEEL.
|
|
*/
|
|
EventInfo(nsWindowBase* aWidget, UINT aMessage, WPARAM aWParam, LPARAM aLParam);
|
|
|
|
bool CanDispatchWheelEvent() const;
|
|
|
|
int32_t GetNativeDelta() const { return mDelta; }
|
|
HWND GetWindowHandle() const { return mWnd; }
|
|
const TimeStamp& GetTimeStamp() const { return mTimeStamp; }
|
|
bool IsVertical() const { return mIsVertical; }
|
|
bool IsPositive() const { return (mDelta > 0); }
|
|
bool IsPage() const { return mIsPage; }
|
|
|
|
/**
|
|
* @return Number of lines or pages scrolled per WHEEL_DELTA.
|
|
*/
|
|
int32_t GetScrollAmount() const;
|
|
|
|
protected:
|
|
EventInfo() :
|
|
mIsVertical(false), mIsPage(false), mDelta(0), mWnd(nullptr)
|
|
{
|
|
}
|
|
|
|
// TRUE if event is for vertical scroll. Otherwise, FALSE.
|
|
bool mIsVertical;
|
|
// TRUE if event scrolls per page, otherwise, FALSE.
|
|
bool mIsPage;
|
|
// The native delta value.
|
|
int32_t mDelta;
|
|
// The window handle which is handling the event.
|
|
HWND mWnd;
|
|
// Timestamp of the event.
|
|
TimeStamp mTimeStamp;
|
|
};
|
|
|
|
class LastEventInfo : public EventInfo {
|
|
public:
|
|
LastEventInfo() :
|
|
EventInfo(), mAccumulatedDelta(0)
|
|
{
|
|
}
|
|
|
|
/**
|
|
* CanContinueTransaction() checks whether the new event can continue the
|
|
* last transaction or not. Note that if there is no transaction, this
|
|
* returns true.
|
|
*/
|
|
bool CanContinueTransaction(const EventInfo& aNewEvent);
|
|
|
|
/**
|
|
* ResetTransaction() resets the transaction, i.e., the instance forgets
|
|
* the last event information.
|
|
*/
|
|
void ResetTransaction();
|
|
|
|
/**
|
|
* RecordEvent() saves the information of new event.
|
|
*/
|
|
void RecordEvent(const EventInfo& aEvent);
|
|
|
|
/**
|
|
* InitWheelEvent() initializes NS_WHEEL_WHEEL event and
|
|
* recomputes the remaning detla for the event.
|
|
* This must be called only once during handling a message and after
|
|
* RecordEvent() is called.
|
|
*
|
|
* @param aWidget A window which will dispatch the event.
|
|
* @param aWheelEvent An NS_WHEEL_WHEEL event, this will be
|
|
* initialized.
|
|
* @param aModKeyState Current modifier key state.
|
|
* @return TRUE if the event is ready to dispatch.
|
|
* Otherwise, FALSE.
|
|
*/
|
|
bool InitWheelEvent(nsWindowBase* aWidget,
|
|
WidgetWheelEvent& aWheelEvent,
|
|
const ModifierKeyState& aModKeyState);
|
|
|
|
private:
|
|
static int32_t RoundDelta(double aDelta);
|
|
|
|
int32_t mAccumulatedDelta;
|
|
};
|
|
|
|
LastEventInfo mLastEventInfo;
|
|
|
|
class SystemSettings {
|
|
public:
|
|
SystemSettings() : mInitialized(false) {}
|
|
|
|
void Init();
|
|
void MarkDirty();
|
|
void NotifyUserPrefsMayOverrideSystemSettings();
|
|
|
|
// On some environments, SystemParametersInfo() may be hooked by touchpad
|
|
// utility or something. In such case, when user changes active pointing
|
|
// device to another one, the result of SystemParametersInfo() may be
|
|
// changed without WM_SETTINGCHANGE message. For avoiding this trouble,
|
|
// we need to modify cache of system settings at every wheel message
|
|
// handling if we meet known device whose utility may hook the API.
|
|
void TrustedScrollSettingsDriver();
|
|
|
|
// Returns true if the system scroll may be overridden for faster scroll.
|
|
// Otherwise, false. For example, if the user maybe uses an expensive
|
|
// mouse which supports acceleration of scroll speed, faster scroll makes
|
|
// the user inconvenient.
|
|
bool IsOverridingSystemScrollSpeedAllowed();
|
|
|
|
int32_t GetScrollAmount(bool aForVertical) const
|
|
{
|
|
MOZ_ASSERT(mInitialized, "SystemSettings must be initialized");
|
|
return aForVertical ? mScrollLines : mScrollChars;
|
|
}
|
|
|
|
bool IsPageScroll(bool aForVertical) const
|
|
{
|
|
MOZ_ASSERT(mInitialized, "SystemSettings must be initialized");
|
|
return aForVertical ? (uint32_t(mScrollLines) == WHEEL_PAGESCROLL) :
|
|
(uint32_t(mScrollChars) == WHEEL_PAGESCROLL);
|
|
}
|
|
|
|
// The default vertical and horizontal scrolling speed is 3, this is defined
|
|
// on the document of SystemParametersInfo in MSDN.
|
|
static int32_t DefaultScrollLines() { return 3; }
|
|
static int32_t DefaultScrollChars() { return 3; }
|
|
|
|
private:
|
|
bool mInitialized;
|
|
// The result of SystemParametersInfo() may not be reliable since it may
|
|
// be hooked. So, if the values are initialized with prefs, we can trust
|
|
// the value. Following mIsReliableScroll* are set true when mScroll* are
|
|
// initialized with prefs.
|
|
bool mIsReliableScrollLines;
|
|
bool mIsReliableScrollChars;
|
|
|
|
int32_t mScrollLines;
|
|
int32_t mScrollChars;
|
|
|
|
// Returns true if cached value is changed.
|
|
bool InitScrollLines();
|
|
bool InitScrollChars();
|
|
|
|
void RefreshCache();
|
|
};
|
|
|
|
SystemSettings mSystemSettings;
|
|
|
|
class UserPrefs {
|
|
public:
|
|
UserPrefs();
|
|
~UserPrefs();
|
|
|
|
void MarkDirty();
|
|
|
|
bool IsScrollMessageHandledAsWheelMessage()
|
|
{
|
|
Init();
|
|
return mScrollMessageHandledAsWheelMessage;
|
|
}
|
|
|
|
bool IsSystemSettingCacheEnabled()
|
|
{
|
|
Init();
|
|
return mEnableSystemSettingCache;
|
|
}
|
|
|
|
bool IsSystemSettingCacheForciblyEnabled()
|
|
{
|
|
Init();
|
|
return mForceEnableSystemSettingCache;
|
|
}
|
|
|
|
int32_t GetOverriddenVerticalScrollAmout()
|
|
{
|
|
Init();
|
|
return mOverriddenVerticalScrollAmount;
|
|
}
|
|
|
|
int32_t GetOverriddenHorizontalScrollAmout()
|
|
{
|
|
Init();
|
|
return mOverriddenHorizontalScrollAmount;
|
|
}
|
|
|
|
int32_t GetMouseScrollTransactionTimeout()
|
|
{
|
|
Init();
|
|
return mMouseScrollTransactionTimeout;
|
|
}
|
|
|
|
private:
|
|
void Init();
|
|
|
|
static void OnChange(const char* aPrefName, void* aClosure)
|
|
{
|
|
static_cast<UserPrefs*>(aClosure)->MarkDirty();
|
|
}
|
|
|
|
bool mInitialized;
|
|
bool mScrollMessageHandledAsWheelMessage;
|
|
bool mEnableSystemSettingCache;
|
|
bool mForceEnableSystemSettingCache;
|
|
int32_t mOverriddenVerticalScrollAmount;
|
|
int32_t mOverriddenHorizontalScrollAmount;
|
|
int32_t mMouseScrollTransactionTimeout;
|
|
};
|
|
|
|
UserPrefs mUserPrefs;
|
|
|
|
class SynthesizingEvent {
|
|
public:
|
|
SynthesizingEvent() :
|
|
mWnd(nullptr), mMessage(0), mWParam(0), mLParam(0),
|
|
mStatus(NOT_SYNTHESIZING)
|
|
{
|
|
}
|
|
|
|
~SynthesizingEvent() {}
|
|
|
|
static bool IsSynthesizing();
|
|
|
|
nsresult Synthesize(const POINTS& aCursorPoint, HWND aWnd,
|
|
UINT aMessage, WPARAM aWParam, LPARAM aLParam,
|
|
const BYTE (&aKeyStates)[256]);
|
|
|
|
void NativeMessageReceived(nsWindowBase* aWidget, UINT aMessage,
|
|
WPARAM aWParam, LPARAM aLParam);
|
|
|
|
void NotifyNativeMessageHandlingFinished();
|
|
void NotifyInternalMessageHandlingFinished();
|
|
|
|
const POINTS& GetCursorPoint() const { return mCursorPoint; }
|
|
|
|
private:
|
|
POINTS mCursorPoint;
|
|
HWND mWnd;
|
|
UINT mMessage;
|
|
WPARAM mWParam;
|
|
LPARAM mLParam;
|
|
BYTE mKeyState[256];
|
|
BYTE mOriginalKeyState[256];
|
|
|
|
enum Status {
|
|
NOT_SYNTHESIZING,
|
|
SENDING_MESSAGE,
|
|
NATIVE_MESSAGE_RECEIVED,
|
|
INTERNAL_MESSAGE_POSTED,
|
|
};
|
|
Status mStatus;
|
|
|
|
const char* GetStatusName()
|
|
{
|
|
switch (mStatus) {
|
|
case NOT_SYNTHESIZING:
|
|
return "NOT_SYNTHESIZING";
|
|
case SENDING_MESSAGE:
|
|
return "SENDING_MESSAGE";
|
|
case NATIVE_MESSAGE_RECEIVED:
|
|
return "NATIVE_MESSAGE_RECEIVED";
|
|
case INTERNAL_MESSAGE_POSTED:
|
|
return "INTERNAL_MESSAGE_POSTED";
|
|
default:
|
|
return "Unknown";
|
|
}
|
|
}
|
|
|
|
void Finish();
|
|
}; // SynthesizingEvent
|
|
|
|
SynthesizingEvent* mSynthesizingEvent;
|
|
|
|
public:
|
|
|
|
class Device {
|
|
public:
|
|
// SynTP is a touchpad driver of Synaptics.
|
|
class SynTP
|
|
{
|
|
public:
|
|
static bool IsDriverInstalled()
|
|
{
|
|
return sMajorVersion != 0;
|
|
}
|
|
/**
|
|
* GetDriverMajorVersion() returns the installed driver's major version.
|
|
* If SynTP driver isn't installed, this returns 0.
|
|
*/
|
|
static int32_t GetDriverMajorVersion()
|
|
{
|
|
return sMajorVersion;
|
|
}
|
|
/**
|
|
* GetDriverMinorVersion() returns the installed driver's minor version.
|
|
* If SynTP driver isn't installed, this returns -1.
|
|
*/
|
|
static int32_t GetDriverMinorVersion()
|
|
{
|
|
return sMinorVersion;
|
|
}
|
|
|
|
static void Init();
|
|
|
|
private:
|
|
static bool sInitialized;
|
|
static int32_t sMajorVersion;
|
|
static int32_t sMinorVersion;
|
|
};
|
|
|
|
class Elantech {
|
|
public:
|
|
/**
|
|
* GetDriverMajorVersion() returns the installed driver's major version.
|
|
* If Elantech's driver was installed, returns 0.
|
|
*/
|
|
static int32_t GetDriverMajorVersion();
|
|
|
|
/**
|
|
* IsHelperWindow() checks whether aWnd is a helper window of Elantech's
|
|
* touchpad. Returns TRUE if so. Otherwise, FALSE.
|
|
*/
|
|
static bool IsHelperWindow(HWND aWnd);
|
|
|
|
/**
|
|
* Key message handler for Elantech's hack. Returns TRUE if the message
|
|
* is consumed by this handler. Otherwise, FALSE.
|
|
*/
|
|
static bool HandleKeyMessage(nsWindowBase* aWidget,
|
|
UINT aMsg,
|
|
WPARAM aWParam,
|
|
LPARAM aLParam);
|
|
|
|
static void UpdateZoomUntil();
|
|
static bool IsZooming();
|
|
|
|
static void Init();
|
|
|
|
static bool IsPinchHackNeeded() { return sUsePinchHack; }
|
|
|
|
|
|
private:
|
|
// Whether to enable the Elantech swipe gesture hack.
|
|
static bool sUseSwipeHack;
|
|
// Whether to enable the Elantech pinch-to-zoom gesture hack.
|
|
static bool sUsePinchHack;
|
|
static DWORD sZoomUntil;
|
|
}; // class Elantech
|
|
|
|
// Apoint is a touchpad driver of Alps.
|
|
class Apoint
|
|
{
|
|
public:
|
|
static bool IsDriverInstalled()
|
|
{
|
|
return sMajorVersion != 0;
|
|
}
|
|
/**
|
|
* GetDriverMajorVersion() returns the installed driver's major version.
|
|
* If Apoint driver isn't installed, this returns 0.
|
|
*/
|
|
static int32_t GetDriverMajorVersion()
|
|
{
|
|
return sMajorVersion;
|
|
}
|
|
/**
|
|
* GetDriverMinorVersion() returns the installed driver's minor version.
|
|
* If Apoint driver isn't installed, this returns -1.
|
|
*/
|
|
static int32_t GetDriverMinorVersion()
|
|
{
|
|
return sMinorVersion;
|
|
}
|
|
|
|
static void Init();
|
|
|
|
private:
|
|
static bool sInitialized;
|
|
static int32_t sMajorVersion;
|
|
static int32_t sMinorVersion;
|
|
};
|
|
|
|
class TrackPoint {
|
|
public:
|
|
/**
|
|
* IsDriverInstalled() returns TRUE if TrackPoint's driver is installed.
|
|
* Otherwise, returns FALSE.
|
|
*/
|
|
static bool IsDriverInstalled();
|
|
}; // class TrackPoint
|
|
|
|
class UltraNav {
|
|
public:
|
|
/**
|
|
* IsObsoleteDriverInstalled() checks whether obsoleted UltraNav
|
|
* is installed on the environment.
|
|
* Returns TRUE if it was installed. Otherwise, FALSE.
|
|
*/
|
|
static bool IsObsoleteDriverInstalled();
|
|
}; // class UltraNav
|
|
|
|
class SetPoint {
|
|
public:
|
|
/**
|
|
* SetPoint, Logitech's mouse driver, may report wrong cursor position
|
|
* for WM_MOUSEHWHEEL message. See comment in the implementation for
|
|
* the detail.
|
|
*/
|
|
static bool IsGetMessagePosResponseValid(UINT aMessage,
|
|
WPARAM aWParam,
|
|
LPARAM aLParam);
|
|
private:
|
|
static bool sMightBeUsing;
|
|
};
|
|
|
|
static void Init();
|
|
|
|
static bool IsFakeScrollableWindowNeeded()
|
|
{
|
|
return sFakeScrollableWindowNeeded;
|
|
}
|
|
|
|
private:
|
|
/**
|
|
* Gets the bool value of aPrefName used to enable or disable an input
|
|
* workaround (like the Trackpoint hack). The pref can take values 0 (for
|
|
* disabled), 1 (for enabled) or -1 (to automatically detect whether to
|
|
* enable the workaround).
|
|
*
|
|
* @param aPrefName The name of the pref.
|
|
* @param aValueIfAutomatic Whether the given input workaround should be
|
|
* enabled by default.
|
|
*/
|
|
static bool GetWorkaroundPref(const char* aPrefName,
|
|
bool aValueIfAutomatic);
|
|
|
|
static bool sFakeScrollableWindowNeeded;
|
|
}; // class Device
|
|
};
|
|
|
|
} // namespace widget
|
|
} // namespace mozilla
|
|
|
|
#endif // mozilla_widget_WinMouseScrollHandler_h__
|