Bug 296491. Mouse event synthesis needs to account for cases where the view origin is not at the origin of its widget. r+sr=dbaron,a=bsmedberg

This commit is contained in:
roc+%cs.cmu.edu 2005-07-19 22:01:19 +00:00
Родитель 6915b726de
Коммит 802e2cda75
1 изменённых файлов: 3 добавлений и 1 удалений

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

@ -2162,7 +2162,9 @@ NS_IMETHODIMP nsViewManager::DispatchEvent(nsGUIEvent *aEvent, nsEventStatus *aS
nsPoint rootOffset(0, 0);
for (nsView *v = baseView; v != mRootView; v = v->GetParent())
v->ConvertToParentCoords(&rootOffset.x, &rootOffset.y);
// aEvent->point is relative to the widget, i.e. the view top-left,
// so we need to add the offset to the view origin
rootOffset += baseView->GetDimensions().TopLeft();
mMouseLocation.MoveTo(NSTwipsToIntPixels(rootOffset.x, t2p) +
aEvent->point.x,
NSTwipsToIntPixels(rootOffset.y, t2p) +