Bug 903368 - Don't convert coordinates in widget/winrt InitEvent from logical to physical. r=masayuki

This commit is contained in:
Jim Mathies 2013-08-12 05:05:04 -05:00
parent da8ed5631f
commit bfa277cf27
3 changed files with 9 additions and 5 deletions

View File

@ -37,6 +37,8 @@ public:
/*
* Init a standard gecko event for this widget.
* @param aEvent the event to initialize.
* @param aPoint message position in physical coordinates.
*/
virtual void InitEvent(nsGUIEvent& aEvent, nsIntPoint* aPoint = nullptr) = 0;

View File

@ -997,16 +997,16 @@ void MetroWidget::UserActivity()
}
}
// InitEvent assumes physical coordinates and is used by shared win32 code. Do
// not hand winrt event coordinates to this routine.
void
MetroWidget::InitEvent(nsGUIEvent& event, nsIntPoint* aPoint)
{
if (!aPoint) {
event.refPoint.x = event.refPoint.y = 0;
} else {
CSSIntPoint cssPoint(aPoint->x, aPoint->y);
LayoutDeviceIntPoint layoutDeviceIntPoint = CSSIntPointToLayoutDeviceIntPoint(cssPoint);
event.refPoint.x = layoutDeviceIntPoint.x;
event.refPoint.y = layoutDeviceIntPoint.y;
event.refPoint.x = aPoint->x;
event.refPoint.y = aPoint->y;
}
event.time = ::GetMessageTime();
}

View File

@ -69,10 +69,12 @@ public:
static HWND GetICoreWindowHWND() { return sICoreHwnd; }
// nsWindowBase
virtual void InitEvent(nsGUIEvent& aEvent, nsIntPoint* aPoint = nullptr) MOZ_OVERRIDE;
virtual bool DispatchWindowEvent(nsGUIEvent* aEvent) MOZ_OVERRIDE;
virtual bool IsTopLevelWidget() MOZ_OVERRIDE { return true; }
virtual nsWindowBase* GetParentWindowBase(bool aIncludeOwner) MOZ_OVERRIDE { return nullptr; }
// InitEvent assumes physical coordinates and is used by shared win32 code. Do
// not hand winrt event coordinates to this routine.
virtual void InitEvent(nsGUIEvent& aEvent, nsIntPoint* aPoint = nullptr) MOZ_OVERRIDE;
// nsBaseWidget
virtual CompositorParent* NewCompositorParent(int aSurfaceWidth, int aSurfaceHeight);