/* -*- 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/. */
/** * See nsIWidget::SynthesizeNativeMouseScrollEvent() for the detail about * this method.
*/ static nsresult SynthesizeNativeMouseScrollEvent(
nsWindow* 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.
*/ staticbool IsWaitingInternalMessage() { return sInstance && sInstance->mIsWaitingInternalMessage;
}
/** * InitEvent() initializes the aEvent. If aPoint is null, the result of * GetCurrentMessagePos() will be used.
*/ staticvoid InitEvent(nsWindow* aWidget, WidgetGUIEvent& aEvent,
LPARAM* aPoint);
/** * 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(nsWindow* aWidget, UINT aMessage,
WPARAM aWParam, LPARAM aLParam);
/** * ProcessMessageDirectly() processes WM_MOUSEWHEEL, WM_MOUSEHWHEEL, * WM_VSCROLL, and WM_HSCROLL without posting a MOZ_WM_* 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.
*/ bool ProcessMessageDirectly(UINT msg, WPARAM wParam, LPARAM lParam,
MSGResult& aResult);
/** * 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(nsWindow* 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. * @return TRUE if the message is processed. Otherwise, FALSE.
*/ bool HandleMouseWheelMessage(nsWindow* 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. * @return TRUE if the message is processed. Otherwise, FALSE.
*/ bool HandleScrollMessageAsMouseWheelMessage(nsWindow* aWidget, UINT aMessage,
WPARAM aWParam, LPARAM aLParam);
/** * HandleScrollMessageAsScrollMessage() 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 does _not_ want them to emulate mouse * wheel message's behavior.
*/ bool HandleScrollMessageAsItself(nsWindow* aWidget, UINT aMessage,
WPARAM aWParam, LPARAM aLParam);
/** * ComputeMessagePos() computes the cursor position when the message was * added to the queue. * * @param aMessage Current message. * @param aWParam Current message's wParam. * @param aLParam Current 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);
/** * FindTargetWindow() finds the nsWindow which needs to process the current * scroll event. (This is the window underneath the cursor -- which is not * necessarily the window whose event queue it came in on!) * * @param aMessage Current message. * @param aWParam Current message's wParam. * @param aLParam Current message's lParam. * @return The relevant nsWindow, or nullptr if no appropriate * window could be identified.
*/
nsWindow* FindTargetWindow(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(nsWindow* aWidget, UINT aMessage, WPARAM aWParam, LPARAM aLParam);
// 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(nsWindow* aWidget, WidgetWheelEvent& aWheelEvent, const ModifierKeyState& aModKeyState, LPARAM aLParam);
// 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();
int32_t GetScrollAmount(bool aForVertical) const {
MOZ_ASSERT(mInitialized, "SystemSettings must be initialized"); return aForVertical ? mScrollLines : mScrollChars;
}
// 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; }
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();
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.
*/ staticbool IsHelperWindow(HWND aWnd);
/** * Key message handler for Elantech's hack. Returns TRUE if the message * is consumed by this handler. Otherwise, FALSE.
*/ staticbool HandleKeyMessage(nsWindow* aWidget, UINT aMsg, WPARAM aWParam,
LPARAM aLParam);
class TrackPoint { public: /** * IsDriverInstalled() returns TRUE if TrackPoint's driver is installed. * Otherwise, returns FALSE.
*/ staticbool IsDriverInstalled();
}; // class TrackPoint
class UltraNav { public: /** * IsObsoleteDriverInstalled() checks whether obsoleted UltraNav * is installed on the environment. * Returns TRUE if it was installed. Otherwise, FALSE.
*/ staticbool 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.
*/ staticbool IsGetMessagePosResponseValid(UINT aMessage, WPARAM aWParam,
LPARAM aLParam);
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.
*/ staticbool GetWorkaroundPref(constchar* aPrefName, bool aValueIfAutomatic);
staticbool sFakeScrollableWindowNeeded;
}; // class Device
};
} // namespace widget
} // namespace mozilla
#endif// mozilla_widget_WinMouseScrollHandler_h__
¤ Dauer der Verarbeitung: 0.39 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.