mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1146349 - Make the native event synthesization functions in DOMWindowUtils async. r=smaug
This commit is contained in:
parent
f68ebc75d0
commit
6ad67a2382
@ -1301,7 +1301,8 @@ nsDOMWindowUtils::SendNativeKeyEvent(int32_t aNativeKeyboardLayout,
|
||||
int32_t aNativeKeyCode,
|
||||
int32_t aModifiers,
|
||||
const nsAString& aCharacters,
|
||||
const nsAString& aUnmodifiedCharacters)
|
||||
const nsAString& aUnmodifiedCharacters,
|
||||
nsIObserver* aObserver)
|
||||
{
|
||||
MOZ_RELEASE_ASSERT(nsContentUtils::IsCallerChrome());
|
||||
|
||||
@ -1310,8 +1311,11 @@ nsDOMWindowUtils::SendNativeKeyEvent(int32_t aNativeKeyboardLayout,
|
||||
if (!widget)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
return widget->SynthesizeNativeKeyEvent(aNativeKeyboardLayout, aNativeKeyCode,
|
||||
aModifiers, aCharacters, aUnmodifiedCharacters);
|
||||
NS_DispatchToMainThread(NS_NewRunnableMethodWithArgs
|
||||
<int32_t, int32_t, uint32_t, nsString, nsString, nsIObserver*>
|
||||
(widget, &nsIWidget::SynthesizeNativeKeyEvent, aNativeKeyboardLayout,
|
||||
aNativeKeyCode, aModifiers, aCharacters, aUnmodifiedCharacters, aObserver));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -1319,7 +1323,8 @@ nsDOMWindowUtils::SendNativeMouseEvent(int32_t aScreenX,
|
||||
int32_t aScreenY,
|
||||
int32_t aNativeMessage,
|
||||
int32_t aModifierFlags,
|
||||
nsIDOMElement* aElement)
|
||||
nsIDOMElement* aElement,
|
||||
nsIObserver* aObserver)
|
||||
{
|
||||
MOZ_RELEASE_ASSERT(nsContentUtils::IsCallerChrome());
|
||||
|
||||
@ -1328,8 +1333,12 @@ nsDOMWindowUtils::SendNativeMouseEvent(int32_t aScreenX,
|
||||
if (!widget)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
return widget->SynthesizeNativeMouseEvent(LayoutDeviceIntPoint(aScreenX, aScreenY),
|
||||
aNativeMessage, aModifierFlags);
|
||||
NS_DispatchToMainThread(NS_NewRunnableMethodWithArgs
|
||||
<LayoutDeviceIntPoint, int32_t, int32_t, nsIObserver*>
|
||||
(widget, &nsIWidget::SynthesizeNativeMouseEvent,
|
||||
LayoutDeviceIntPoint(aScreenX, aScreenY), aNativeMessage, aModifierFlags,
|
||||
aObserver));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -1341,7 +1350,8 @@ nsDOMWindowUtils::SendNativeMouseScrollEvent(int32_t aScreenX,
|
||||
double aDeltaZ,
|
||||
uint32_t aModifierFlags,
|
||||
uint32_t aAdditionalFlags,
|
||||
nsIDOMElement* aElement)
|
||||
nsIDOMElement* aElement,
|
||||
nsIObserver* aObserver)
|
||||
{
|
||||
MOZ_RELEASE_ASSERT(nsContentUtils::IsCallerChrome());
|
||||
|
||||
@ -1351,12 +1361,12 @@ nsDOMWindowUtils::SendNativeMouseScrollEvent(int32_t aScreenX,
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
return widget->SynthesizeNativeMouseScrollEvent(LayoutDeviceIntPoint(aScreenX,
|
||||
aScreenY),
|
||||
aNativeMessage,
|
||||
aDeltaX, aDeltaY, aDeltaZ,
|
||||
aModifierFlags,
|
||||
aAdditionalFlags);
|
||||
NS_DispatchToMainThread(NS_NewRunnableMethodWithArgs
|
||||
<mozilla::LayoutDeviceIntPoint, uint32_t, double, double, double, uint32_t, uint32_t, nsIObserver*>
|
||||
(widget, &nsIWidget::SynthesizeNativeMouseScrollEvent,
|
||||
LayoutDeviceIntPoint(aScreenX, aScreenY), aNativeMessage, aDeltaX, aDeltaY,
|
||||
aDeltaZ, aModifierFlags, aAdditionalFlags, aObserver));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -1365,7 +1375,8 @@ nsDOMWindowUtils::SendNativeTouchPoint(uint32_t aPointerId,
|
||||
int32_t aScreenX,
|
||||
int32_t aScreenY,
|
||||
double aPressure,
|
||||
uint32_t aOrientation)
|
||||
uint32_t aOrientation,
|
||||
nsIObserver* aObserver)
|
||||
{
|
||||
MOZ_RELEASE_ASSERT(nsContentUtils::IsCallerChrome());
|
||||
|
||||
@ -1378,16 +1389,19 @@ nsDOMWindowUtils::SendNativeTouchPoint(uint32_t aPointerId,
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
return widget->SynthesizeNativeTouchPoint(aPointerId,
|
||||
(nsIWidget::TouchPointerState)aTouchState,
|
||||
nsIntPoint(aScreenX, aScreenY),
|
||||
aPressure, aOrientation);
|
||||
NS_DispatchToMainThread(NS_NewRunnableMethodWithArgs
|
||||
<uint32_t, nsIWidget::TouchPointerState, nsIntPoint, double, uint32_t, nsIObserver*>
|
||||
(widget, &nsIWidget::SynthesizeNativeTouchPoint, aPointerId,
|
||||
(nsIWidget::TouchPointerState)aTouchState, nsIntPoint(aScreenX, aScreenY),
|
||||
aPressure, aOrientation, aObserver));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMWindowUtils::SendNativeTouchTap(int32_t aScreenX,
|
||||
int32_t aScreenY,
|
||||
bool aLongTap)
|
||||
bool aLongTap,
|
||||
nsIObserver* aObserver)
|
||||
{
|
||||
MOZ_RELEASE_ASSERT(nsContentUtils::IsCallerChrome());
|
||||
|
||||
@ -1395,11 +1409,16 @@ nsDOMWindowUtils::SendNativeTouchTap(int32_t aScreenX,
|
||||
if (!widget) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
return widget->SynthesizeNativeTouchTap(nsIntPoint(aScreenX, aScreenY), aLongTap);
|
||||
|
||||
NS_DispatchToMainThread(NS_NewRunnableMethodWithArgs
|
||||
<nsIntPoint, bool, nsIObserver*>
|
||||
(widget, &nsIWidget::SynthesizeNativeTouchTap,
|
||||
nsIntPoint(aScreenX, aScreenY), aLongTap, aObserver));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMWindowUtils::ClearNativeTouchSequence()
|
||||
nsDOMWindowUtils::ClearNativeTouchSequence(nsIObserver* aObserver)
|
||||
{
|
||||
MOZ_RELEASE_ASSERT(nsContentUtils::IsCallerChrome());
|
||||
|
||||
@ -1407,7 +1426,10 @@ nsDOMWindowUtils::ClearNativeTouchSequence()
|
||||
if (!widget) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
return widget->ClearNativeTouchSequence();
|
||||
|
||||
NS_DispatchToMainThread(NS_NewRunnableMethodWithArgs<nsIObserver*>
|
||||
(widget, &nsIWidget::ClearNativeTouchSequence, aObserver));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -4088,7 +4088,7 @@ EventStateManager::GenerateMouseEnterExit(WidgetMouseEvent* aMouseEvent)
|
||||
// in the other branch here.
|
||||
sSynthCenteringPoint = center;
|
||||
aMouseEvent->widget->SynthesizeNativeMouseMove(
|
||||
center + aMouseEvent->widget->WidgetToScreenOffset());
|
||||
center + aMouseEvent->widget->WidgetToScreenOffset(), nullptr);
|
||||
} else if (aMouseEvent->refPoint == sSynthCenteringPoint) {
|
||||
// This is the "synthetic native" event we dispatched to re-center the
|
||||
// pointer. Cancel it so we don't expose the centering move to content.
|
||||
@ -4223,7 +4223,8 @@ EventStateManager::SetPointerLock(nsIWidget* aWidget,
|
||||
sLastRefPoint = GetWindowInnerRectCenter(aElement->OwnerDoc()->GetWindow(),
|
||||
aWidget,
|
||||
mPresContext);
|
||||
aWidget->SynthesizeNativeMouseMove(sLastRefPoint + aWidget->WidgetToScreenOffset());
|
||||
aWidget->SynthesizeNativeMouseMove(sLastRefPoint + aWidget->WidgetToScreenOffset(),
|
||||
nullptr);
|
||||
|
||||
// Retarget all events to this element via capture.
|
||||
nsIPresShell::SetCapturingContent(aElement, CAPTURE_POINTERLOCK);
|
||||
@ -4238,7 +4239,8 @@ EventStateManager::SetPointerLock(nsIWidget* aWidget,
|
||||
// pre-pointerlock position, so that the synthetic mouse event reports
|
||||
// no movement.
|
||||
sLastRefPoint = mPreLockPoint;
|
||||
aWidget->SynthesizeNativeMouseMove(mPreLockPoint + aWidget->WidgetToScreenOffset());
|
||||
aWidget->SynthesizeNativeMouseMove(mPreLockPoint + aWidget->WidgetToScreenOffset(),
|
||||
nullptr);
|
||||
|
||||
// Don't retarget events to this element any more.
|
||||
nsIPresShell::SetCapturingContent(nullptr, CAPTURE_POINTERLOCK);
|
||||
|
@ -49,8 +49,9 @@ interface nsIRunnable;
|
||||
interface nsITranslationNodeList;
|
||||
interface nsIJSRAIIHelper;
|
||||
interface nsIContentPermissionRequest;
|
||||
interface nsIObserver;
|
||||
|
||||
[scriptable, uuid(7f2f44ab-2857-4cc2-8c9d-3d9816f5a4d6)]
|
||||
[scriptable, uuid(7ecfd6e7-120a-4567-85f7-14277f4c6d9f)]
|
||||
interface nsIDOMWindowUtils : nsISupports {
|
||||
|
||||
/**
|
||||
@ -571,12 +572,17 @@ interface nsIDOMWindowUtils : nsISupports {
|
||||
* Will throw a DOM security error if called without chrome privileges.
|
||||
*
|
||||
* When you use this for tests, use the constants defined in NativeKeyCodes.js
|
||||
*
|
||||
* NOTE: The synthesized native event will be fired asynchronously, and upon
|
||||
* completion the observer, if provided, will be notified with a "keyevent"
|
||||
* topic.
|
||||
*/
|
||||
void sendNativeKeyEvent(in long aNativeKeyboardLayout,
|
||||
in long aNativeKeyCode,
|
||||
in long aModifierFlags,
|
||||
in AString aCharacters,
|
||||
in AString aUnmodifiedCharacters);
|
||||
in AString aUnmodifiedCharacters,
|
||||
[optional] in nsIObserver aObserver);
|
||||
|
||||
/**
|
||||
* See nsIWidget::SynthesizeNativeMouseEvent
|
||||
@ -584,12 +590,17 @@ interface nsIDOMWindowUtils : nsISupports {
|
||||
* Will be called on the widget that contains aElement.
|
||||
* Cannot be accessed from unprivileged context (not content-accessible)
|
||||
* Will throw a DOM security error if called without chrome privileges.
|
||||
*
|
||||
* NOTE: The synthesized native event will be fired asynchronously, and upon
|
||||
* completion the observer, if provided, will be notified with a "mouseevent"
|
||||
* topic.
|
||||
*/
|
||||
void sendNativeMouseEvent(in long aScreenX,
|
||||
in long aScreenY,
|
||||
in long aNativeMessage,
|
||||
in long aModifierFlags,
|
||||
in nsIDOMElement aElement);
|
||||
in nsIDOMElement aElement,
|
||||
[optional] in nsIObserver aObserver);
|
||||
|
||||
/**
|
||||
* The values for sendNativeMouseScrollEvent's aAdditionalFlags.
|
||||
@ -620,7 +631,9 @@ interface nsIDOMWindowUtils : nsISupports {
|
||||
* Cannot be accessed from unprivileged context (not content-accessible)
|
||||
* Will throw a DOM security error if called without chrome privileges.
|
||||
*
|
||||
* NOTE: The synthesized native event may be fired asynchronously.
|
||||
* NOTE: The synthesized native event will be fired asynchronously, and upon
|
||||
* completion the observer, if provided, will be notified with a
|
||||
* "mousescrollevent" topic.
|
||||
*
|
||||
* @param aNativeMessage
|
||||
* On Windows: WM_MOUSEWHEEL (0x020A), WM_MOUSEHWHEEL(0x020E),
|
||||
@ -634,7 +647,8 @@ interface nsIDOMWindowUtils : nsISupports {
|
||||
in double aDeltaZ,
|
||||
in unsigned long aModifierFlags,
|
||||
in unsigned long aAdditionalFlags,
|
||||
in nsIDOMElement aElement);
|
||||
in nsIDOMElement aElement,
|
||||
[optional] in nsIObserver aObserver);
|
||||
|
||||
/**
|
||||
* Touch states for sendNativeTouchPoint. These values match
|
||||
@ -665,6 +679,10 @@ interface nsIDOMWindowUtils : nsISupports {
|
||||
* Widget support: Windows 8.0+, Winrt/Win32. Gonk supports CONTACT, REMOVE,
|
||||
* and CANCEL but no HOVER. Other widgets will throw.
|
||||
*
|
||||
* NOTE: The synthesized native event will be fired asynchronously, and upon
|
||||
* completion the observer, if provided, will be notified with a "touchpoint"
|
||||
* topic.
|
||||
*
|
||||
* @param aPointerId The touch point id to create or update.
|
||||
* @param aTouchState one or more of the touch states listed above
|
||||
* @param aScreenX, aScreenY screen coords of this event
|
||||
@ -677,7 +695,8 @@ interface nsIDOMWindowUtils : nsISupports {
|
||||
in long aScreenX,
|
||||
in long aScreenY,
|
||||
in double aPressure,
|
||||
in unsigned long aOrientation);
|
||||
in unsigned long aOrientation,
|
||||
[optional] in nsIObserver aObserver);
|
||||
|
||||
/**
|
||||
* Simulates native touch based taps on the input digitizer. Events
|
||||
@ -694,13 +713,18 @@ interface nsIDOMWindowUtils : nsISupports {
|
||||
* Widget support: Windows 8.0+, Winrt/Win32. Other widgets will
|
||||
* throw.
|
||||
*
|
||||
* NOTE: The synthesized native event will be fired asynchronously, and upon
|
||||
* completion the observer, if provided, will be notified, with a "touchtap"
|
||||
* topic.
|
||||
*
|
||||
* @param aScreenX, aScreenY screen coords of this event
|
||||
* @param aLongTap true if the tap should be long, false for a short
|
||||
* tap.
|
||||
*/
|
||||
void sendNativeTouchTap(in long aScreenX,
|
||||
in long aScreenY,
|
||||
in boolean aLongTap);
|
||||
in boolean aLongTap,
|
||||
[optional] in nsIObserver aObserver);
|
||||
|
||||
/**
|
||||
* Cancel any existing touch points or long tap delays. Calling this is safe
|
||||
@ -708,8 +732,12 @@ interface nsIDOMWindowUtils : nsISupports {
|
||||
* this when tests shut down to reset the digitizer driver. Not doing so can
|
||||
* leave the digitizer in an undetermined state which can screw up subsequent
|
||||
* tests and native input.
|
||||
*
|
||||
* NOTE: The synthesized native event will be fired asynchronously, and upon
|
||||
* completion the observer, if provided, will be notified with a "cleartouch"
|
||||
* topic.
|
||||
*/
|
||||
void clearNativeTouchSequence();
|
||||
void clearNativeTouchSequence([optional] in nsIObserver aObserver);
|
||||
|
||||
/**
|
||||
* See nsIWidget::ActivateNativeMenuItemAt
|
||||
|
@ -2254,7 +2254,7 @@ TabParent::RecvSynthesizeNativeMouseMove(const mozilla::LayoutDeviceIntPoint& aP
|
||||
// The widget associated with the browser window
|
||||
nsCOMPtr<nsIWidget> widget = GetWidget();
|
||||
if (widget) {
|
||||
widget->SynthesizeNativeMouseMove(aPoint);
|
||||
widget->SynthesizeNativeMouseMove(aPoint, nullptr);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -855,8 +855,10 @@ PuppetWidget::SetCursor(nsCursor aCursor)
|
||||
}
|
||||
|
||||
nsresult
|
||||
PuppetWidget::SynthesizeNativeMouseMove(mozilla::LayoutDeviceIntPoint aPoint)
|
||||
PuppetWidget::SynthesizeNativeMouseMove(mozilla::LayoutDeviceIntPoint aPoint,
|
||||
nsIObserver* aObserver)
|
||||
{
|
||||
//XXX Do something wtih aObserver (will happen in a later patch)
|
||||
if (mTabChild &&
|
||||
!mTabChild->SendSynthesizeNativeMouseMove(aPoint)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
|
@ -133,7 +133,8 @@ public:
|
||||
// Synthesized mouse events we need to forwarded to chrome. Event
|
||||
// state manager uses this api to position the mouse in the center
|
||||
// of the window for pointer lock.
|
||||
virtual nsresult SynthesizeNativeMouseMove(mozilla::LayoutDeviceIntPoint aPoint) override;
|
||||
virtual nsresult SynthesizeNativeMouseMove(mozilla::LayoutDeviceIntPoint aPoint,
|
||||
nsIObserver* aObserver) override;
|
||||
|
||||
void InitEvent(WidgetGUIEvent& aEvent, nsIntPoint* aPoint = nullptr);
|
||||
|
||||
|
@ -456,14 +456,17 @@ public:
|
||||
int32_t aNativeKeyCode,
|
||||
uint32_t aModifierFlags,
|
||||
const nsAString& aCharacters,
|
||||
const nsAString& aUnmodifiedCharacters) override;
|
||||
const nsAString& aUnmodifiedCharacters,
|
||||
nsIObserver* aObserver) override;
|
||||
|
||||
virtual nsresult SynthesizeNativeMouseEvent(mozilla::LayoutDeviceIntPoint aPoint,
|
||||
uint32_t aNativeMessage,
|
||||
uint32_t aModifierFlags) override;
|
||||
uint32_t aModifierFlags,
|
||||
nsIObserver* aObserver) override;
|
||||
|
||||
virtual nsresult SynthesizeNativeMouseMove(mozilla::LayoutDeviceIntPoint aPoint) override
|
||||
{ return SynthesizeNativeMouseEvent(aPoint, NSMouseMoved, 0); }
|
||||
virtual nsresult SynthesizeNativeMouseMove(mozilla::LayoutDeviceIntPoint aPoint,
|
||||
nsIObserver* aObserver) override
|
||||
{ return SynthesizeNativeMouseEvent(aPoint, NSMouseMoved, 0, aObserver); }
|
||||
|
||||
// Mac specific methods
|
||||
|
||||
|
@ -1116,8 +1116,10 @@ nsresult nsChildView::SynthesizeNativeKeyEvent(int32_t aNativeKeyboardLayout,
|
||||
int32_t aNativeKeyCode,
|
||||
uint32_t aModifierFlags,
|
||||
const nsAString& aCharacters,
|
||||
const nsAString& aUnmodifiedCharacters)
|
||||
const nsAString& aUnmodifiedCharacters,
|
||||
nsIObserver* aObserver)
|
||||
{
|
||||
AutoObserverNotifier notifier(aObserver, "keyevent");
|
||||
return mTextInputHandler->SynthesizeNativeKeyEvent(aNativeKeyboardLayout,
|
||||
aNativeKeyCode,
|
||||
aModifierFlags,
|
||||
@ -1127,10 +1129,13 @@ nsresult nsChildView::SynthesizeNativeKeyEvent(int32_t aNativeKeyboardLayout,
|
||||
|
||||
nsresult nsChildView::SynthesizeNativeMouseEvent(LayoutDeviceIntPoint aPoint,
|
||||
uint32_t aNativeMessage,
|
||||
uint32_t aModifierFlags)
|
||||
uint32_t aModifierFlags,
|
||||
nsIObserver* aObserver)
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
|
||||
|
||||
AutoObserverNotifier notifier(aObserver, "mouseevent");
|
||||
|
||||
NSPoint pt =
|
||||
nsCocoaUtils::DevPixelsToCocoaPoints(aPoint, BackingScaleFactor());
|
||||
|
||||
|
@ -328,7 +328,8 @@ public:
|
||||
virtual void UpdateThemeGeometries(const nsTArray<ThemeGeometry>& aThemeGeometries) override;
|
||||
virtual nsresult SynthesizeNativeMouseEvent(mozilla::LayoutDeviceIntPoint aPoint,
|
||||
uint32_t aNativeMessage,
|
||||
uint32_t aModifierFlags) override;
|
||||
uint32_t aModifierFlags,
|
||||
nsIObserver* aObserver) override;
|
||||
|
||||
void DispatchSizeModeEvent();
|
||||
|
||||
|
@ -2072,13 +2072,15 @@ void nsCocoaWindow::SetDrawsInTitlebar(bool aState)
|
||||
|
||||
NS_IMETHODIMP nsCocoaWindow::SynthesizeNativeMouseEvent(LayoutDeviceIntPoint aPoint,
|
||||
uint32_t aNativeMessage,
|
||||
uint32_t aModifierFlags)
|
||||
uint32_t aModifierFlags,
|
||||
nsIObserver* aObserver)
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
|
||||
|
||||
AutoObserverNotifier notifier(aObserver, "mouseevent");
|
||||
if (mPopupContentView)
|
||||
return mPopupContentView->SynthesizeNativeMouseEvent(aPoint, aNativeMessage,
|
||||
aModifierFlags);
|
||||
aModifierFlags, nullptr);
|
||||
|
||||
return NS_OK;
|
||||
|
||||
|
@ -357,8 +357,11 @@ nsWindow::SynthesizeNativeTouchPoint(uint32_t aPointerId,
|
||||
TouchPointerState aPointerState,
|
||||
nsIntPoint aPointerScreenPoint,
|
||||
double aPointerPressure,
|
||||
uint32_t aPointerOrientation)
|
||||
uint32_t aPointerOrientation,
|
||||
nsIObserver* aObserver)
|
||||
{
|
||||
AutoObserverNotifier notifier(aObserver, "touchpoint");
|
||||
|
||||
if (aPointerState == TOUCH_HOVER) {
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
@ -98,7 +98,8 @@ public:
|
||||
TouchPointerState aPointerState,
|
||||
nsIntPoint aPointerScreenPoint,
|
||||
double aPointerPressure,
|
||||
uint32_t aPointerOrientation) override;
|
||||
uint32_t aPointerOrientation,
|
||||
nsIObserver* aObserver) override;
|
||||
|
||||
NS_IMETHOD CaptureRollupEvents(nsIRollupListener *aListener,
|
||||
bool aDoCapture)
|
||||
|
@ -6555,8 +6555,11 @@ nsWindow::GdkRectToDevicePixels(GdkRectangle rect) {
|
||||
nsresult
|
||||
nsWindow::SynthesizeNativeMouseEvent(LayoutDeviceIntPoint aPoint,
|
||||
uint32_t aNativeMessage,
|
||||
uint32_t aModifierFlags)
|
||||
uint32_t aModifierFlags,
|
||||
nsIObserver* aObserver)
|
||||
{
|
||||
AutoObserverNotifier notifier(aObserver, "mouseevent");
|
||||
|
||||
if (!mGdkWindow) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -300,10 +300,12 @@ public:
|
||||
|
||||
virtual nsresult SynthesizeNativeMouseEvent(mozilla::LayoutDeviceIntPoint aPoint,
|
||||
uint32_t aNativeMessage,
|
||||
uint32_t aModifierFlags) override;
|
||||
uint32_t aModifierFlags,
|
||||
nsIObserver* aObserver) override;
|
||||
|
||||
virtual nsresult SynthesizeNativeMouseMove(mozilla::LayoutDeviceIntPoint aPoint) override
|
||||
{ return SynthesizeNativeMouseEvent(aPoint, GDK_MOTION_NOTIFY, 0); }
|
||||
virtual nsresult SynthesizeNativeMouseMove(mozilla::LayoutDeviceIntPoint aPoint,
|
||||
nsIObserver* aObserver) override
|
||||
{ return SynthesizeNativeMouseEvent(aPoint, GDK_MOTION_NOTIFY, 0, aObserver); }
|
||||
|
||||
protected:
|
||||
virtual ~nsWindow();
|
||||
|
@ -1706,22 +1706,25 @@ nsBaseWidget::GetRootAccessible()
|
||||
#endif // ACCESSIBILITY
|
||||
|
||||
nsresult
|
||||
nsIWidget::SynthesizeNativeTouchTap(nsIntPoint aPointerScreenPoint, bool aLongTap)
|
||||
nsIWidget::SynthesizeNativeTouchTap(nsIntPoint aPointerScreenPoint, bool aLongTap,
|
||||
nsIObserver* aObserver)
|
||||
{
|
||||
AutoObserverNotifier notifier(aObserver, "touchtap");
|
||||
|
||||
if (sPointerIdCounter > TOUCH_INJECT_MAX_POINTS) {
|
||||
sPointerIdCounter = 0;
|
||||
}
|
||||
int pointerId = sPointerIdCounter;
|
||||
sPointerIdCounter++;
|
||||
nsresult rv = SynthesizeNativeTouchPoint(pointerId, TOUCH_CONTACT,
|
||||
aPointerScreenPoint, 1.0, 90);
|
||||
aPointerScreenPoint, 1.0, 90, nullptr);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
if (!aLongTap) {
|
||||
nsresult rv = SynthesizeNativeTouchPoint(pointerId, TOUCH_REMOVE,
|
||||
aPointerScreenPoint, 0, 0);
|
||||
aPointerScreenPoint, 0, 0, nullptr);
|
||||
return rv;
|
||||
}
|
||||
|
||||
@ -1732,7 +1735,7 @@ nsIWidget::SynthesizeNativeTouchTap(nsIntPoint aPointerScreenPoint, bool aLongTa
|
||||
mLongTapTimer = do_CreateInstance(NS_TIMER_CONTRACTID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
SynthesizeNativeTouchPoint(pointerId, TOUCH_CANCEL,
|
||||
aPointerScreenPoint, 0, 0);
|
||||
aPointerScreenPoint, 0, 0, nullptr);
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
// Windows requires recuring events, so we set this to a smaller window
|
||||
@ -1750,11 +1753,13 @@ nsIWidget::SynthesizeNativeTouchTap(nsIntPoint aPointerScreenPoint, bool aLongTa
|
||||
// tap to be active at a time.
|
||||
if (mLongTapTouchPoint) {
|
||||
SynthesizeNativeTouchPoint(mLongTapTouchPoint->mPointerId, TOUCH_CANCEL,
|
||||
mLongTapTouchPoint->mPosition, 0, 0);
|
||||
mLongTapTouchPoint->mPosition, 0, 0, nullptr);
|
||||
}
|
||||
|
||||
mLongTapTouchPoint = new LongTapInfo(pointerId, aPointerScreenPoint,
|
||||
TimeDuration::FromMilliseconds(elapse));
|
||||
TimeDuration::FromMilliseconds(elapse),
|
||||
aObserver);
|
||||
notifier.SkipNotification(); // we'll do it in the long-tap callback
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -1772,31 +1777,35 @@ nsIWidget::OnLongTapTimerCallback(nsITimer* aTimer, void* aClosure)
|
||||
self->SynthesizeNativeTouchPoint(self->mLongTapTouchPoint->mPointerId,
|
||||
TOUCH_CONTACT,
|
||||
self->mLongTapTouchPoint->mPosition,
|
||||
1.0, 90);
|
||||
1.0, 90, nullptr);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
AutoObserverNotifier notiifer(self->mLongTapTouchPoint->mObserver, "touchtap");
|
||||
|
||||
// finished, remove the touch point
|
||||
self->mLongTapTimer->Cancel();
|
||||
self->mLongTapTimer = nullptr;
|
||||
self->SynthesizeNativeTouchPoint(self->mLongTapTouchPoint->mPointerId,
|
||||
TOUCH_REMOVE,
|
||||
self->mLongTapTouchPoint->mPosition,
|
||||
0, 0);
|
||||
0, 0, nullptr);
|
||||
self->mLongTapTouchPoint = nullptr;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsIWidget::ClearNativeTouchSequence()
|
||||
nsIWidget::ClearNativeTouchSequence(nsIObserver* aObserver)
|
||||
{
|
||||
AutoObserverNotifier notifier(aObserver, "cleartouch");
|
||||
|
||||
if (!mLongTapTimer) {
|
||||
return NS_OK;
|
||||
}
|
||||
mLongTapTimer->Cancel();
|
||||
mLongTapTimer = nullptr;
|
||||
SynthesizeNativeTouchPoint(mLongTapTouchPoint->mPointerId, TOUCH_CANCEL,
|
||||
mLongTapTouchPoint->mPosition, 0, 0);
|
||||
mLongTapTouchPoint->mPosition, 0, 0, nullptr);
|
||||
mLongTapTouchPoint = nullptr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -353,16 +353,28 @@ protected:
|
||||
int32_t aNativeKeyCode,
|
||||
uint32_t aModifierFlags,
|
||||
const nsAString& aCharacters,
|
||||
const nsAString& aUnmodifiedCharacters) override
|
||||
{ return NS_ERROR_UNEXPECTED; }
|
||||
const nsAString& aUnmodifiedCharacters,
|
||||
nsIObserver* aObserver) override
|
||||
{
|
||||
mozilla::widget::AutoObserverNotifier notifier(aObserver, "keyevent");
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
virtual nsresult SynthesizeNativeMouseEvent(mozilla::LayoutDeviceIntPoint aPoint,
|
||||
uint32_t aNativeMessage,
|
||||
uint32_t aModifierFlags) override
|
||||
{ return NS_ERROR_UNEXPECTED; }
|
||||
uint32_t aModifierFlags,
|
||||
nsIObserver* aObserver) override
|
||||
{
|
||||
mozilla::widget::AutoObserverNotifier notifier(aObserver, "mouseevent");
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
virtual nsresult SynthesizeNativeMouseMove(mozilla::LayoutDeviceIntPoint aPoint) override
|
||||
{ return NS_ERROR_UNEXPECTED; }
|
||||
virtual nsresult SynthesizeNativeMouseMove(mozilla::LayoutDeviceIntPoint aPoint,
|
||||
nsIObserver* aObserver) override
|
||||
{
|
||||
mozilla::widget::AutoObserverNotifier notifier(aObserver, "mouseevent");
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
virtual nsresult SynthesizeNativeMouseScrollEvent(mozilla::LayoutDeviceIntPoint aPoint,
|
||||
uint32_t aNativeMessage,
|
||||
@ -370,15 +382,23 @@ protected:
|
||||
double aDeltaY,
|
||||
double aDeltaZ,
|
||||
uint32_t aModifierFlags,
|
||||
uint32_t aAdditionalFlags) override
|
||||
{ return NS_ERROR_UNEXPECTED; }
|
||||
uint32_t aAdditionalFlags,
|
||||
nsIObserver* aObserver) override
|
||||
{
|
||||
mozilla::widget::AutoObserverNotifier notifier(aObserver, "mousescrollevent");
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
virtual nsresult SynthesizeNativeTouchPoint(uint32_t aPointerId,
|
||||
TouchPointerState aPointerState,
|
||||
nsIntPoint aPointerScreenPoint,
|
||||
double aPointerPressure,
|
||||
uint32_t aPointerOrientation) override
|
||||
{ return NS_ERROR_UNEXPECTED; }
|
||||
uint32_t aPointerOrientation,
|
||||
nsIObserver* aObserver) override
|
||||
{
|
||||
mozilla::widget::AutoObserverNotifier notifier(aObserver, "touchpoint");
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
virtual nsresult NotifyIMEInternal(const IMENotification& aIMENotification)
|
||||
{ return NS_ERROR_NOT_IMPLEMENTED; }
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include "mozilla/RefPtr.h"
|
||||
#include "mozilla/TimeStamp.h"
|
||||
#include "mozilla/gfx/Point.h"
|
||||
#include "nsIObserver.h"
|
||||
#include "Units.h"
|
||||
|
||||
// forward declarations
|
||||
@ -713,6 +714,31 @@ struct IMENotification
|
||||
}
|
||||
};
|
||||
|
||||
struct AutoObserverNotifier {
|
||||
AutoObserverNotifier(nsIObserver* aObserver,
|
||||
const char* aTopic)
|
||||
: mObserver(aObserver)
|
||||
, mTopic(aTopic)
|
||||
{
|
||||
}
|
||||
|
||||
void SkipNotification()
|
||||
{
|
||||
mObserver = nullptr;
|
||||
}
|
||||
|
||||
~AutoObserverNotifier()
|
||||
{
|
||||
if (mObserver) {
|
||||
mObserver->Observe(nullptr, mTopic, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
nsCOMPtr<nsIObserver> mObserver;
|
||||
const char* mTopic;
|
||||
};
|
||||
|
||||
} // namespace widget
|
||||
} // namespace mozilla
|
||||
|
||||
@ -764,7 +790,7 @@ class nsIWidget : public nsISupports {
|
||||
, mZIndex(0)
|
||||
|
||||
{
|
||||
ClearNativeTouchSequence();
|
||||
ClearNativeTouchSequence(nullptr);
|
||||
}
|
||||
|
||||
|
||||
@ -1852,6 +1878,8 @@ class nsIWidget : public nsISupports {
|
||||
* @param aUnmodifiedCharacters characters that the OS would decide
|
||||
* to generate from the event if modifier keys (other than shift)
|
||||
* were assumed inactive. Needed on Mac, ignored on Windows.
|
||||
* @param aObserver the observer that will get notified once the events
|
||||
* have been dispatched.
|
||||
* @return NS_ERROR_NOT_AVAILABLE to indicate that the keyboard
|
||||
* layout is not supported and the event was not fired
|
||||
*/
|
||||
@ -1859,7 +1887,8 @@ class nsIWidget : public nsISupports {
|
||||
int32_t aNativeKeyCode,
|
||||
uint32_t aModifierFlags,
|
||||
const nsAString& aCharacters,
|
||||
const nsAString& aUnmodifiedCharacters) = 0;
|
||||
const nsAString& aUnmodifiedCharacters,
|
||||
nsIObserver* aObserver) = 0;
|
||||
|
||||
/**
|
||||
* Utility method intended for testing. Dispatches native mouse events
|
||||
@ -1874,16 +1903,22 @@ class nsIWidget : public nsISupports {
|
||||
* NSMouseMoved; on Windows, MOUSEEVENTF_MOVE, MOUSEEVENTF_LEFTDOWN etc)
|
||||
* @param aModifierFlags *platform-specific* modifier flags (ignored
|
||||
* on Windows)
|
||||
* @param aObserver the observer that will get notified once the events
|
||||
* have been dispatched.
|
||||
*/
|
||||
virtual nsresult SynthesizeNativeMouseEvent(mozilla::LayoutDeviceIntPoint aPoint,
|
||||
uint32_t aNativeMessage,
|
||||
uint32_t aModifierFlags) = 0;
|
||||
uint32_t aModifierFlags,
|
||||
nsIObserver* aObserver) = 0;
|
||||
|
||||
/**
|
||||
* A shortcut to SynthesizeNativeMouseEvent, abstracting away the native message.
|
||||
* aPoint is location in device pixels to which the mouse pointer moves to.
|
||||
* @param aObserver the observer that will get notified once the events
|
||||
* have been dispatched.
|
||||
*/
|
||||
virtual nsresult SynthesizeNativeMouseMove(mozilla::LayoutDeviceIntPoint aPoint) = 0;
|
||||
virtual nsresult SynthesizeNativeMouseMove(mozilla::LayoutDeviceIntPoint aPoint,
|
||||
nsIObserver* aObserver) = 0;
|
||||
|
||||
/**
|
||||
* Utility method intended for testing. Dispatching native mouse scroll
|
||||
@ -1905,6 +1940,8 @@ class nsIWidget : public nsISupports {
|
||||
* @param aModifierFlags Must be values of Modifiers, or zero.
|
||||
* @param aAdditionalFlags See nsIDOMWidnowUtils' consts and their
|
||||
* document.
|
||||
* @param aObserver The observer that will get notified once the
|
||||
* events have been dispatched.
|
||||
*/
|
||||
virtual nsresult SynthesizeNativeMouseScrollEvent(mozilla::LayoutDeviceIntPoint aPoint,
|
||||
uint32_t aNativeMessage,
|
||||
@ -1912,7 +1949,8 @@ class nsIWidget : public nsISupports {
|
||||
double aDeltaY,
|
||||
double aDeltaZ,
|
||||
uint32_t aModifierFlags,
|
||||
uint32_t aAdditionalFlags) = 0;
|
||||
uint32_t aAdditionalFlags,
|
||||
nsIObserver* aObserver) = 0;
|
||||
|
||||
/*
|
||||
* TouchPointerState states for SynthesizeNativeTouchPoint. Match
|
||||
@ -1944,38 +1982,48 @@ class nsIWidget : public nsISupports {
|
||||
* @param aPressure 0.0 -> 1.0 float val indicating pressure
|
||||
* @param aOrientation 0 -> 359 degree value indicating the
|
||||
* orientation of the pointer. Use 90 for normal taps.
|
||||
* @param aObserver The observer that will get notified once the events
|
||||
* have been dispatched.
|
||||
*/
|
||||
virtual nsresult SynthesizeNativeTouchPoint(uint32_t aPointerId,
|
||||
TouchPointerState aPointerState,
|
||||
nsIntPoint aPointerScreenPoint,
|
||||
double aPointerPressure,
|
||||
uint32_t aPointerOrientation) = 0;
|
||||
|
||||
/*
|
||||
* Cancels all active simulated touch input points and pending long taps.
|
||||
* Native widgets should track existing points such that they can clear the
|
||||
* digitizer state when this call is made.
|
||||
*/
|
||||
virtual nsresult ClearNativeTouchSequence();
|
||||
uint32_t aPointerOrientation,
|
||||
nsIObserver* aObserver) = 0;
|
||||
|
||||
/*
|
||||
* Helper for simulating a simple tap event with one touch point. When
|
||||
* aLongTap is true, simulates a native long tap with a duration equal to
|
||||
* ui.click_hold_context_menus.delay. This pref is compatible with the
|
||||
* apzc long tap duration. Defaults to 1.5 seconds.
|
||||
* @param aObserver The observer that will get notified once the events
|
||||
* have been dispatched.
|
||||
*/
|
||||
nsresult SynthesizeNativeTouchTap(nsIntPoint aPointerScreenPoint,
|
||||
bool aLongTap);
|
||||
bool aLongTap,
|
||||
nsIObserver* aObserver);
|
||||
|
||||
/*
|
||||
* Cancels all active simulated touch input points and pending long taps.
|
||||
* Native widgets should track existing points such that they can clear the
|
||||
* digitizer state when this call is made.
|
||||
* @param aObserver The observer that will get notified once the touch
|
||||
* sequence has been cleared.
|
||||
*/
|
||||
virtual nsresult ClearNativeTouchSequence(nsIObserver* aObserver);
|
||||
|
||||
private:
|
||||
class LongTapInfo
|
||||
{
|
||||
public:
|
||||
LongTapInfo(int32_t aPointerId, nsIntPoint& aPoint,
|
||||
mozilla::TimeDuration aDuration) :
|
||||
mozilla::TimeDuration aDuration,
|
||||
nsIObserver* aObserver) :
|
||||
mPointerId(aPointerId),
|
||||
mPosition(aPoint),
|
||||
mDuration(aDuration),
|
||||
mObserver(aObserver),
|
||||
mStamp(mozilla::TimeStamp::Now())
|
||||
{
|
||||
}
|
||||
@ -1983,6 +2031,7 @@ private:
|
||||
int32_t mPointerId;
|
||||
nsIntPoint mPosition;
|
||||
mozilla::TimeDuration mDuration;
|
||||
nsCOMPtr<nsIObserver> mObserver;
|
||||
mozilla::TimeStamp mStamp;
|
||||
};
|
||||
|
||||
|
@ -253,7 +253,7 @@ public:
|
||||
int32_t keyCode = 0x41; // VK_A
|
||||
NS_NAMED_LITERAL_STRING(a, "a");
|
||||
|
||||
if (NS_FAILED(utils->SendNativeKeyEvent(layout, keyCode, 0, a, a))) {
|
||||
if (NS_FAILED(utils->SendNativeKeyEvent(layout, keyCode, 0, a, a, nullptr))) {
|
||||
fail("Failed to synthesize native event");
|
||||
}
|
||||
|
||||
|
@ -5788,8 +5788,11 @@ nsWindow::SynthesizeNativeKeyEvent(int32_t aNativeKeyboardLayout,
|
||||
int32_t aNativeKeyCode,
|
||||
uint32_t aModifierFlags,
|
||||
const nsAString& aCharacters,
|
||||
const nsAString& aUnmodifiedCharacters)
|
||||
const nsAString& aUnmodifiedCharacters,
|
||||
nsIObserver* aObserver)
|
||||
{
|
||||
AutoObserverNotifier notifier(aObserver, "keyevent");
|
||||
|
||||
KeyboardLayout* keyboardLayout = KeyboardLayout::GetInstance();
|
||||
return keyboardLayout->SynthesizeNativeKeyEvent(
|
||||
this, aNativeKeyboardLayout, aNativeKeyCode, aModifierFlags,
|
||||
@ -5799,8 +5802,11 @@ nsWindow::SynthesizeNativeKeyEvent(int32_t aNativeKeyboardLayout,
|
||||
nsresult
|
||||
nsWindow::SynthesizeNativeMouseEvent(LayoutDeviceIntPoint aPoint,
|
||||
uint32_t aNativeMessage,
|
||||
uint32_t aModifierFlags)
|
||||
uint32_t aModifierFlags,
|
||||
nsIObserver* aObserver)
|
||||
{
|
||||
AutoObserverNotifier notifier(aObserver, "mouseevent");
|
||||
|
||||
::SetCursorPos(aPoint.x, aPoint.y);
|
||||
|
||||
INPUT input;
|
||||
@ -5820,8 +5826,10 @@ nsWindow::SynthesizeNativeMouseScrollEvent(LayoutDeviceIntPoint aPoint,
|
||||
double aDeltaY,
|
||||
double aDeltaZ,
|
||||
uint32_t aModifierFlags,
|
||||
uint32_t aAdditionalFlags)
|
||||
uint32_t aAdditionalFlags,
|
||||
nsIObserver* aObserver)
|
||||
{
|
||||
AutoObserverNotifier notifier(aObserver, "mousescrollevent");
|
||||
return MouseScrollHandler::SynthesizeNativeMouseScrollEvent(
|
||||
this, aPoint, aNativeMessage,
|
||||
(aNativeMessage == WM_MOUSEWHEEL || aNativeMessage == WM_VSCROLL) ?
|
||||
|
@ -162,13 +162,16 @@ public:
|
||||
int32_t aNativeKeyCode,
|
||||
uint32_t aModifierFlags,
|
||||
const nsAString& aCharacters,
|
||||
const nsAString& aUnmodifiedCharacters);
|
||||
const nsAString& aUnmodifiedCharacters,
|
||||
nsIObserver* aObserver) override;
|
||||
virtual nsresult SynthesizeNativeMouseEvent(mozilla::LayoutDeviceIntPoint aPoint,
|
||||
uint32_t aNativeMessage,
|
||||
uint32_t aModifierFlags);
|
||||
uint32_t aModifierFlags,
|
||||
nsIObserver* aObserver) override;
|
||||
|
||||
virtual nsresult SynthesizeNativeMouseMove(mozilla::LayoutDeviceIntPoint aPoint)
|
||||
{ return SynthesizeNativeMouseEvent(aPoint, MOUSEEVENTF_MOVE, 0); }
|
||||
virtual nsresult SynthesizeNativeMouseMove(mozilla::LayoutDeviceIntPoint aPoint,
|
||||
nsIObserver* aObserver) override
|
||||
{ return SynthesizeNativeMouseEvent(aPoint, MOUSEEVENTF_MOVE, 0, aObserver); }
|
||||
|
||||
virtual nsresult SynthesizeNativeMouseScrollEvent(mozilla::LayoutDeviceIntPoint aPoint,
|
||||
uint32_t aNativeMessage,
|
||||
@ -176,7 +179,8 @@ public:
|
||||
double aDeltaY,
|
||||
double aDeltaZ,
|
||||
uint32_t aModifierFlags,
|
||||
uint32_t aAdditionalFlags);
|
||||
uint32_t aAdditionalFlags,
|
||||
nsIObserver* aObserver) override;
|
||||
NS_IMETHOD_(void) SetInputContext(const InputContext& aContext,
|
||||
const InputContextAction& aAction);
|
||||
NS_IMETHOD_(InputContext) GetInputContext();
|
||||
|
@ -110,8 +110,11 @@ nsWindowBase::SynthesizeNativeTouchPoint(uint32_t aPointerId,
|
||||
nsIWidget::TouchPointerState aPointerState,
|
||||
nsIntPoint aPointerScreenPoint,
|
||||
double aPointerPressure,
|
||||
uint32_t aPointerOrientation)
|
||||
uint32_t aPointerOrientation,
|
||||
nsIObserver* aObserver)
|
||||
{
|
||||
AutoObserverNotifier notifier(aObserver, "touchpoint");
|
||||
|
||||
if (!InitTouchInjection()) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
@ -180,8 +183,9 @@ nsWindowBase::CancelTouchPoints(const unsigned int& aPointerId, nsAutoPtr<Pointe
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsWindowBase::ClearNativeTouchSequence()
|
||||
nsWindowBase::ClearNativeTouchSequence(nsIObserver* aObserver)
|
||||
{
|
||||
AutoObserverNotifier notifier(aObserver, "cleartouch");
|
||||
if (!sTouchInjectInitialized) {
|
||||
return NS_OK;
|
||||
}
|
||||
@ -189,7 +193,7 @@ nsWindowBase::ClearNativeTouchSequence()
|
||||
// cancel all input points
|
||||
mActivePointers.Enumerate(CancelTouchPoints, (void*)this);
|
||||
|
||||
nsBaseWidget::ClearNativeTouchSequence();
|
||||
nsBaseWidget::ClearNativeTouchSequence(nullptr);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -92,8 +92,9 @@ public:
|
||||
TouchPointerState aPointerState,
|
||||
nsIntPoint aPointerScreenPoint,
|
||||
double aPointerPressure,
|
||||
uint32_t aPointerOrientation);
|
||||
virtual nsresult ClearNativeTouchSequence();
|
||||
uint32_t aPointerOrientation,
|
||||
nsIObserver* aObserver) override;
|
||||
virtual nsresult ClearNativeTouchSequence(nsIObserver* aObserver) override;
|
||||
|
||||
/*
|
||||
* WM_APPCOMMAND common handler.
|
||||
|
@ -583,8 +583,10 @@ MetroWidget::SynthesizeNativeKeyEvent(int32_t aNativeKeyboardLayout,
|
||||
int32_t aNativeKeyCode,
|
||||
uint32_t aModifierFlags,
|
||||
const nsAString& aCharacters,
|
||||
const nsAString& aUnmodifiedCharacters)
|
||||
const nsAString& aUnmodifiedCharacters,
|
||||
nsIObserver* aObserver)
|
||||
{
|
||||
AutoObserverNotifier notifier(aObserver, "keyevent");
|
||||
KeyboardLayout* keyboardLayout = KeyboardLayout::GetInstance();
|
||||
return keyboardLayout->SynthesizeNativeKeyEvent(
|
||||
this, aNativeKeyboardLayout, aNativeKeyCode, aModifierFlags,
|
||||
@ -594,10 +596,12 @@ MetroWidget::SynthesizeNativeKeyEvent(int32_t aNativeKeyboardLayout,
|
||||
nsresult
|
||||
MetroWidget::SynthesizeNativeMouseEvent(LayoutDeviceIntPoint aPoint,
|
||||
uint32_t aNativeMessage,
|
||||
uint32_t aModifierFlags)
|
||||
uint32_t aModifierFlags,
|
||||
nsIObserver* aObserver)
|
||||
{
|
||||
WinUtils::Log("ENTERED SynthesizeNativeMouseEvent");
|
||||
|
||||
AutoObserverNotifier notifier(aObserver, "mouseevent");
|
||||
INPUT inputs[2];
|
||||
memset(inputs, 0, 2*sizeof(INPUT));
|
||||
inputs[0].type = inputs[1].type = INPUT_MOUSE;
|
||||
@ -622,8 +626,10 @@ MetroWidget::SynthesizeNativeMouseScrollEvent(LayoutDeviceIntPoint aPoint,
|
||||
double aDeltaY,
|
||||
double aDeltaZ,
|
||||
uint32_t aModifierFlags,
|
||||
uint32_t aAdditionalFlags)
|
||||
uint32_t aAdditionalFlags
|
||||
nsIObserver* aObserver)
|
||||
{
|
||||
AutoObserverNotifier notifier(aObserver, "mousescrollevent");
|
||||
return MouseScrollHandler::SynthesizeNativeMouseScrollEvent(
|
||||
this, aPoint, aNativeMessage,
|
||||
(aNativeMessage == WM_MOUSEWHEEL || aNativeMessage == WM_VSCROLL) ?
|
||||
|
@ -127,17 +127,20 @@ public:
|
||||
int32_t aNativeKeyCode,
|
||||
uint32_t aModifierFlags,
|
||||
const nsAString& aCharacters,
|
||||
const nsAString& aUnmodifiedCharacters);
|
||||
const nsAString& aUnmodifiedCharacters,
|
||||
nsIObserver* aObserver);
|
||||
virtual nsresult SynthesizeNativeMouseEvent(mozilla::LayoutDeviceIntPoint aPoint,
|
||||
uint32_t aNativeMessage,
|
||||
uint32_t aModifierFlags);
|
||||
uint32_t aModifierFlags,
|
||||
nsIObserver* aObserver);
|
||||
virtual nsresult SynthesizeNativeMouseScrollEvent(mozilla::LayoutDeviceIntPoint aPoint,
|
||||
uint32_t aNativeMessage,
|
||||
double aDeltaX,
|
||||
double aDeltaY,
|
||||
double aDeltaZ,
|
||||
uint32_t aModifierFlags,
|
||||
uint32_t aAdditionalFlags);
|
||||
uint32_t aAdditionalFlags,
|
||||
nsIObserver* aObserver);
|
||||
virtual bool HasPendingInputEvent();
|
||||
virtual double GetDefaultScaleInternal();
|
||||
float GetDPI();
|
||||
|
Loading…
Reference in New Issue
Block a user