зеркало из https://github.com/mozilla/pjs.git
Bug 296036. Remove the very poorly specified (and redundant) field 'point' of nsEvent. r+sr=roc, patch by Eli Friedman
This commit is contained in:
Родитель
e23890d591
Коммит
31124c236b
|
@ -60,7 +60,7 @@ nsDOMMouseEvent::nsDOMMouseEvent(nsPresContext* aPresContext,
|
|||
else {
|
||||
mEventIsInternal = PR_TRUE;
|
||||
mEvent->time = PR_Now();
|
||||
mEvent->refPoint.x = mEvent->refPoint.y = mEvent->point.x = mEvent->point.y = 0;
|
||||
mEvent->refPoint.x = mEvent->refPoint.y = 0;
|
||||
}
|
||||
|
||||
switch (mEvent->eventStructType)
|
||||
|
@ -104,8 +104,8 @@ nsDOMMouseEvent::InitMouseEvent(const nsAString & aType, PRBool aCanBubble, PRBo
|
|||
inputEvent->isAlt = aAltKey;
|
||||
inputEvent->isShift = aShiftKey;
|
||||
inputEvent->isMeta = aMetaKey;
|
||||
inputEvent->point.x = aClientX;
|
||||
inputEvent->point.y = aClientY;
|
||||
mClientPoint.x = aClientX;
|
||||
mClientPoint.y = aClientY;
|
||||
inputEvent->refPoint.x = aScreenX;
|
||||
inputEvent->refPoint.y = aScreenY;
|
||||
mButton = aButton;
|
||||
|
|
|
@ -51,11 +51,13 @@
|
|||
#include "nsIPresShell.h"
|
||||
#include "nsIEventStateManager.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsLayoutUtils.h"
|
||||
|
||||
nsDOMUIEvent::nsDOMUIEvent(nsPresContext* aPresContext, nsGUIEvent* aEvent)
|
||||
: nsDOMEvent(aPresContext, aEvent ?
|
||||
NS_STATIC_CAST(nsEvent *, aEvent) :
|
||||
NS_STATIC_CAST(nsEvent *, new nsUIEvent(PR_FALSE, 0, 0)))
|
||||
, mClientPoint(0,0)
|
||||
{
|
||||
if (aEvent) {
|
||||
mEventIsInternal = PR_FALSE;
|
||||
|
@ -140,9 +142,9 @@ nsPoint nsDOMUIEvent::GetClientPoint() {
|
|||
return nsPoint(0, 0);
|
||||
}
|
||||
|
||||
if (!((nsGUIEvent*)mEvent)->widget ) {
|
||||
return mEvent->point;
|
||||
}
|
||||
nsCOMPtr<nsIWidget> eventWidget = ((nsGUIEvent*)mEvent)->widget;
|
||||
if (!eventWidget)
|
||||
return mClientPoint;
|
||||
|
||||
//My god, man, there *must* be a better way to do this.
|
||||
nsCOMPtr<nsIWidget> docWidget;
|
||||
|
@ -156,8 +158,6 @@ nsPoint nsDOMUIEvent::GetClientPoint() {
|
|||
|
||||
nsPoint pt = mEvent->refPoint;
|
||||
|
||||
nsCOMPtr<nsIWidget> eventWidget = ((nsGUIEvent*)mEvent)->widget;
|
||||
|
||||
// BUG 296004 (see also BUG 242833)
|
||||
//
|
||||
// For document events we want to return a point relative to the local view manager,
|
||||
|
@ -326,8 +326,10 @@ nsDOMUIEvent::GetRangeParent(nsIDOMNode** aRangeParent)
|
|||
nsCOMPtr<nsIContent> parent;
|
||||
PRInt32 offset, endOffset;
|
||||
PRBool beginOfContent;
|
||||
nsPoint pt = nsLayoutUtils::GetEventCoordinatesForNearestView(mEvent,
|
||||
targetFrame);
|
||||
if (NS_SUCCEEDED(targetFrame->GetContentAndOffsetsFromPoint(mPresContext,
|
||||
mEvent->point,
|
||||
pt,
|
||||
getter_AddRefs(parent),
|
||||
offset,
|
||||
endOffset,
|
||||
|
@ -355,8 +357,10 @@ nsDOMUIEvent::GetRangeOffset(PRInt32* aRangeOffset)
|
|||
nsIContent* parent = nsnull;
|
||||
PRInt32 endOffset;
|
||||
PRBool beginOfContent;
|
||||
nsPoint pt = nsLayoutUtils::GetEventCoordinatesForNearestView(mEvent,
|
||||
targetFrame);
|
||||
if (NS_SUCCEEDED(targetFrame->GetContentAndOffsetsFromPoint(mPresContext,
|
||||
mEvent->point,
|
||||
pt,
|
||||
&parent,
|
||||
*aRangeOffset,
|
||||
endOffset,
|
||||
|
@ -396,19 +400,36 @@ nsDOMUIEvent::SetCancelBubble(PRBool aCancelBubble)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsPoint nsDOMUIEvent::GetLayerPoint() {
|
||||
if (!mEvent || (mEvent->eventStructType != NS_MOUSE_EVENT) ||
|
||||
!mPresContext) {
|
||||
return nsPoint(0,0);
|
||||
}
|
||||
|
||||
// XXX This is supposed to be relative to the nearest view?
|
||||
// Any element can have a view, not just positioned ones.
|
||||
float t2p = mPresContext->TwipsToPixels();
|
||||
nsIFrame* targetFrame;
|
||||
nsPoint pt;
|
||||
mPresContext->EventStateManager()->GetEventTarget(&targetFrame);
|
||||
while (targetFrame && !targetFrame->HasView()) {
|
||||
targetFrame = targetFrame->GetParent();
|
||||
}
|
||||
if (targetFrame) {
|
||||
pt = nsLayoutUtils::GetEventCoordinatesRelativeTo(mEvent, targetFrame);
|
||||
pt.x = NSTwipsToIntPixels(pt.x, t2p);
|
||||
pt.y = NSTwipsToIntPixels(pt.y, t2p);
|
||||
return pt;
|
||||
} else {
|
||||
return nsPoint(0,0);
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMUIEvent::GetLayerX(PRInt32* aLayerX)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aLayerX);
|
||||
if (!mEvent || (mEvent->eventStructType != NS_MOUSE_EVENT) ||
|
||||
!mPresContext) {
|
||||
*aLayerX = 0;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
float t2p;
|
||||
t2p = mPresContext->TwipsToPixels();
|
||||
*aLayerX = NSTwipsToIntPixels(mEvent->point.x, t2p);
|
||||
*aLayerX = GetLayerPoint().x;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -416,15 +437,7 @@ NS_IMETHODIMP
|
|||
nsDOMUIEvent::GetLayerY(PRInt32* aLayerY)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aLayerY);
|
||||
if (!mEvent || (mEvent->eventStructType != NS_MOUSE_EVENT) ||
|
||||
!mPresContext) {
|
||||
*aLayerY = 0;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
float t2p;
|
||||
t2p = mPresContext->TwipsToPixels();
|
||||
*aLayerY = NSTwipsToIntPixels(mEvent->point.y, t2p);
|
||||
*aLayerY = GetLayerPoint().y;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -76,10 +76,12 @@ protected:
|
|||
float* aT2P);
|
||||
nsPoint GetClientPoint();
|
||||
nsPoint GetScreenPoint();
|
||||
nsPoint GetLayerPoint();
|
||||
|
||||
protected:
|
||||
nsCOMPtr<nsIDOMAbstractView> mView;
|
||||
PRInt32 mDetail;
|
||||
nsPoint mClientPoint;
|
||||
};
|
||||
|
||||
#define NS_FORWARD_TO_NSDOMUIEVENT \
|
||||
|
|
|
@ -2153,8 +2153,6 @@ nsEventListenerManager::FixContextMenuEvent(nsPresContext* aPresContext,
|
|||
// Reset event coordinates relative to focused frame in view
|
||||
nsPoint targetPt;
|
||||
GetCoordinatesFor(currentFocus, aPresContext, shell, targetPt);
|
||||
aEvent->point.x += targetPt.x - aEvent->refPoint.x;
|
||||
aEvent->point.y += targetPt.y - aEvent->refPoint.y;
|
||||
aEvent->refPoint.x = targetPt.x;
|
||||
aEvent->refPoint.y = targetPt.y;
|
||||
|
||||
|
|
|
@ -495,8 +495,13 @@ nsEventStateManager::PreHandleEvent(nsPresContext* aPresContext,
|
|||
{
|
||||
nsMouseEvent* mouseEvent = NS_STATIC_CAST(nsMouseEvent*, aEvent);
|
||||
nsCOMPtr<nsIWidget> parentWidget = getter_AddRefs(mouseEvent->widget->GetParent());
|
||||
nsPoint eventPoint;
|
||||
eventPoint = nsLayoutUtils::TranslateWidgetToView(aPresContext,
|
||||
mouseEvent->widget,
|
||||
mouseEvent->refPoint,
|
||||
aView);
|
||||
if (parentWidget &&
|
||||
(aView->GetBounds() - aView->GetPosition()).Contains(aEvent->point)) {
|
||||
(aView->GetBounds() - aView->GetPosition()).Contains(eventPoint)) {
|
||||
// treat it as a move so we don't generate spurious "exit"
|
||||
// events Any necessary exit events will be generated by
|
||||
// GenerateMouseEnterExit
|
||||
|
@ -1477,27 +1482,6 @@ nsEventStateManager::FillInEventFromGestureDown(nsMouseEvent* aEvent)
|
|||
nsRect tmpRect(0, 0, 1, 1);
|
||||
aEvent->widget->WidgetToScreen(tmpRect, tmpRect);
|
||||
aEvent->refPoint = mGestureDownPoint - tmpRect.TopLeft();
|
||||
|
||||
float pixelsToTwips;
|
||||
pixelsToTwips = mPresContext->DeviceContext()->DevUnitsToTwips();
|
||||
nsPoint refPointTwips(NSIntPixelsToTwips(aEvent->refPoint.x, pixelsToTwips),
|
||||
NSIntPixelsToTwips(aEvent->refPoint.y, pixelsToTwips));
|
||||
|
||||
nsIView* widgetView = mCurrentTarget->GetClosestView();
|
||||
nsPoint widgetToView;
|
||||
#ifdef DEBUG
|
||||
nsIWidget* theWidget =
|
||||
#endif
|
||||
widgetView->GetNearestWidget(&widgetToView);
|
||||
NS_ASSERTION(theWidget == aEvent->widget, "Widget confusion!");
|
||||
nsPoint widgetViewPoint = refPointTwips + widgetToView;
|
||||
|
||||
nsPoint targetToView;
|
||||
nsIView* view;
|
||||
mCurrentTarget->GetOffsetFromView(targetToView, &view);
|
||||
|
||||
aEvent->point = widgetViewPoint + widgetView->GetOffsetTo(view);
|
||||
|
||||
aEvent->isShift = mGestureDownShift;
|
||||
aEvent->isControl = mGestureDownControl;
|
||||
aEvent->isAlt = mGestureDownAlt;
|
||||
|
@ -1729,8 +1713,9 @@ nsEventStateManager::DoScrollText(nsPresContext* aPresContext,
|
|||
mouseEvent->InitMouseEvent(NS_LITERAL_STRING("DOMMouseScroll"),
|
||||
PR_TRUE, PR_TRUE,
|
||||
view, aNumLines,
|
||||
// XXX These should be screenX/Y and clientX/Y
|
||||
aEvent->refPoint.x, aEvent->refPoint.y,
|
||||
aEvent->point.x, aEvent->point.y,
|
||||
0, 0,
|
||||
aEvent->isControl, aEvent->isAlt,
|
||||
aEvent->isShift, aEvent->isMeta,
|
||||
0, nsnull);
|
||||
|
@ -2381,7 +2366,9 @@ nsEventStateManager::UpdateCursor(nsPresContext* aPresContext,
|
|||
//If not locked, look for correct cursor
|
||||
else if (aTargetFrame) {
|
||||
nsIFrame::Cursor framecursor;
|
||||
if (NS_FAILED(aTargetFrame->GetCursor(aEvent->point, framecursor)))
|
||||
nsPoint pt = nsLayoutUtils::GetEventCoordinatesRelativeTo(aEvent,
|
||||
aTargetFrame);
|
||||
if (NS_FAILED(aTargetFrame->GetCursor(pt, framecursor)))
|
||||
return; // don't update the cursor if we failed to get it from the frame see bug 118877
|
||||
cursor = framecursor.mCursor;
|
||||
container = framecursor.mContainer;
|
||||
|
@ -2606,7 +2593,6 @@ nsEventStateManager::DispatchMouseEvent(nsGUIEvent* aEvent, PRUint32 aMessage,
|
|||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
nsMouseEvent event(NS_IS_TRUSTED_EVENT(aEvent), aMessage, aEvent->widget,
|
||||
nsMouseEvent::eReal);
|
||||
event.point = aEvent->point;
|
||||
event.refPoint = aEvent->refPoint;
|
||||
event.isShift = ((nsMouseEvent*)aEvent)->isShift;
|
||||
event.isControl = ((nsMouseEvent*)aEvent)->isControl;
|
||||
|
@ -2818,7 +2804,6 @@ nsEventStateManager::GenerateDragDropEnterExit(nsPresContext* aPresContext,
|
|||
nsMouseEvent event(NS_IS_TRUSTED_EVENT(aEvent),
|
||||
NS_DRAGDROP_EXIT_SYNTH, aEvent->widget,
|
||||
nsMouseEvent::eReal);
|
||||
event.point = aEvent->point;
|
||||
event.refPoint = aEvent->refPoint;
|
||||
event.isShift = ((nsMouseEvent*)aEvent)->isShift;
|
||||
event.isControl = ((nsMouseEvent*)aEvent)->isControl;
|
||||
|
@ -2852,7 +2837,6 @@ nsEventStateManager::GenerateDragDropEnterExit(nsPresContext* aPresContext,
|
|||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
nsMouseEvent event(NS_IS_TRUSTED_EVENT(aEvent), NS_DRAGDROP_ENTER,
|
||||
aEvent->widget, nsMouseEvent::eReal);
|
||||
event.point = aEvent->point;
|
||||
event.refPoint = aEvent->refPoint;
|
||||
event.isShift = ((nsMouseEvent*)aEvent)->isShift;
|
||||
event.isControl = ((nsMouseEvent*)aEvent)->isControl;
|
||||
|
@ -2894,7 +2878,6 @@ nsEventStateManager::GenerateDragDropEnterExit(nsPresContext* aPresContext,
|
|||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
nsMouseEvent event(NS_IS_TRUSTED_EVENT(aEvent), NS_DRAGDROP_EXIT_SYNTH,
|
||||
aEvent->widget, nsMouseEvent::eReal);
|
||||
event.point = aEvent->point;
|
||||
event.refPoint = aEvent->refPoint;
|
||||
event.isShift = ((nsMouseEvent*)aEvent)->isShift;
|
||||
event.isControl = ((nsMouseEvent*)aEvent)->isControl;
|
||||
|
@ -3019,7 +3002,6 @@ nsEventStateManager::CheckForAndDispatchClick(nsPresContext* aPresContext,
|
|||
|
||||
nsMouseEvent event(NS_IS_TRUSTED_EVENT(aEvent), eventMsg, aEvent->widget,
|
||||
nsMouseEvent::eReal);
|
||||
event.point = aEvent->point;
|
||||
event.refPoint = aEvent->refPoint;
|
||||
event.clickCount = aEvent->clickCount;
|
||||
event.isShift = aEvent->isShift;
|
||||
|
@ -3051,7 +3033,6 @@ nsEventStateManager::CheckForAndDispatchClick(nsPresContext* aPresContext,
|
|||
|
||||
nsMouseEvent event2(NS_IS_TRUSTED_EVENT(aEvent), eventMsg,
|
||||
aEvent->widget, nsMouseEvent::eReal);
|
||||
event2.point = aEvent->point;
|
||||
event2.refPoint = aEvent->refPoint;
|
||||
event2.clickCount = aEvent->clickCount;
|
||||
event2.isShift = aEvent->isShift;
|
||||
|
|
|
@ -1452,7 +1452,6 @@ nsGenericHTMLElement::DispatchClickEvent(nsPresContext* aPresContext,
|
|||
|
||||
nsMouseEvent event(NS_IS_TRUSTED_EVENT(aSourceEvent), NS_MOUSE_LEFT_CLICK,
|
||||
aSourceEvent->widget, nsMouseEvent::eReal);
|
||||
event.point = aSourceEvent->point;
|
||||
event.refPoint = aSourceEvent->refPoint;
|
||||
PRUint32 clickCount = 1;
|
||||
if (aSourceEvent->eventStructType == NS_MOUSE_EVENT) {
|
||||
|
|
|
@ -359,7 +359,6 @@ nsXMLElement::HandleDOMEvent(nsPresContext* aPresContext,
|
|||
nsGUIEvent* guiEvent = NS_STATIC_CAST(nsGUIEvent*, aEvent);
|
||||
nsMouseEvent event(NS_IS_TRUSTED_EVENT(aEvent), NS_MOUSE_LEFT_CLICK,
|
||||
guiEvent->widget, nsMouseEvent::eReal);
|
||||
event.point = aEvent->point;
|
||||
event.refPoint = aEvent->refPoint;
|
||||
event.clickCount = 1;
|
||||
event.isShift = keyEvent->isShift;
|
||||
|
|
|
@ -1369,12 +1369,10 @@ nsGlobalWindow::HandleDOMEvent(nsPresContext* aPresContext, nsEvent* aEvent,
|
|||
if (count++ % 100 == 0) {
|
||||
//Since the high bits seem to be zero's most of the time,
|
||||
//let's only take the lowest half of the point structure.
|
||||
PRInt16 myCoord[4];
|
||||
PRInt16 myCoord[2];
|
||||
|
||||
myCoord[0] = aEvent->point.x;
|
||||
myCoord[1] = aEvent->point.y;
|
||||
myCoord[2] = aEvent->refPoint.x;
|
||||
myCoord[3] = aEvent->refPoint.y;
|
||||
myCoord[0] = aEvent->refPoint.x;
|
||||
myCoord[1] = aEvent->refPoint.y;
|
||||
gEntropyCollector->RandomUpdate((void*)myCoord, sizeof(myCoord));
|
||||
gEntropyCollector->RandomUpdate((void*)&aEvent->time, sizeof(PRUint32));
|
||||
}
|
||||
|
|
|
@ -435,25 +435,64 @@ nsLayoutUtils::GetDOMEventCoordinatesRelativeTo(nsIDOMEvent* aDOMEvent, nsIFrame
|
|||
nsresult rv = privateEvent->GetInternalNSEvent(&event);
|
||||
if (NS_FAILED(rv))
|
||||
return nsPoint(NS_UNCONSTRAINEDSIZE, NS_UNCONSTRAINEDSIZE);
|
||||
if (!event || event->eventStructType != NS_MOUSE_EVENT)
|
||||
return GetEventCoordinatesRelativeTo(event, aFrame);
|
||||
}
|
||||
|
||||
nsPoint
|
||||
nsLayoutUtils::GetEventCoordinatesRelativeTo(nsEvent* aEvent, nsIFrame* aFrame)
|
||||
{
|
||||
if (!aEvent || (aEvent->eventStructType != NS_MOUSE_EVENT &&
|
||||
aEvent->eventStructType != NS_MOUSE_SCROLL_EVENT))
|
||||
return nsPoint(NS_UNCONSTRAINEDSIZE, NS_UNCONSTRAINEDSIZE);
|
||||
|
||||
nsGUIEvent* GUIEvent = NS_STATIC_CAST(nsGUIEvent*, event);
|
||||
|
||||
nsGUIEvent* GUIEvent = NS_STATIC_CAST(nsGUIEvent*, aEvent);
|
||||
if (!GUIEvent->widget)
|
||||
return nsPoint(NS_UNCONSTRAINEDSIZE, NS_UNCONSTRAINEDSIZE);
|
||||
nsIView* view = nsIView::GetViewFor(GUIEvent->widget);
|
||||
if (!view)
|
||||
|
||||
nsPoint frameToView;
|
||||
nsIView* frameView = aFrame->GetClosestView(&frameToView);
|
||||
|
||||
return TranslateWidgetToView(aFrame->GetPresContext(),
|
||||
GUIEvent->widget, GUIEvent->refPoint,
|
||||
frameView) - frameToView;
|
||||
}
|
||||
|
||||
nsPoint
|
||||
nsLayoutUtils::GetEventCoordinatesForNearestView(nsEvent* aEvent,
|
||||
nsIFrame* aFrame,
|
||||
nsIView** aView)
|
||||
{
|
||||
if (!aEvent || (aEvent->eventStructType != NS_MOUSE_EVENT &&
|
||||
aEvent->eventStructType != NS_MOUSE_SCROLL_EVENT))
|
||||
return nsPoint(NS_UNCONSTRAINEDSIZE, NS_UNCONSTRAINEDSIZE);
|
||||
|
||||
nsPoint widgetToView;
|
||||
view->GetNearestWidget(&widgetToView);
|
||||
nsPoint viewToFrame;
|
||||
nsIView* frameView = aFrame->GetClosestView(&viewToFrame);
|
||||
nsGUIEvent* GUIEvent = NS_STATIC_CAST(nsGUIEvent*, aEvent);
|
||||
if (!GUIEvent->widget)
|
||||
return nsPoint(NS_UNCONSTRAINEDSIZE, NS_UNCONSTRAINEDSIZE);
|
||||
|
||||
float p2t = aFrame->GetPresContext()->PixelsToTwips();
|
||||
nsPoint mousePt(NSIntPixelsToTwips(GUIEvent->refPoint.x, p2t),
|
||||
NSIntPixelsToTwips(GUIEvent->refPoint.y, p2t));
|
||||
return mousePt + widgetToView + (-frameView->GetOffsetTo(view)) + viewToFrame;
|
||||
nsPoint viewToFrame;
|
||||
nsIView* frameView;
|
||||
aFrame->GetOffsetFromView(viewToFrame, &frameView);
|
||||
if (aView)
|
||||
*aView = frameView;
|
||||
|
||||
return TranslateWidgetToView(aFrame->GetPresContext(), GUIEvent->widget,
|
||||
GUIEvent->refPoint, frameView);
|
||||
}
|
||||
|
||||
nsPoint
|
||||
nsLayoutUtils::TranslateWidgetToView(nsPresContext* aPresContext,
|
||||
nsIWidget* aWidget, nsIntPoint aPt,
|
||||
nsIView* aView)
|
||||
{
|
||||
nsPoint widgetToView;
|
||||
nsIView* baseView = nsIView::GetViewFor(aWidget);
|
||||
nsIWidget* wid = baseView->GetNearestWidget(&widgetToView);
|
||||
NS_ASSERTION(aWidget == wid, "Clashing widgets");
|
||||
float pixelsToTwips = aPresContext->PixelsToTwips();
|
||||
nsPoint refPointTwips(NSIntPixelsToTwips(aPt.x, pixelsToTwips),
|
||||
NSIntPixelsToTwips(aPt.y, pixelsToTwips));
|
||||
return refPointTwips + widgetToView - aView->GetOffsetTo(baseView);
|
||||
}
|
||||
|
||||
// Combine aNewBreakType with aOrigBreakType, but limit the break types
|
||||
|
|
|
@ -255,7 +255,50 @@ public:
|
|||
* for some reason the coordinates for the mouse are not known (e.g.,
|
||||
* the event is not a GUI event).
|
||||
*/
|
||||
static nsPoint GetDOMEventCoordinatesRelativeTo(nsIDOMEvent* aDOMEvent, nsIFrame* aFrame);
|
||||
static nsPoint GetDOMEventCoordinatesRelativeTo(nsIDOMEvent* aDOMEvent,
|
||||
nsIFrame* aFrame);
|
||||
|
||||
/**
|
||||
* Get the coordinates of a given native mouse event, relative to a given
|
||||
* frame.
|
||||
* @param aEvent the event
|
||||
* @param aFrame the frame to make coordinates relative to
|
||||
* @return the point, or (NS_UNCONSTRAINEDSIZE, NS_UNCONSTRAINEDSIZE) if
|
||||
* for some reason the coordinates for the mouse are not known (e.g.,
|
||||
* the event is not a GUI event).
|
||||
*/
|
||||
static nsPoint GetEventCoordinatesRelativeTo(nsEvent* aEvent,
|
||||
nsIFrame* aFrame);
|
||||
|
||||
/**
|
||||
* Get the coordinates of a given native mouse event, relative to the nearest
|
||||
* view for a given frame.
|
||||
* The "nearest view" is the view returned by nsFrame::GetOffsetFromView.
|
||||
* XXX this is extremely BOGUS because "nearest view" is a mess; every
|
||||
* use of this method is really a bug!
|
||||
* @param aEvent the event
|
||||
* @param aFrame the frame to make coordinates relative to
|
||||
* @param aView view to which returned coordinates are relative
|
||||
* @return the point, or (NS_UNCONSTRAINEDSIZE, NS_UNCONSTRAINEDSIZE) if
|
||||
* for some reason the coordinates for the mouse are not known (e.g.,
|
||||
* the event is not a GUI event).
|
||||
*/
|
||||
static nsPoint GetEventCoordinatesForNearestView(nsEvent* aEvent,
|
||||
nsIFrame* aFrame,
|
||||
nsIView** aView = nsnull);
|
||||
|
||||
/**
|
||||
* Translate from widget coordinates to the view's coordinates
|
||||
* @param aPresContext the PresContext for the view
|
||||
* @param aWidget the widget
|
||||
* @param aPt the point relative to the widget
|
||||
* @param aView view to which returned coordinates are relative
|
||||
* @return the point in the view's coordinates
|
||||
*/
|
||||
static nsPoint TranslateWidgetToView(nsPresContext* aPresContext,
|
||||
nsIWidget* aWidget, nsIntPoint aPt,
|
||||
nsIView* aView);
|
||||
|
||||
};
|
||||
|
||||
#endif // nsLayoutUtils_h__
|
||||
|
|
|
@ -5619,7 +5619,7 @@ SetClipRect(nsIRenderingContext& aRenderingContext, nsIFrame* aFrame)
|
|||
}
|
||||
|
||||
static PRBool
|
||||
InClipRect(nsIFrame* aFrame, nsPoint& aEventPoint)
|
||||
InClipRect(nsIFrame* aFrame, const nsPoint& aEventPoint)
|
||||
{
|
||||
nsRect clipRect;
|
||||
|
||||
|
@ -5895,7 +5895,6 @@ PresShell::HandleEvent(nsIView *aView,
|
|||
}
|
||||
|
||||
if (targetView) {
|
||||
aEvent->point += aView->GetOffsetTo(targetView);
|
||||
aView = targetView;
|
||||
frame = NS_STATIC_CAST(nsIFrame*, aView->GetClientData());
|
||||
}
|
||||
|
@ -5966,7 +5965,8 @@ PresShell::HandleEvent(nsIView *aView,
|
|||
aHandled, mCurrentEventContent);
|
||||
}
|
||||
}
|
||||
else if (!InClipRect(frame, aEvent->point)) {
|
||||
else if (!InClipRect(frame,
|
||||
nsLayoutUtils::GetEventCoordinatesForNearestView(aEvent, frame))) {
|
||||
// we only check for the clip rect on this frame ... all frames with clip
|
||||
// have views so any viewless children of this frame cannot have clip.
|
||||
// Furthermore if the event is not in the clip for this frame, then none
|
||||
|
@ -5980,19 +5980,15 @@ PresShell::HandleEvent(nsIView *aView,
|
|||
aHandled = PR_FALSE;
|
||||
rv = NS_OK;
|
||||
} else {
|
||||
// aEvent->point is relative to aView's upper left corner. We need
|
||||
// a point that is in the same coordinate system as frame's rect
|
||||
// so that the frame->mRect.Contains(aPoint) calls in
|
||||
// GetFrameForPoint() work. The assumption here is that frame->GetView()
|
||||
// will return aView, and frame's parent view is aView's parent.
|
||||
|
||||
nsPoint eventPoint = frame->GetPosition();
|
||||
eventPoint += aEvent->point;
|
||||
|
||||
nsPoint eventPoint;
|
||||
eventPoint = nsLayoutUtils::GetEventCoordinatesRelativeTo(aEvent, frame);
|
||||
// XXX Until GetFrameForPoint is cleaned up, we need to account for the
|
||||
// weird input the function takes. These adjustments counteract the
|
||||
// adjustments GetFrameForPoint makes.
|
||||
eventPoint += frame->GetPosition();
|
||||
nsPoint originOffset;
|
||||
nsIView *view = nsnull;
|
||||
frame->GetOriginToViewOffset(originOffset, &view);
|
||||
|
||||
NS_ASSERTION(view == aView, "view != aView");
|
||||
if (view == aView)
|
||||
eventPoint -= originOffset;
|
||||
|
@ -6264,26 +6260,8 @@ PresShell::HandleEventInternal(nsEvent* aEvent, nsIView *aView,
|
|||
// If aView is non-null, adjust coordinates of aEvent to be in the
|
||||
// coordinate system of mCurrentEventFrame's closest view. Don't use
|
||||
// aView here, since it may be dead by now.
|
||||
nsPoint offset(0,0);
|
||||
if (aView) {
|
||||
NS_ASSERTION(mViewManager,
|
||||
"How did GetCurrentEventFrame() succeed?");
|
||||
nsIView* rootView;
|
||||
mViewManager->GetRootView(rootView);
|
||||
nsIView* frameView;
|
||||
nsPoint pt;
|
||||
mCurrentEventFrame->GetOffsetFromView(pt, &frameView);
|
||||
offset = frameView->GetOffsetTo(rootView) - offsetOfaView;
|
||||
}
|
||||
|
||||
// Transform aEvent->point from aView's coordinate system to
|
||||
// that of mCurrentEventFrame's closest view
|
||||
aEvent->point -= offset;
|
||||
|
||||
rv = mCurrentEventFrame->HandleEvent(mPresContext, (nsGUIEvent*)aEvent,
|
||||
aStatus);
|
||||
// Now transform back
|
||||
aEvent->point += offset;
|
||||
}
|
||||
|
||||
// 4. Give event to event manager for post event state changes and
|
||||
|
|
|
@ -58,6 +58,7 @@
|
|||
#include "nsLayoutAtoms.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsContainerFrame.h"
|
||||
#include "nsLayoutUtils.h"
|
||||
#ifdef ACCESSIBILITY
|
||||
#include "nsIAccessibilityService.h"
|
||||
#endif
|
||||
|
@ -263,7 +264,8 @@ nsImageControlFrame::HandleEvent(nsPresContext* aPresContext,
|
|||
{
|
||||
// Store click point for GetNamesValues
|
||||
// Do this on MouseUp because the specs don't say and that's what IE does
|
||||
TranslateEventCoords(aEvent->point, mLastClickPoint);
|
||||
nsPoint pt = nsLayoutUtils::GetEventCoordinatesRelativeTo(aEvent, this);
|
||||
TranslateEventCoords(pt, mLastClickPoint);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6573,31 +6573,20 @@ nsBlockFrame::HandleEvent(nsPresContext* aPresContext,
|
|||
return NS_OK;
|
||||
nsCOMPtr<nsILineIterator> it( do_QueryInterface(mainframe, &result) );
|
||||
nsPeekOffsetStruct pos;
|
||||
nsPoint viewOffset;
|
||||
nsIView* parentWithView;
|
||||
GetOffsetFromView(viewOffset, &parentWithView);
|
||||
// The offset returned by GetOffsetFromView is not trustworthy.
|
||||
// It's just the sum of frame positions and is not the true
|
||||
// geometric offset. So recalculate the true geometric offset.
|
||||
NS_ASSERTION(nsLayoutUtils::GetFrameFor(parentWithView),
|
||||
"GetOffsetFromView shouldn't be returning a frameless view");
|
||||
viewOffset = GetOffsetTo(nsLayoutUtils::GetFrameFor(parentWithView));
|
||||
|
||||
while(NS_OK == result)
|
||||
{ //we are starting aloop to allow us to "drill down to the one we want"
|
||||
PRInt32 closestLine;
|
||||
|
||||
// aEvent->point is relative to our view. We need to make it relative to
|
||||
// mainframe, via this frame.
|
||||
if (NS_FAILED(result = GetClosestLine(it,
|
||||
aEvent->point - viewOffset - mainframe->GetOffsetTo(this), closestLine)))
|
||||
nsPoint pt =
|
||||
nsLayoutUtils::GetEventCoordinatesRelativeTo(aEvent, mainframe);
|
||||
if (NS_FAILED(result = GetClosestLine(it, pt, closestLine)))
|
||||
return result;
|
||||
|
||||
|
||||
//we will now ask where to go. if we cant find what we want"aka another block frame"
|
||||
//we drill down again
|
||||
pos.mShell = shell;
|
||||
pos.mDirection = eDirNext;
|
||||
pos.mDesiredX = aEvent->point.x;
|
||||
pos.mDesiredX = pt.x;
|
||||
pos.mScrollViewStop = PR_FALSE;
|
||||
pos.mIsKeyboardSelect = PR_FALSE;
|
||||
result = nsFrame::GetNextPrevLineFromeBlockFrame(aPresContext,
|
||||
|
@ -6622,14 +6611,6 @@ nsBlockFrame::HandleEvent(nsPresContext* aPresContext,
|
|||
|
||||
if (resultFrame)
|
||||
{
|
||||
// Translate aEvent->point to resultFrame's closest view (bug 180015).
|
||||
nsPoint tmp;
|
||||
nsIView* resultFrameParentView;
|
||||
resultFrame->GetOffsetFromView(tmp, &resultFrameParentView);
|
||||
if (parentWithView != resultFrameParentView && resultFrameParentView) {
|
||||
aEvent->point -= resultFrameParentView->GetOffsetTo(parentWithView);
|
||||
}
|
||||
|
||||
if (NS_POSITION_BEFORE_TABLE == result)
|
||||
{
|
||||
nsCOMPtr<nsISelectionController> selCon;
|
||||
|
|
|
@ -1201,7 +1201,7 @@ nsFrame::IsSelectable(PRBool* aSelectable, PRUint8* aSelectStyle) const
|
|||
PRBool
|
||||
ContentContainsPoint(nsPresContext *aPresContext,
|
||||
nsIContent *aContent,
|
||||
nsPoint *aPoint,
|
||||
const nsPoint &aPoint,
|
||||
nsIView *aRelativeView)
|
||||
{
|
||||
nsIPresShell *presShell = aPresContext->GetPresShell();
|
||||
|
@ -1225,7 +1225,7 @@ ContentContainsPoint(nsPresContext *aPresContext,
|
|||
// that our point is in the same view space our content frame's
|
||||
// rects are in.
|
||||
|
||||
nsPoint point = *aPoint + aRelativeView->GetOffsetTo(frameView);
|
||||
nsPoint point = aPoint + aRelativeView->GetOffsetTo(frameView);
|
||||
|
||||
// Now check to see if the point is within the bounds of the
|
||||
// content's primary frame, or any of it's continuation frames.
|
||||
|
@ -1284,24 +1284,15 @@ nsFrame::HandlePress(nsPresContext* aPresContext,
|
|||
//weaaak. only the editor can display frame selction not just text and images
|
||||
isEditor = isEditor == nsISelectionDisplay::DISPLAY_ALL;
|
||||
|
||||
nsKeyEvent* keyEvent = (nsKeyEvent*)aEvent;
|
||||
nsInputEvent* keyEvent = (nsInputEvent*)aEvent;
|
||||
if (!isEditor && !keyEvent->isAlt) {
|
||||
|
||||
for (nsIContent* content = mContent; content;
|
||||
content = content->GetParent()) {
|
||||
if ( nsContentUtils::ContentIsDraggable(content) ) {
|
||||
// coordinate stuff is the fix for bug #55921
|
||||
nsIView *dummyView = 0;
|
||||
nsRect frameRect = mRect;
|
||||
nsPoint offsetPoint;
|
||||
|
||||
GetOffsetFromView(offsetPoint, &dummyView);
|
||||
|
||||
frameRect.x = offsetPoint.x;
|
||||
frameRect.y = offsetPoint.y;
|
||||
|
||||
if (frameRect.x <= aEvent->point.x && (frameRect.x + frameRect.width >= aEvent->point.x) &&
|
||||
frameRect.y <= aEvent->point.y && (frameRect.y + frameRect.height >= aEvent->point.y))
|
||||
if ((mRect - GetPosition()).Contains(
|
||||
nsLayoutUtils::GetEventCoordinatesRelativeTo(aEvent, this)))
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
@ -1370,7 +1361,10 @@ nsFrame::HandlePress(nsPresContext* aPresContext,
|
|||
PRInt32 startOffset = 0, endOffset = 0;
|
||||
PRBool beginFrameContent = PR_FALSE;
|
||||
|
||||
rv = GetContentAndOffsetsFromPoint(aPresContext, aEvent->point, getter_AddRefs(content), startOffset, endOffset, beginFrameContent);
|
||||
nsPoint pt = nsLayoutUtils::GetEventCoordinatesForNearestView(aEvent, this);
|
||||
rv = GetContentAndOffsetsFromPoint(aPresContext, pt, getter_AddRefs(content),
|
||||
startOffset, endOffset,
|
||||
beginFrameContent);
|
||||
// do we have CSS that changes selection behaviour?
|
||||
PRBool changeSelection = PR_FALSE;
|
||||
{
|
||||
|
@ -1511,6 +1505,9 @@ nsFrame::HandlePress(nsPresContext* aPresContext,
|
|||
// frame's parent view. Unfortunately, the only way to get
|
||||
// the parent view is to call GetOffsetFromView().
|
||||
|
||||
nsPoint pt = nsLayoutUtils::
|
||||
GetEventCoordinatesForNearestView(aEvent, this, &view);
|
||||
|
||||
GetOffsetFromView(dummyPoint, &view);
|
||||
|
||||
// Now check to see if the point is truly within the bounds
|
||||
|
@ -1518,7 +1515,7 @@ nsFrame::HandlePress(nsPresContext* aPresContext,
|
|||
|
||||
if (view)
|
||||
disableDragSelect = ContentContainsPoint(aPresContext, content,
|
||||
&aEvent->point, view);
|
||||
pt, view);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1599,8 +1596,11 @@ nsFrame::HandleMultiplePress(nsPresContext* aPresContext,
|
|||
PRInt32 contentOffsetEnd = 0;
|
||||
nsCOMPtr<nsIContent> newContent;
|
||||
PRBool beginContent = PR_FALSE;
|
||||
|
||||
nsPoint pt = nsLayoutUtils::GetEventCoordinatesForNearestView(aEvent, this);
|
||||
|
||||
rv = GetContentAndOffsetsFromPoint(aPresContext,
|
||||
aEvent->point,
|
||||
pt,
|
||||
getter_AddRefs(newContent),
|
||||
startPos,
|
||||
contentOffsetEnd,
|
||||
|
@ -1746,19 +1746,22 @@ NS_IMETHODIMP nsFrame::HandleDrag(nsPresContext* aPresContext,
|
|||
getter_AddRefs(parentContent),
|
||||
&contentOffset, &target);
|
||||
|
||||
if (NS_SUCCEEDED(result) && parentContent)
|
||||
if (NS_SUCCEEDED(result) && parentContent) {
|
||||
frameselection->HandleTableSelection(parentContent, contentOffset, target, me);
|
||||
else
|
||||
frameselection->HandleDrag(aPresContext, this, aEvent->point);
|
||||
} else {
|
||||
nsPoint pt = nsLayoutUtils::GetEventCoordinatesForNearestView(aEvent, this);
|
||||
frameselection->HandleDrag(aPresContext, this, pt);
|
||||
}
|
||||
|
||||
nsIView* captureView = GetNearestCapturingView(this);
|
||||
if (captureView) {
|
||||
// Get the view that aEvent->point is relative to. This is disgusting.
|
||||
nsPoint dummyPoint;
|
||||
nsIView* eventView;
|
||||
GetOffsetFromView(dummyPoint, &eventView);
|
||||
nsPoint pt = aEvent->point + eventView->GetOffsetTo(captureView);
|
||||
frameselection->StartAutoScrollTimer(aPresContext, captureView, pt, 30);
|
||||
nsIView* eventView = nsnull;
|
||||
nsPoint pt = nsLayoutUtils::GetEventCoordinatesForNearestView(aEvent, this,
|
||||
&eventView);
|
||||
nsPoint capturePt = pt + eventView->GetOffsetTo(captureView);
|
||||
frameselection->StartAutoScrollTimer(aPresContext, captureView, capturePt,
|
||||
30);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
@ -1843,7 +1846,12 @@ NS_IMETHODIMP nsFrame::HandleRelease(nsPresContext* aPresContext,
|
|||
PRInt32 startOffset = 0, endOffset = 0;
|
||||
PRBool beginFrameContent = PR_FALSE;
|
||||
|
||||
result = GetContentAndOffsetsFromPoint(aPresContext, me->point, getter_AddRefs(content), startOffset, endOffset, beginFrameContent);
|
||||
nsPoint pt = nsLayoutUtils::GetEventCoordinatesForNearestView(me,
|
||||
this);
|
||||
result = GetContentAndOffsetsFromPoint(aPresContext, pt,
|
||||
getter_AddRefs(content),
|
||||
startOffset, endOffset,
|
||||
beginFrameContent);
|
||||
if (NS_FAILED(result)) return result;
|
||||
|
||||
// do we have CSS that changes selection behaviour?
|
||||
|
|
|
@ -1459,9 +1459,7 @@ nsHTMLFramesetFrame::StartMouseDrag(nsPresContext* aPresContext,
|
|||
//XXX This should go away! Border should have own view instead
|
||||
viewMan->SetViewCheckChildEvents(view, PR_FALSE);
|
||||
|
||||
// The point isn't in frameset coords, but we're using it to compute
|
||||
// moves relative to the start position.
|
||||
mFirstDragPoint.MoveTo(aEvent->point.x, aEvent->point.y);
|
||||
mFirstDragPoint = aEvent->refPoint;
|
||||
|
||||
// Store the original frame sizes
|
||||
if (mDragger->mVertical) {
|
||||
|
@ -1483,8 +1481,9 @@ nsHTMLFramesetFrame::MouseDrag(nsPresContext* aPresContext,
|
|||
nsGUIEvent* aEvent)
|
||||
{
|
||||
PRInt32 change; // measured positive from left-to-right or top-to-bottom
|
||||
float p2t = aPresContext->PixelsToTwips();
|
||||
if (mDragger->mVertical) {
|
||||
change = aEvent->point.x - mFirstDragPoint.x;
|
||||
change = NSIntPixelsToTwips(aEvent->refPoint.x - mFirstDragPoint.x, p2t);
|
||||
if (change > mNextNeighborOrigSize - mMinDrag) {
|
||||
change = mNextNeighborOrigSize - mMinDrag;
|
||||
} else if (change <= mMinDrag - mPrevNeighborOrigSize) {
|
||||
|
@ -1507,7 +1506,7 @@ nsHTMLFramesetFrame::MouseDrag(nsPresContext* aPresContext,
|
|||
mContent->SetAttr(kNameSpaceID_None, nsHTMLAtoms::cols, newColAttr, PR_TRUE);
|
||||
}
|
||||
} else {
|
||||
change = aEvent->point.y - mFirstDragPoint.y;
|
||||
change = NSIntPixelsToTwips(aEvent->refPoint.y - mFirstDragPoint.y, p2t);
|
||||
if (change > mNextNeighborOrigSize - mMinDrag) {
|
||||
change = mNextNeighborOrigSize - mMinDrag;
|
||||
} else if (change <= mMinDrag - mPrevNeighborOrigSize) {
|
||||
|
|
|
@ -597,9 +597,7 @@ CanvasFrame::HandleEvent(nsPresContext* aPresContext,
|
|||
GetOffsetFromView(pt1, &eventView);
|
||||
firstChild->GetOffsetFromView(pt2, &newEventView);
|
||||
nsPoint offset = eventView->GetOffsetTo(newEventView);
|
||||
aEvent->point += offset;
|
||||
firstChild->HandleEvent(aPresContext, aEvent, aEventStatus);
|
||||
aEvent->point -= offset;
|
||||
} else {
|
||||
nsFrame::HandleEvent(aPresContext, aEvent, aEventStatus);
|
||||
}
|
||||
|
|
|
@ -82,6 +82,7 @@
|
|||
#include "nsIServiceManager.h"
|
||||
#include "nsIDOMNode.h"
|
||||
#include "nsGUIEvent.h"
|
||||
#include "nsLayoutUtils.h"
|
||||
|
||||
#include "imgIContainer.h"
|
||||
#include "imgILoader.h"
|
||||
|
@ -1572,32 +1573,16 @@ nsImageFrame::IsServerImageMap()
|
|||
mContent->GetAttr(kNameSpaceID_None, nsHTMLAtoms::ismap, ismap);
|
||||
}
|
||||
|
||||
//XXX the event come's in in view relative coords, but really should
|
||||
//be in frame relative coords by the time it hits our frame.
|
||||
|
||||
// Translate an point that is relative to our view (or a containing
|
||||
// view) into a localized pixel coordinate that is relative to the
|
||||
// Translate an point that is relative to our frame
|
||||
// into a localized pixel coordinate that is relative to the
|
||||
// content area of this frame (inside the border+padding).
|
||||
void
|
||||
nsImageFrame::TranslateEventCoords(const nsPoint& aPoint,
|
||||
nsPoint& aResult)
|
||||
nsPoint& aResult)
|
||||
{
|
||||
nscoord x = aPoint.x;
|
||||
nscoord y = aPoint.y;
|
||||
|
||||
// If we have a view then the event coordinates are already relative
|
||||
// to this frame; otherwise we have to adjust the coordinates
|
||||
// appropriately.
|
||||
if (!HasView()) {
|
||||
nsPoint offset;
|
||||
nsIView *view;
|
||||
GetOffsetFromView(offset, &view);
|
||||
if (nsnull != view) {
|
||||
x -= offset.x;
|
||||
y -= offset.y;
|
||||
}
|
||||
}
|
||||
|
||||
// Subtract out border and padding here so that the coordinates are
|
||||
// now relative to the content area of this frame.
|
||||
nsRect inner = GetInnerArea();
|
||||
|
@ -1660,7 +1645,8 @@ nsImageFrame::GetContentForEvent(nsPresContext* aPresContext,
|
|||
|
||||
if (nsnull != map) {
|
||||
nsPoint p;
|
||||
TranslateEventCoords(aEvent->point, p);
|
||||
TranslateEventCoords(
|
||||
nsLayoutUtils::GetEventCoordinatesRelativeTo(aEvent, this), p);
|
||||
PRBool inside = PR_FALSE;
|
||||
nsCOMPtr<nsIContent> area;
|
||||
inside = map->IsInside(p.x, p.y, getter_AddRefs(area));
|
||||
|
@ -1693,7 +1679,8 @@ nsImageFrame::HandleEvent(nsPresContext* aPresContext,
|
|||
PRBool isServerMap = IsServerImageMap();
|
||||
if ((nsnull != map) || isServerMap) {
|
||||
nsPoint p;
|
||||
TranslateEventCoords(aEvent->point, p);
|
||||
TranslateEventCoords(
|
||||
nsLayoutUtils::GetEventCoordinatesRelativeTo(aEvent, this), p);
|
||||
PRBool inside = PR_FALSE;
|
||||
// Even though client-side image map triggering happens
|
||||
// through content, we need to make sure we're not inside
|
||||
|
|
|
@ -72,6 +72,7 @@
|
|||
#include "nsILineBreaker.h"
|
||||
#include "nsCompatibility.h"
|
||||
#include "nsCSSColorUtils.h"
|
||||
#include "nsLayoutUtils.h"
|
||||
|
||||
#include "nsITextContent.h"
|
||||
#include "nsTextFragment.h"
|
||||
|
@ -4835,7 +4836,8 @@ nsTextFrame::HandleMultiplePress(nsPresContext* aPresContext,
|
|||
PRInt32 startPos = 0;
|
||||
PRInt32 contentOffsetEnd = 0;
|
||||
nsCOMPtr<nsIContent> newContent;
|
||||
nsresult rv = GetPosition(aPresContext, aEvent->point,
|
||||
nsPoint pt = nsLayoutUtils::GetEventCoordinatesForNearestView(aEvent, this);
|
||||
nsresult rv = GetPosition(aPresContext, pt,
|
||||
getter_AddRefs(newContent), startPos,
|
||||
contentOffsetEnd);
|
||||
if (NS_FAILED(rv))
|
||||
|
|
|
@ -583,8 +583,11 @@ nsPopupSetFrame::OnCreate(PRInt32 aX, PRInt32 aY, nsIContent* aPopupContent)
|
|||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
nsMouseEvent event(PR_TRUE, NS_XUL_POPUP_SHOWING, nsnull,
|
||||
nsMouseEvent::eReal);
|
||||
event.point.x = aX;
|
||||
event.point.y = aY;
|
||||
// XXX The client point storage was moved to the DOM event, so now this can't
|
||||
// work. A real fix would require fixing the mess that is popup coordinates
|
||||
// in layout. For now, don't bother setting the point.
|
||||
//event.point.x = aX;
|
||||
//event.point.y = aY;
|
||||
|
||||
if (aPopupContent) {
|
||||
nsIPresShell *shell = mPresContext->GetPresShell();
|
||||
|
@ -661,8 +664,9 @@ nsPopupSetFrame::OnCreated(PRInt32 aX, PRInt32 aY, nsIContent* aPopupContent)
|
|||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
nsMouseEvent event(PR_TRUE, NS_XUL_POPUP_SHOWN, nsnull,
|
||||
nsMouseEvent::eReal);
|
||||
event.point.x = aX;
|
||||
event.point.y = aY;
|
||||
// XXX See OnCreate above
|
||||
//event.point.x = aX;
|
||||
//event.point.y = aY;
|
||||
|
||||
if (aPopupContent) {
|
||||
nsIPresShell *shell = mPresContext->GetPresShell();
|
||||
|
|
|
@ -76,7 +76,7 @@
|
|||
#include "nsIServiceManager.h"
|
||||
#include "nsGUIEvent.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsIPrivateDOMEvent.h"
|
||||
#include "nsLayoutUtils.h"
|
||||
|
||||
PRBool nsSliderFrame::gMiddlePref = PR_FALSE;
|
||||
PRInt32 nsSliderFrame::gSnapMultiplier = 6;
|
||||
|
@ -447,20 +447,20 @@ nsSliderFrame::HandleEvent(nsPresContext* aPresContext,
|
|||
|
||||
switch (aEvent->message) {
|
||||
case NS_MOUSE_MOVE: {
|
||||
nsPoint eventPoint = nsLayoutUtils::GetEventCoordinatesRelativeTo(aEvent,
|
||||
this);
|
||||
if (mChange) {
|
||||
// We're in the process of moving the thumb to the mouse,
|
||||
// but the mouse just moved. Make sure to update our
|
||||
// destination point.
|
||||
mDestinationPoint = EventPointInOurCoords(aEvent);
|
||||
mDestinationPoint = eventPoint;
|
||||
nsRepeatService::GetInstance()->Stop();
|
||||
nsRepeatService::GetInstance()->Start(mMediator);
|
||||
break;
|
||||
}
|
||||
|
||||
// convert coord to pixels
|
||||
nsPoint eventPoint = EventPointInOurCoords(aEvent);
|
||||
nscoord pos = isHorizontal ? eventPoint.x : eventPoint.y;
|
||||
|
||||
|
||||
nscoord onePixel = aPresContext->IntScaledPixelsToTwips(1);
|
||||
|
||||
nsIFrame* thumbFrame = mFrames.FirstChild();
|
||||
|
@ -534,7 +534,8 @@ nsSliderFrame::HandleEvent(nsPresContext* aPresContext,
|
|||
else if ((aEvent->message == NS_MOUSE_LEFT_BUTTON_DOWN && ((nsMouseEvent *)aEvent)->isShift)
|
||||
|| (gMiddlePref && aEvent->message == NS_MOUSE_MIDDLE_BUTTON_DOWN)) {
|
||||
// convert coord from twips to pixels
|
||||
nsPoint eventPoint = EventPointInOurCoords(aEvent);
|
||||
nsPoint eventPoint = nsLayoutUtils::GetEventCoordinatesRelativeTo(aEvent,
|
||||
this);
|
||||
nscoord pos = isHorizontal ? eventPoint.x : eventPoint.y;
|
||||
|
||||
nscoord onePixel = aPresContext->IntScaledPixelsToTwips(1);
|
||||
|
@ -902,18 +903,6 @@ nsSliderFrame::isDraggingThumb()
|
|||
return PR_FALSE;
|
||||
}
|
||||
|
||||
nsPoint
|
||||
nsSliderFrame::EventPointInOurCoords(nsEvent* aEvent)
|
||||
{
|
||||
// aEvent->point is in the coordinate system of the view returned by
|
||||
// GetOffsetFromView.
|
||||
nsPoint eventPoint = aEvent->point;
|
||||
nsPoint viewOffset;
|
||||
nsIView* dummy;
|
||||
GetOffsetFromView(viewOffset, &dummy);
|
||||
return eventPoint - viewOffset;
|
||||
}
|
||||
|
||||
void
|
||||
nsSliderFrame::AddListener()
|
||||
{
|
||||
|
@ -961,7 +950,8 @@ nsSliderFrame::HandlePress(nsPresContext* aPresContext,
|
|||
nsRect thumbRect = thumbFrame->GetRect();
|
||||
|
||||
nscoord change = 1;
|
||||
nsPoint eventPoint = EventPointInOurCoords(aEvent);
|
||||
nsPoint eventPoint = nsLayoutUtils::GetEventCoordinatesRelativeTo(aEvent,
|
||||
this);
|
||||
if (IsHorizontal() ? eventPoint.x < thumbRect.x
|
||||
: eventPoint.y < thumbRect.y)
|
||||
change = -1;
|
||||
|
|
|
@ -230,9 +230,6 @@ private:
|
|||
void RemoveListener();
|
||||
PRBool isDraggingThumb();
|
||||
|
||||
// Convert aEvent->point into our coordinate system
|
||||
nsPoint EventPointInOurCoords(nsEvent* aEvent);
|
||||
|
||||
float mRatio;
|
||||
|
||||
nscoord mDragStart;
|
||||
|
|
|
@ -76,6 +76,7 @@
|
|||
#include "nsAutoPtr.h"
|
||||
#include "nsContentCID.h"
|
||||
#include "nsStyleSet.h"
|
||||
#include "nsLayoutUtils.h"
|
||||
|
||||
// was used in nsSplitterFrame::Init but now commented out
|
||||
//static NS_DEFINE_IID(kLookAndFeelCID, NS_LOOKANDFEEL_CID);
|
||||
|
@ -161,7 +162,7 @@ public:
|
|||
|
||||
nsSplitterFrame* mOuter;
|
||||
PRBool mDidDrag;
|
||||
PRInt32 mDragStartPx;
|
||||
nscoord mDragStart;
|
||||
nscoord mCurrentPos;
|
||||
nsIBox* mParentBox;
|
||||
PRBool mPressed;
|
||||
|
@ -518,14 +519,11 @@ nsSplitterFrameInner::MouseDrag(nsPresContext* aPresContext, nsGUIEvent* aEvent)
|
|||
|
||||
PRBool isHorizontal = !mOuter->IsHorizontal();
|
||||
// convert coord to pixels
|
||||
nscoord pos = isHorizontal ? aEvent->point.x : aEvent->point.y;
|
||||
nsPoint pt = nsLayoutUtils::GetEventCoordinatesRelativeTo(aEvent, mOuter);
|
||||
nscoord pos = isHorizontal ? pt.x : pt.y;
|
||||
|
||||
// mDragStartPx is in pixels and is in our client area's coordinate system.
|
||||
// so we need to first convert it so twips and then get it into our
|
||||
// coordinate system.
|
||||
|
||||
// convert start to twips
|
||||
nscoord start = aPresContext->IntScaledPixelsToTwips(mDragStartPx);
|
||||
// mDragStart is in frame coordinates
|
||||
nscoord start = mDragStart;
|
||||
|
||||
// get it into our coordinate system (that is, the coordinate
|
||||
// system that aEvent->point is in)
|
||||
|
@ -865,20 +863,22 @@ nsSplitterFrameInner::MouseDown(nsIDOMEvent* aMouseEvent)
|
|||
|
||||
nsRect vr = mOuter->GetView()->GetBounds();
|
||||
|
||||
PRInt32 c = 0;
|
||||
PRInt32 c;
|
||||
nsPoint pt = nsLayoutUtils::GetDOMEventCoordinatesRelativeTo(mouseEvent,
|
||||
mOuter);
|
||||
if (isHorizontal) {
|
||||
mouseEvent->GetClientX(&c);
|
||||
c = pt.x;
|
||||
mSplitterPos = mOuter->mRect.x;
|
||||
mSplitterViewPos = vr.x;
|
||||
} else {
|
||||
mouseEvent->GetClientY(&c);
|
||||
c = pt.y;
|
||||
mSplitterPos = mOuter->mRect.y;
|
||||
mSplitterViewPos = vr.y;
|
||||
}
|
||||
|
||||
mDragStartPx = c;
|
||||
mDragStart = c;
|
||||
|
||||
//printf("Pressed mDragStartPx=%d\n",mDragStartPx);
|
||||
//printf("Pressed mDragStart=%d\n",mDragStart);
|
||||
|
||||
mOuter->CaptureMouse(mOuter->mPresContext, PR_TRUE);
|
||||
|
||||
|
|
|
@ -96,6 +96,7 @@
|
|||
#include "imgILoader.h"
|
||||
#include "nsINodeInfo.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsLayoutUtils.h"
|
||||
|
||||
#ifdef IBMBIDI
|
||||
#include "nsBidiPresUtils.h"
|
||||
|
@ -3399,14 +3400,11 @@ nsTreeBodyFrame::ComputeDropPosition(nsGUIEvent* aEvent, PRInt32* aRow, PRInt16*
|
|||
*aOrient = -1;
|
||||
*aScrollLines = 0;
|
||||
|
||||
// Convert the event's point to our coordinates. The point is currently in
|
||||
// the coordinates of the view returned by GetOffsetFromView. We want it in
|
||||
// Convert the event's point to our coordinates. We want it in
|
||||
// the coordinates of our inner box's coordinates.
|
||||
nsPoint offsetFromView;
|
||||
nsIView* dummy;
|
||||
GetOffsetFromView(offsetFromView, &dummy);
|
||||
PRInt32 xTwips = aEvent->point.x - offsetFromView.x - mInnerBox.x;
|
||||
PRInt32 yTwips = aEvent->point.y - offsetFromView.y - mInnerBox.y;
|
||||
nsPoint pt = nsLayoutUtils::GetEventCoordinatesRelativeTo(aEvent, this);
|
||||
PRInt32 xTwips = pt.x - mInnerBox.x;
|
||||
PRInt32 yTwips = pt.y - mInnerBox.y;
|
||||
|
||||
*aRow = GetRowAt(xTwips, yTwips);
|
||||
if (*aRow >=0) {
|
||||
|
|
|
@ -2186,9 +2186,9 @@ NS_IMETHODIMP nsViewManager::DispatchEvent(nsGUIEvent *aEvent, nsEventStatus *aS
|
|||
// so we need to add the offset to the view origin
|
||||
rootOffset += baseView->GetDimensions().TopLeft();
|
||||
mMouseLocation.MoveTo(NSTwipsToIntPixels(rootOffset.x, t2p) +
|
||||
aEvent->point.x,
|
||||
aEvent->refPoint.x,
|
||||
NSTwipsToIntPixels(rootOffset.y, t2p) +
|
||||
aEvent->point.y);
|
||||
aEvent->refPoint.y);
|
||||
#ifdef DEBUG_MOUSE_LOCATION
|
||||
if (aEvent->message == NS_MOUSE_ENTER)
|
||||
printf("[vm=%p]got mouse enter for %p\n",
|
||||
|
@ -2229,32 +2229,20 @@ NS_IMETHODIMP nsViewManager::DispatchEvent(nsGUIEvent *aEvent, nsEventStatus *aS
|
|||
parent->ConvertFromParentCoords(&offset.x, &offset.y);
|
||||
}
|
||||
|
||||
//Dispatch the event
|
||||
//Before we start mucking with coords, make sure we know our baseline
|
||||
aEvent->refPoint.x = aEvent->point.x;
|
||||
aEvent->refPoint.y = aEvent->point.y;
|
||||
|
||||
// Dispatch the event
|
||||
nsRect baseViewDimensions;
|
||||
if (baseView != nsnull) {
|
||||
baseView->GetDimensions(baseViewDimensions);
|
||||
}
|
||||
|
||||
nsPoint oldpt = aEvent->point;
|
||||
// Set the mouse cursor to the middle of the pixel, because
|
||||
// that's how we paint --- a frame paints a pixel if it covers
|
||||
// the center of the pixel
|
||||
aEvent->point.x = baseViewDimensions.x +
|
||||
NSFloatPixelsToTwips(float(aEvent->point.x) + 0.5f, p2t);
|
||||
aEvent->point.y = baseViewDimensions.y +
|
||||
NSFloatPixelsToTwips(float(aEvent->point.y) + 0.5f, p2t);
|
||||
nsPoint pt;
|
||||
pt.x = baseViewDimensions.x +
|
||||
NSFloatPixelsToTwips(float(aEvent->refPoint.x) + 0.5f, p2t);
|
||||
pt.y = baseViewDimensions.y +
|
||||
NSFloatPixelsToTwips(float(aEvent->refPoint.y) + 0.5f, p2t);
|
||||
pt += offset;
|
||||
|
||||
aEvent->point.x += offset.x;
|
||||
aEvent->point.y += offset.y;
|
||||
|
||||
*aStatus = HandleEvent(view, aEvent, capturedEvent);
|
||||
|
||||
// From here on out, "this" could have been deleted!!!
|
||||
aEvent->point = oldpt;
|
||||
*aStatus = HandleEvent(view, pt, aEvent, capturedEvent);
|
||||
|
||||
//
|
||||
// if the event is an nsTextEvent, we need to map the reply back into platform coordinates
|
||||
|
@ -2474,8 +2462,9 @@ void nsViewManager::BuildDisplayList(nsView* aView, const nsRect& aRect,
|
|||
}
|
||||
}
|
||||
|
||||
void nsViewManager::BuildEventTargetList(nsVoidArray &aTargets, nsView* aView, nsGUIEvent* aEvent,
|
||||
PRBool aCaptured, PLArenaPool &aPool)
|
||||
void nsViewManager::BuildEventTargetList(nsVoidArray &aTargets, nsView* aView,
|
||||
nsPoint aPoint, PRBool aCaptured,
|
||||
PLArenaPool &aPool)
|
||||
{
|
||||
NS_ASSERTION(!IsPainting(),
|
||||
"View manager cannot handle events during a paint");
|
||||
|
@ -2483,7 +2472,7 @@ void nsViewManager::BuildEventTargetList(nsVoidArray &aTargets, nsView* aView, n
|
|||
return;
|
||||
}
|
||||
|
||||
nsRect eventRect(aEvent->point.x, aEvent->point.y, 1, 1);
|
||||
nsRect eventRect(aPoint.x, aPoint.y, 1, 1);
|
||||
nsAutoVoidArray displayList;
|
||||
BuildDisplayList(aView, eventRect, PR_TRUE, aCaptured, nsnull, &displayList, aPool);
|
||||
|
||||
|
@ -2501,7 +2490,8 @@ void nsViewManager::BuildEventTargetList(nsVoidArray &aTargets, nsView* aView, n
|
|||
}
|
||||
}
|
||||
|
||||
nsEventStatus nsViewManager::HandleEvent(nsView* aView, nsGUIEvent* aEvent, PRBool aCaptured) {
|
||||
nsEventStatus nsViewManager::HandleEvent(nsView* aView, nsPoint aPoint,
|
||||
nsGUIEvent* aEvent, PRBool aCaptured) {
|
||||
//printf(" %d %d %d %d (%d,%d) \n", this, event->widget, event->widgetSupports,
|
||||
// event->message, event->point.x, event->point.y);
|
||||
|
||||
|
@ -2528,7 +2518,7 @@ nsEventStatus nsViewManager::HandleEvent(nsView* aView, nsGUIEvent* aEvent, PRBo
|
|||
// In fact, we only need to take this expensive path when the event is a mouse event ... riiiight?
|
||||
PLArenaPool displayArena;
|
||||
PL_INIT_ARENA_POOL(&displayArena, "displayArena", 1024);
|
||||
BuildEventTargetList(targetViews, aView, aEvent, aCaptured, displayArena);
|
||||
BuildEventTargetList(targetViews, aView, aPoint, aCaptured, displayArena);
|
||||
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
|
||||
|
@ -2546,8 +2536,6 @@ nsEventStatus nsViewManager::HandleEvent(nsView* aView, nsGUIEvent* aEvent, PRBo
|
|||
}
|
||||
}
|
||||
|
||||
// Save aEvent->point because child code might change it
|
||||
nsPoint pt = aEvent->point;
|
||||
for (i = 0; i < targetViews.Count(); i++) {
|
||||
DisplayListElement2* element = NS_STATIC_CAST(DisplayListElement2*, targetViews.ElementAt(i));
|
||||
nsView* v = element->mView;
|
||||
|
@ -2557,8 +2545,6 @@ nsEventStatus nsViewManager::HandleEvent(nsView* aView, nsGUIEvent* aEvent, PRBo
|
|||
nsRect r;
|
||||
v->GetDimensions(r);
|
||||
|
||||
aEvent->point = pt - (nsPoint(element->mAbsX, element->mAbsY) - r.TopLeft());
|
||||
|
||||
nsViewManager* vVM = v->GetViewManager();
|
||||
if (vVM == this) {
|
||||
if (nsnull != obs) {
|
||||
|
@ -2581,9 +2567,6 @@ nsEventStatus nsViewManager::HandleEvent(nsView* aView, nsGUIEvent* aEvent, PRBo
|
|||
// we'll crash in the next iteration. Oh well. The old code would have crashed too.
|
||||
}
|
||||
}
|
||||
// Need to restore the event point here because someone may use it later.
|
||||
// In particular Windows seems to need this.
|
||||
aEvent->point = pt;
|
||||
|
||||
PL_FreeArenaPool(&displayArena);
|
||||
PL_FinishArenaPool(&displayArena);
|
||||
|
@ -4520,7 +4503,7 @@ nsViewManager::ProcessSynthMouseMoveEvent(PRBool aFromScroll)
|
|||
|
||||
nsMouseEvent event(PR_TRUE, NS_MOUSE_MOVE, mRootView->GetWidget(),
|
||||
nsMouseEvent::eSynthesized);
|
||||
event.point = mMouseLocation;
|
||||
event.refPoint = mMouseLocation;
|
||||
event.time = PR_IntervalNow();
|
||||
// XXX set event.isShift, event.isControl, event.isAlt, event.isMeta ?
|
||||
|
||||
|
|
|
@ -317,8 +317,8 @@ private:
|
|||
void BuildDisplayList(nsView* aView, const nsRect& aRect, PRBool aEventProcessing,
|
||||
PRBool aCaptured, nsIView* aSuppressScrolling,
|
||||
nsVoidArray* aDisplayList, PLArenaPool &aPool);
|
||||
void BuildEventTargetList(nsVoidArray &aTargets, nsView* aView,
|
||||
nsGUIEvent* aEvent, PRBool aCaptured, PLArenaPool &aPool);
|
||||
void BuildEventTargetList(nsVoidArray &aTargets, nsView* aView, nsPoint aPoint,
|
||||
PRBool aCaptured, PLArenaPool &aPool);
|
||||
|
||||
PRBool CreateDisplayList(nsView *aView,
|
||||
DisplayZTreeNode* &aResult,
|
||||
|
@ -461,7 +461,8 @@ public: // NOT in nsIViewManager, so private to the view module
|
|||
nsViewManager* RootViewManager() const { return mRootViewManager; }
|
||||
PRBool IsRootVM() const { return this == RootViewManager(); }
|
||||
|
||||
nsEventStatus HandleEvent(nsView* aView, nsGUIEvent* aEvent, PRBool aCaptured);
|
||||
nsEventStatus HandleEvent(nsView* aView, nsPoint aPoint, nsGUIEvent* aEvent,
|
||||
PRBool aCaptured);
|
||||
|
||||
/**
|
||||
* Called to inform the view manager that a view is about to bit-blit.
|
||||
|
|
|
@ -368,7 +368,6 @@ protected:
|
|||
nsEvent(PRBool isTrusted, PRUint32 msg, PRUint8 structType)
|
||||
: eventStructType(structType),
|
||||
message(msg),
|
||||
point(0, 0),
|
||||
refPoint(0, 0),
|
||||
time(0),
|
||||
flags(0),
|
||||
|
@ -382,7 +381,6 @@ public:
|
|||
nsEvent(PRBool isTrusted, PRUint32 msg)
|
||||
: eventStructType(NS_EVENT),
|
||||
message(msg),
|
||||
point(0, 0),
|
||||
refPoint(0, 0),
|
||||
time(0),
|
||||
flags(0),
|
||||
|
@ -396,9 +394,6 @@ public:
|
|||
PRUint8 eventStructType;
|
||||
// See GUI MESSAGES,
|
||||
PRUint32 message;
|
||||
// In widget relative coordinates, modified to be relative to
|
||||
// current view in layout.
|
||||
nsPoint point;
|
||||
// In widget relative coordinates, not modified by layout code.
|
||||
nsPoint refPoint;
|
||||
// Elapsed time, in milliseconds, from the time the system was
|
||||
|
|
|
@ -254,13 +254,13 @@ void nsWindow::InitEvent(nsGUIEvent& event, nsPoint* aPoint)
|
|||
if (nsnull == aPoint) // use the point from the event
|
||||
{
|
||||
// get the message position in client coordinates and in twips
|
||||
event.point.x = 0;
|
||||
event.point.y = 0;
|
||||
event.refPoint.x = 0;
|
||||
event.refPoint.y = 0;
|
||||
}
|
||||
else // use the point override if provided
|
||||
{
|
||||
event.point.x = aPoint->x;
|
||||
event.point.y = aPoint->y;
|
||||
event.refPoint.x = aPoint->x;
|
||||
event.refPoint.y = aPoint->y;
|
||||
}
|
||||
event.time = PR_IntervalNow();
|
||||
}
|
||||
|
@ -1804,8 +1804,8 @@ bool nsWindow::CallMethod(MethodInfo *info)
|
|||
|
||||
scrollEvent.time = PR_IntervalNow();
|
||||
|
||||
scrollEvent.point.x = cursor.x;
|
||||
scrollEvent.point.y = cursor.y;
|
||||
scrollEvent.refPoint.x = cursor.x;
|
||||
scrollEvent.refPoint.y = cursor.y;
|
||||
|
||||
// we don't use the mIsXDown bools because
|
||||
// they get reset on Gecko reload (makes it harder
|
||||
|
@ -2342,8 +2342,8 @@ PRBool nsWindow::OnMove(PRInt32 aX, PRInt32 aY)
|
|||
{
|
||||
nsGUIEvent event(PR_TRUE, NS_MOVE, this);
|
||||
InitEvent(event);
|
||||
event.point.x = aX;
|
||||
event.point.y = aY;
|
||||
event.refPoint.x = aX;
|
||||
event.refPoint.y = aY;
|
||||
|
||||
PRBool result = DispatchWindowEvent(&event);
|
||||
NS_RELEASE(event.widget);
|
||||
|
|
|
@ -1677,7 +1677,7 @@ PRBool nsChildView::DispatchMouseEvent(nsMouseEvent &aEvent)
|
|||
result = ConvertStatus(mMouseListener->MouseMoved(aEvent));
|
||||
nsRect rect;
|
||||
GetBounds(rect);
|
||||
if (rect.Contains(aEvent.point.x, aEvent.point.y))
|
||||
if (rect.Contains(aEvent.refPoint.x, aEvent.refPoint.y))
|
||||
{
|
||||
//if (mWindowPtr == NULL || mWindowPtr != this)
|
||||
//{
|
||||
|
@ -1733,8 +1733,8 @@ PRBool nsChildView::ReportMoveEvent()
|
|||
{
|
||||
// nsEvent
|
||||
nsGUIEvent moveEvent(PR_TRUE, NS_MOVE, this);
|
||||
moveEvent.point.x = mBounds.x;
|
||||
moveEvent.point.y = mBounds.y;
|
||||
moveEvent.refPoint.x = mBounds.x;
|
||||
moveEvent.refPoint.y = mBounds.y;
|
||||
moveEvent.time = PR_IntervalNow();
|
||||
|
||||
// dispatch event
|
||||
|
@ -2079,7 +2079,7 @@ nsChildView::DragEvent(PRUint32 aMessage, PRInt16 aMouseGlobalX, PRInt16 aMouseG
|
|||
// hack, because we're currently getting the point in Carbon global coordinates,
|
||||
// but obviously the cocoa views don't know how to convert those (because they
|
||||
// use an entirely different coordinate system).
|
||||
geckoEvent.point.x = 50; geckoEvent.point.y = 50;
|
||||
geckoEvent.refPoint.x = 50; geckoEvent.refPoint.y = 50;
|
||||
//printf("mouse location is %d %d\n", geckoEvent.point.x, geckoEvent.point.y);
|
||||
DispatchWindowEvent(geckoEvent);
|
||||
|
||||
|
@ -2919,8 +2919,8 @@ nsChildView::Idle()
|
|||
// convert point to view coordinate system
|
||||
NSPoint localPoint = [self convertPoint:mouseLoc fromView:nil];
|
||||
|
||||
outGeckoEvent->refPoint.x = outGeckoEvent->point.x = NS_STATIC_CAST(nscoord, localPoint.x);
|
||||
outGeckoEvent->refPoint.y = outGeckoEvent->point.y = NS_STATIC_CAST(nscoord, localPoint.y);
|
||||
outGeckoEvent->refPoint.x = NS_STATIC_CAST(nscoord, localPoint.x);
|
||||
outGeckoEvent->refPoint.y = NS_STATIC_CAST(nscoord, localPoint.y);
|
||||
}
|
||||
|
||||
// set up modifier keys
|
||||
|
@ -3311,7 +3311,7 @@ static void ConvertCocoaKeyEventToMacEvent(NSEvent* cocoaEvent, EventRecord& mac
|
|||
{
|
||||
// Fire a key down.
|
||||
nsKeyEvent geckoEvent(PR_TRUE, 0, nsnull);
|
||||
geckoEvent.point.x = geckoEvent.point.y = 0;
|
||||
geckoEvent.refPoint.x = geckoEvent.refPoint.y = 0;
|
||||
[self convertKeyEvent:theEvent
|
||||
message:NS_KEY_DOWN
|
||||
toGeckoEvent:&geckoEvent];
|
||||
|
@ -3339,7 +3339,7 @@ static void ConvertCocoaKeyEventToMacEvent(NSEvent* cocoaEvent, EventRecord& mac
|
|||
{
|
||||
// Fire a key press.
|
||||
nsKeyEvent geckoEvent(PR_TRUE, 0, nsnull);
|
||||
geckoEvent.point.x = geckoEvent.point.y = 0;
|
||||
geckoEvent.refPoint.x = geckoEvent.refPoint.y = 0;
|
||||
|
||||
[self convertKeyEvent:theEvent
|
||||
message:NS_KEY_PRESS
|
||||
|
@ -3398,7 +3398,7 @@ static void ConvertCocoaKeyEventToMacEvent(NSEvent* cocoaEvent, EventRecord& mac
|
|||
|
||||
// Fire a key up.
|
||||
nsKeyEvent geckoEvent(PR_TRUE, 0, nsnull);
|
||||
geckoEvent.point.x = geckoEvent.point.y = 0;
|
||||
geckoEvent.refPoint.x = geckoEvent.refPoint.y = 0;
|
||||
|
||||
[self convertKeyEvent:theEvent
|
||||
message:NS_KEY_UP
|
||||
|
|
|
@ -685,8 +685,8 @@ PRBool nsWidget::OnResize(nsRect &aRect)
|
|||
nsRect *foo = new nsRect(0, 0, aRect.width, aRect.height);
|
||||
event.windowSize = foo;
|
||||
|
||||
event.point.x = 0;
|
||||
event.point.y = 0;
|
||||
event.refPoint.x = 0;
|
||||
event.refPoint.y = 0;
|
||||
event.mWinWidth = aRect.width;
|
||||
event.mWinHeight = aRect.height;
|
||||
|
||||
|
@ -720,8 +720,8 @@ PRBool nsWidget::OnMove(PRInt32 aX, PRInt32 aY)
|
|||
|
||||
nsGUIEvent event(PR_TRUE, NS_MOVE, this);
|
||||
InitEvent(event);
|
||||
event.point.x = aX;
|
||||
event.point.y = aY;
|
||||
event.refPoint.x = aX;
|
||||
event.refPoint.y = aY;
|
||||
PRBool result = DispatchWindowEvent(&event);
|
||||
return result;
|
||||
}
|
||||
|
@ -1407,19 +1407,19 @@ void nsWidget::InitEvent(nsGUIEvent& event, nsPoint* aPoint)
|
|||
|
||||
if (ge != nsnull) {
|
||||
// ::ScreenToClient(mWnd, &cpos);
|
||||
event.point.x = PRInt32(ge->configure.x);
|
||||
event.point.y = PRInt32(ge->configure.y);
|
||||
event.refPoint.x = PRInt32(ge->configure.x);
|
||||
event.refPoint.y = PRInt32(ge->configure.y);
|
||||
}
|
||||
}
|
||||
else { // use the point override if provided
|
||||
event.point.x = aPoint->x;
|
||||
event.point.y = aPoint->y;
|
||||
event.refPoint.x = aPoint->x;
|
||||
event.refPoint.y = aPoint->y;
|
||||
}
|
||||
|
||||
event.time = gdk_event_get_time(ge);
|
||||
|
||||
// mLastPoint.x = event.point.x;
|
||||
// mLastPoint.y = event.point.y;
|
||||
// mLastPoint.x = event.refPoint.x;
|
||||
// mLastPoint.y = event.refPoint.y;
|
||||
|
||||
if (ge)
|
||||
gdk_event_free(ge);
|
||||
|
@ -1593,7 +1593,7 @@ PRBool nsWidget::DispatchMouseEvent(nsMouseEvent& aEvent)
|
|||
// result = ConvertStatus(mMouseListener->MouseMoved(aEvent));
|
||||
// nsRect rect;
|
||||
// GetBounds(rect);
|
||||
// if (rect.Contains(event.point.x, event.point.y)) {
|
||||
// if (rect.Contains(event.refPoint.x, event.refPoint.y)) {
|
||||
// if (mCurrentWindow == NULL || mCurrentWindow != this) {
|
||||
// printf("Mouse enter");
|
||||
// mCurrentWindow = this;
|
||||
|
@ -1756,8 +1756,8 @@ nsWidget::OnMotionNotifySignal(GdkEventMotion * aGdkMotionEvent)
|
|||
x = (gint) aGdkMotionEvent->x;
|
||||
y = (gint) aGdkMotionEvent->y;
|
||||
|
||||
event.point.x = nscoord(x);
|
||||
event.point.y = nscoord(y);
|
||||
event.refPoint.x = nscoord(x);
|
||||
event.refPoint.y = nscoord(y);
|
||||
event.widget = this;
|
||||
}
|
||||
|
||||
|
@ -1776,8 +1776,8 @@ nsWidget::OnMotionNotifySignal(GdkEventMotion * aGdkMotionEvent)
|
|||
|
||||
// The event coords will be the initial *widget* coords plus the
|
||||
// root difference computed above.
|
||||
event.point.x = nscoord(sButtonMotionWidgetX + diffX);
|
||||
event.point.y = nscoord(sButtonMotionWidgetY + diffY);
|
||||
event.refPoint.x = nscoord(sButtonMotionWidgetX + diffX);
|
||||
event.refPoint.y = nscoord(sButtonMotionWidgetY + diffY);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -1826,8 +1826,8 @@ nsWidget::OnEnterNotifySignal(GdkEventCrossing * aGdkCrossingEvent)
|
|||
|
||||
if (aGdkCrossingEvent != NULL)
|
||||
{
|
||||
event.point.x = nscoord(aGdkCrossingEvent->x);
|
||||
event.point.y = nscoord(aGdkCrossingEvent->y);
|
||||
event.refPoint.x = nscoord(aGdkCrossingEvent->x);
|
||||
event.refPoint.y = nscoord(aGdkCrossingEvent->y);
|
||||
event.time = aGdkCrossingEvent->time;
|
||||
}
|
||||
|
||||
|
@ -1860,8 +1860,8 @@ nsWidget::OnLeaveNotifySignal(GdkEventCrossing * aGdkCrossingEvent)
|
|||
|
||||
if (aGdkCrossingEvent != NULL)
|
||||
{
|
||||
event.point.x = nscoord(aGdkCrossingEvent->x);
|
||||
event.point.y = nscoord(aGdkCrossingEvent->y);
|
||||
event.refPoint.x = nscoord(aGdkCrossingEvent->x);
|
||||
event.refPoint.y = nscoord(aGdkCrossingEvent->y);
|
||||
event.time = aGdkCrossingEvent->time;
|
||||
}
|
||||
|
||||
|
@ -1933,8 +1933,8 @@ nsWidget::OnButtonPressSignal(GdkEventButton * aGdkButtonEvent)
|
|||
else
|
||||
scrollEvent.delta = 3;
|
||||
|
||||
scrollEvent.point.x = nscoord(aGdkButtonEvent->x);
|
||||
scrollEvent.point.y = nscoord(aGdkButtonEvent->y);
|
||||
scrollEvent.refPoint.x = nscoord(aGdkButtonEvent->x);
|
||||
scrollEvent.refPoint.y = nscoord(aGdkButtonEvent->y);
|
||||
|
||||
scrollEvent.isShift = (aGdkButtonEvent->state & GDK_SHIFT_MASK) ? PR_TRUE : PR_FALSE;
|
||||
scrollEvent.isControl = (aGdkButtonEvent->state & GDK_CONTROL_MASK) ? PR_TRUE : PR_FALSE;
|
||||
|
@ -2039,8 +2039,8 @@ nsWidget::OnButtonReleaseSignal(GdkEventButton * aGdkButtonEvent)
|
|||
event.widget = sButtonMotionTarget;
|
||||
|
||||
// see comments in nsWidget::OnMotionNotifySignal
|
||||
event.point.x = nscoord(sButtonMotionWidgetX + diffX);
|
||||
event.point.y = nscoord(sButtonMotionWidgetY + diffY);
|
||||
event.refPoint.x = nscoord(sButtonMotionWidgetX + diffX);
|
||||
event.refPoint.y = nscoord(sButtonMotionWidgetY + diffY);
|
||||
}
|
||||
|
||||
// Drop the motion target before dispatching the event so that we
|
||||
|
@ -2132,8 +2132,8 @@ nsWidget::InitMouseEvent(GdkEventButton * aGdkButtonEvent,
|
|||
nsMouseEvent &anEvent)
|
||||
{
|
||||
if (aGdkButtonEvent != NULL) {
|
||||
anEvent.point.x = nscoord(aGdkButtonEvent->x);
|
||||
anEvent.point.y = nscoord(aGdkButtonEvent->y);
|
||||
anEvent.refPoint.x = nscoord(aGdkButtonEvent->x);
|
||||
anEvent.refPoint.y = nscoord(aGdkButtonEvent->y);
|
||||
|
||||
anEvent.isShift = (aGdkButtonEvent->state & GDK_SHIFT_MASK) ? PR_TRUE : PR_FALSE;
|
||||
anEvent.isControl = (aGdkButtonEvent->state & GDK_CONTROL_MASK) ? PR_TRUE : PR_FALSE;
|
||||
|
|
|
@ -2972,8 +2972,8 @@ nsWindow::HandleXlibConfigureNotifyEvent(XEvent *event)
|
|||
nsSizeEvent sevent(PR_TRUE, NS_SIZE, this);
|
||||
sevent.windowSize = new nsRect (event->xconfigure.x, event->xconfigure.y,
|
||||
event->xconfigure.width, event->xconfigure.height);
|
||||
sevent.point.x = event->xconfigure.x;
|
||||
sevent.point.y = event->xconfigure.y;
|
||||
sevent.refPoint.x = event->xconfigure.x;
|
||||
sevent.refPoint.y = event->xconfigure.y;
|
||||
sevent.mWinWidth = event->xconfigure.width;
|
||||
sevent.mWinHeight = event->xconfigure.height;
|
||||
// XXX fix sevent.time
|
||||
|
@ -3255,8 +3255,8 @@ gint nsWindow::OnDragMotionSignal (GtkWidget * aWidget,
|
|||
// now that we have initialized the event update our drag status
|
||||
UpdateDragStatus(event, aDragContext, dragService);
|
||||
|
||||
event.point.x = retx;
|
||||
event.point.y = rety;
|
||||
event.refPoint.x = retx;
|
||||
event.refPoint.y = rety;
|
||||
|
||||
innerMostWidget->AddRef();
|
||||
|
||||
|
@ -3395,8 +3395,8 @@ nsWindow::OnDragDropSignal (GtkWidget *aWidget,
|
|||
// now that we have initialized the event update our drag status
|
||||
UpdateDragStatus(event, aDragContext, dragService);
|
||||
|
||||
event.point.x = retx;
|
||||
event.point.y = rety;
|
||||
event.refPoint.x = retx;
|
||||
event.refPoint.y = rety;
|
||||
|
||||
innerMostWidget->DispatchMouseEvent(event);
|
||||
|
||||
|
@ -3404,8 +3404,8 @@ nsWindow::OnDragDropSignal (GtkWidget *aWidget,
|
|||
|
||||
event.message = NS_DRAGDROP_DROP;
|
||||
event.widget = innerMostWidget;
|
||||
event.point.x = retx;
|
||||
event.point.y = rety;
|
||||
event.refPoint.x = retx;
|
||||
event.refPoint.y = rety;
|
||||
|
||||
innerMostWidget->DispatchMouseEvent(event);
|
||||
|
||||
|
@ -3516,8 +3516,8 @@ nsWindow::OnDragEnter(nscoord aX, nscoord aY)
|
|||
|
||||
nsMouseEvent event(PR_TRUE, NS_DRAGDROP_ENTER, this, nsMouseEvent::eReal);
|
||||
|
||||
event.point.x = aX;
|
||||
event.point.y = aY;
|
||||
event.refPoint.x = aX;
|
||||
event.refPoint.y = aY;
|
||||
|
||||
AddRef();
|
||||
|
||||
|
|
|
@ -81,8 +81,8 @@ void
|
|||
nsCommonWidget::InitButtonEvent(nsMouseEvent &aEvent,
|
||||
GdkEventButton *aGdkEvent)
|
||||
{
|
||||
aEvent.point.x = nscoord(aGdkEvent->x);
|
||||
aEvent.point.y = nscoord(aGdkEvent->y);
|
||||
aEvent.refPoint.x = nscoord(aGdkEvent->x);
|
||||
aEvent.refPoint.y = nscoord(aGdkEvent->y);
|
||||
|
||||
aEvent.isShift = (aGdkEvent->state & GDK_SHIFT_MASK)
|
||||
? PR_TRUE : PR_FALSE;
|
||||
|
@ -129,8 +129,8 @@ nsCommonWidget::InitMouseScrollEvent(nsMouseScrollEvent &aEvent,
|
|||
break;
|
||||
}
|
||||
|
||||
aEvent.point.x = nscoord(aGdkEvent->x);
|
||||
aEvent.point.y = nscoord(aGdkEvent->y);
|
||||
aEvent.refPoint.x = nscoord(aGdkEvent->x);
|
||||
aEvent.refPoint.y = nscoord(aGdkEvent->y);
|
||||
|
||||
aEvent.isShift = (aGdkEvent->state & GDK_SHIFT_MASK)
|
||||
? PR_TRUE : PR_FALSE;
|
||||
|
@ -196,8 +196,8 @@ nsCommonWidget::DispatchResizeEvent(nsRect &aRect, nsEventStatus &aStatus)
|
|||
nsSizeEvent event(PR_TRUE, NS_SIZE, this);
|
||||
|
||||
event.windowSize = &aRect;
|
||||
event.point.x = aRect.x;
|
||||
event.point.y = aRect.y;
|
||||
event.refPoint.x = aRect.x;
|
||||
event.refPoint.y = aRect.y;
|
||||
event.mWinWidth = aRect.width;
|
||||
event.mWinHeight = aRect.height;
|
||||
|
||||
|
|
|
@ -1335,8 +1335,8 @@ nsWindow::OnExposeEvent(GtkWidget *aWidget, GdkEventExpose *aEvent)
|
|||
}
|
||||
|
||||
nsPaintEvent event(PR_TRUE, NS_PAINT, this);
|
||||
event.point.x = aEvent->area.x;
|
||||
event.point.y = aEvent->area.y;
|
||||
event.refPoint.x = aEvent->area.x;
|
||||
event.refPoint.y = aEvent->area.y;
|
||||
event.rect = nsnull;
|
||||
event.region = updateRegion;
|
||||
event.renderingContext = rc;
|
||||
|
@ -1375,8 +1375,8 @@ nsWindow::OnConfigureEvent(GtkWidget *aWidget, GdkEventConfigure *aEvent)
|
|||
|
||||
nsGUIEvent event(PR_TRUE, NS_MOVE, this);
|
||||
|
||||
event.point.x = aEvent->x;
|
||||
event.point.y = aEvent->y;
|
||||
event.refPoint.x = aEvent->x;
|
||||
event.refPoint.y = aEvent->y;
|
||||
|
||||
// XXX mozilla will invalidate the entire window after this move
|
||||
// complete. wtf?
|
||||
|
@ -1415,8 +1415,8 @@ nsWindow::OnDeleteEvent(GtkWidget *aWidget, GdkEventAny *aEvent)
|
|||
{
|
||||
nsGUIEvent event(PR_TRUE, NS_XUL_CLOSE, this);
|
||||
|
||||
event.point.x = 0;
|
||||
event.point.y = 0;
|
||||
event.refPoint.x = 0;
|
||||
event.refPoint.y = 0;
|
||||
|
||||
nsEventStatus status;
|
||||
DispatchEvent(&event, status);
|
||||
|
@ -1430,8 +1430,8 @@ nsWindow::OnEnterNotifyEvent(GtkWidget *aWidget, GdkEventCrossing *aEvent)
|
|||
|
||||
nsMouseEvent event(PR_TRUE, NS_MOUSE_ENTER, this, nsMouseEvent::eReal);
|
||||
|
||||
event.point.x = nscoord(aEvent->x);
|
||||
event.point.y = nscoord(aEvent->y);
|
||||
event.refPoint.x = nscoord(aEvent->x);
|
||||
event.refPoint.y = nscoord(aEvent->y);
|
||||
|
||||
LOG(("OnEnterNotify: %p\n", (void *)this));
|
||||
|
||||
|
@ -1447,8 +1447,8 @@ nsWindow::OnLeaveNotifyEvent(GtkWidget *aWidget, GdkEventCrossing *aEvent)
|
|||
|
||||
nsMouseEvent event(PR_TRUE, NS_MOUSE_EXIT, this, nsMouseEvent::eReal);
|
||||
|
||||
event.point.x = nscoord(aEvent->x);
|
||||
event.point.y = nscoord(aEvent->y);
|
||||
event.refPoint.x = nscoord(aEvent->x);
|
||||
event.refPoint.y = nscoord(aEvent->y);
|
||||
|
||||
LOG(("OnLeaveNotify: %p\n", (void *)this));
|
||||
|
||||
|
@ -1480,8 +1480,8 @@ nsWindow::OnMotionNotifyEvent(GtkWidget *aWidget, GdkEventMotion *aEvent)
|
|||
nsMouseEvent event(PR_TRUE, NS_MOUSE_MOVE, this, nsMouseEvent::eReal);
|
||||
|
||||
if (synthEvent) {
|
||||
event.point.x = nscoord(xevent.xmotion.x);
|
||||
event.point.y = nscoord(xevent.xmotion.y);
|
||||
event.refPoint.x = nscoord(xevent.xmotion.x);
|
||||
event.refPoint.y = nscoord(xevent.xmotion.y);
|
||||
|
||||
event.isShift = (xevent.xmotion.state & GDK_SHIFT_MASK)
|
||||
? PR_TRUE : PR_FALSE;
|
||||
|
@ -1491,8 +1491,8 @@ nsWindow::OnMotionNotifyEvent(GtkWidget *aWidget, GdkEventMotion *aEvent)
|
|||
? PR_TRUE : PR_FALSE;
|
||||
}
|
||||
else {
|
||||
event.point.x = nscoord(aEvent->x);
|
||||
event.point.y = nscoord(aEvent->y);
|
||||
event.refPoint.x = nscoord(aEvent->x);
|
||||
event.refPoint.y = nscoord(aEvent->y);
|
||||
|
||||
event.isShift = (aEvent->state & GDK_SHIFT_MASK)
|
||||
? PR_TRUE : PR_FALSE;
|
||||
|
@ -1986,8 +1986,8 @@ nsWindow::OnDragMotionEvent(GtkWidget *aWidget,
|
|||
// now that we have initialized the event update our drag status
|
||||
UpdateDragStatus(event, aDragContext, dragService);
|
||||
|
||||
event.point.x = retx;
|
||||
event.point.y = rety;
|
||||
event.refPoint.x = retx;
|
||||
event.refPoint.y = rety;
|
||||
|
||||
innerMostWidget->AddRef();
|
||||
|
||||
|
@ -2102,16 +2102,16 @@ nsWindow::OnDragDropEvent(GtkWidget *aWidget,
|
|||
// now that we have initialized the event update our drag status
|
||||
UpdateDragStatus(event, aDragContext, dragService);
|
||||
|
||||
event.point.x = retx;
|
||||
event.point.y = rety;
|
||||
event.refPoint.x = retx;
|
||||
event.refPoint.y = rety;
|
||||
|
||||
nsEventStatus status;
|
||||
innerMostWidget->DispatchEvent(&event, status);
|
||||
|
||||
event.message = NS_DRAGDROP_DROP;
|
||||
event.widget = innerMostWidget;
|
||||
event.point.x = retx;
|
||||
event.point.y = rety;
|
||||
event.refPoint.x = retx;
|
||||
event.refPoint.y = rety;
|
||||
|
||||
innerMostWidget->DispatchEvent(&event, status);
|
||||
|
||||
|
@ -2203,8 +2203,8 @@ nsWindow::OnDragEnter(nscoord aX, nscoord aY)
|
|||
|
||||
nsMouseEvent event(PR_TRUE, NS_DRAGDROP_ENTER, this, nsMouseEvent::eReal);
|
||||
|
||||
event.point.x = aX;
|
||||
event.point.y = aY;
|
||||
event.refPoint.x = aX;
|
||||
event.refPoint.y = aY;
|
||||
|
||||
AddRef();
|
||||
|
||||
|
|
|
@ -127,8 +127,8 @@ HandleScrollEvent ( EventMouseWheelAxis inAxis, PRBool inByLine, PRInt32 inDelta
|
|||
mouseLocRelativeToWidget.MoveBy(-widgetOrigin.x, -widgetOrigin.y);
|
||||
|
||||
scrollEvent.delta = inDelta;
|
||||
scrollEvent.point.x = mouseLocRelativeToWidget.x;
|
||||
scrollEvent.point.y = mouseLocRelativeToWidget.y;
|
||||
scrollEvent.refPoint.x = mouseLocRelativeToWidget.x;
|
||||
scrollEvent.refPoint.y = mouseLocRelativeToWidget.y;
|
||||
scrollEvent.time = PR_IntervalNow();
|
||||
|
||||
// dispatch scroll event
|
||||
|
@ -525,8 +525,8 @@ PRBool nsMacEventHandler::HandleMenuCommand(
|
|||
|
||||
// nsEvent
|
||||
nsMenuEvent menuEvent(PR_TRUE, NS_MENU_SELECTED, focusedWidget);
|
||||
menuEvent.point.x = aOSEvent.where.h;
|
||||
menuEvent.point.y = aOSEvent.where.v;
|
||||
menuEvent.refPoint.x = aOSEvent.where.h;
|
||||
menuEvent.refPoint.y = aOSEvent.where.v;
|
||||
menuEvent.time = PR_IntervalNow();
|
||||
|
||||
// nsGUIEvent
|
||||
|
@ -622,7 +622,7 @@ PRBool nsMacEventHandler::DragEvent ( unsigned int aMessage, Point aMouseGlobal,
|
|||
nsMouseEvent geckoEvent(PR_TRUE, aMessage, widgetHit, nsMouseEvent::eReal);
|
||||
|
||||
// nsEvent
|
||||
geckoEvent.point = widgetHitPoint;
|
||||
geckoEvent.refPoint = widgetHitPoint;
|
||||
geckoEvent.time = PR_IntervalNow();
|
||||
|
||||
// nsInputEvent
|
||||
|
@ -1697,7 +1697,7 @@ PRBool nsMacEventHandler::HandleMouseMoveEvent( EventRecord& aOSEvent )
|
|||
if (lastWidgetPointed)
|
||||
{
|
||||
// We need to convert the coords to be relative to lastWidgetPointed.
|
||||
nsPoint widgetHitPoint = mouseEvent.point;
|
||||
nsPoint widgetHitPoint = mouseEvent.refPoint;
|
||||
|
||||
Point macPoint = aOSEvent.where;
|
||||
WindowRef wind = reinterpret_cast<WindowRef>(mTopLevelWidget->GetNativeData(NS_NATIVE_DISPLAY));
|
||||
|
@ -1716,12 +1716,12 @@ PRBool nsMacEventHandler::HandleMouseMoveEvent( EventRecord& aOSEvent )
|
|||
lastWidgetPointed->LocalToWindowCoordinate(widgetOrigin);
|
||||
lastWidgetHitPoint.MoveBy(-widgetOrigin.x, -widgetOrigin.y);
|
||||
mouseEvent.widget = lastWidgetPointed;
|
||||
mouseEvent.point = lastWidgetHitPoint;
|
||||
mouseEvent.refPoint = lastWidgetHitPoint;
|
||||
mouseEvent.message = NS_MOUSE_EXIT;
|
||||
lastWidgetPointed->DispatchMouseEvent(mouseEvent);
|
||||
retVal = PR_TRUE;
|
||||
|
||||
mouseEvent.point = widgetHitPoint;
|
||||
mouseEvent.refPoint = widgetHitPoint;
|
||||
}
|
||||
|
||||
gEventDispatchHandler.SetWidgetPointed(widgetPointed);
|
||||
|
@ -1867,7 +1867,7 @@ void nsMacEventHandler::ConvertOSEventToMouseEvent(
|
|||
|
||||
// nsEvent
|
||||
aMouseEvent.message = aMessage;
|
||||
aMouseEvent.point = widgetHitPoint;
|
||||
aMouseEvent.refPoint = widgetHitPoint;
|
||||
aMouseEvent.time = PR_IntervalNow();
|
||||
|
||||
// nsGUIEvent
|
||||
|
|
|
@ -1749,8 +1749,8 @@ nsMacWindow::ComeToFront()
|
|||
{
|
||||
nsZLevelEvent event(PR_TRUE, NS_SETZLEVEL, this);
|
||||
|
||||
event.point.x = mBounds.x;
|
||||
event.point.y = mBounds.y;
|
||||
event.refPoint.x = mBounds.x;
|
||||
event.refPoint.y = mBounds.y;
|
||||
event.time = PR_IntervalNow();
|
||||
|
||||
event.mImmediate = PR_TRUE;
|
||||
|
|
|
@ -322,8 +322,8 @@ nsNativeScrollbar::DispatchMouseEvent(nsMouseEvent &aEvent)
|
|||
StartDraw();
|
||||
{
|
||||
Point thePoint;
|
||||
thePoint.h = aEvent.point.x;
|
||||
thePoint.v = aEvent.point.y;
|
||||
thePoint.h = aEvent.refPoint.x;
|
||||
thePoint.v = aEvent.refPoint.y;
|
||||
mClickedPartCode = ::TestControl(mControl, thePoint);
|
||||
if (mClickedPartCode > 0)
|
||||
::HiliteControl(mControl, mClickedPartCode);
|
||||
|
|
|
@ -1857,7 +1857,7 @@ PRBool nsWindow::DispatchMouseEvent(nsMouseEvent &aEvent)
|
|||
result = ConvertStatus(mMouseListener->MouseMoved(aEvent));
|
||||
nsRect rect;
|
||||
GetBounds(rect);
|
||||
if (rect.Contains(aEvent.point.x, aEvent.point.y))
|
||||
if (rect.Contains(aEvent.refPoint.x, aEvent.refPoint.y))
|
||||
{
|
||||
//if (mWindowPtr == NULL || mWindowPtr != this)
|
||||
//{
|
||||
|
@ -1914,8 +1914,8 @@ PRBool nsWindow::ReportMoveEvent()
|
|||
{
|
||||
// nsEvent
|
||||
nsGUIEvent moveEvent(PR_TRUE, NS_MOVE, this);
|
||||
moveEvent.point.x = mBounds.x;
|
||||
moveEvent.point.y = mBounds.y;
|
||||
moveEvent.refPoint.x = mBounds.x;
|
||||
moveEvent.refPoint.y = mBounds.y;
|
||||
moveEvent.time = PR_IntervalNow();
|
||||
|
||||
// dispatch event
|
||||
|
|
|
@ -450,8 +450,8 @@ void nsWindow::InitEvent(nsGUIEvent& event, nsPoint* aPoint)
|
|||
|
||||
PM2NS( ptl);
|
||||
|
||||
event.point.x = ptl.x;
|
||||
event.point.y = ptl.y;
|
||||
event.refPoint.x = ptl.x;
|
||||
event.refPoint.y = ptl.y;
|
||||
|
||||
#if 0
|
||||
printf("++++++++++nsWindow::InitEvent (!pt) converted point = %ld, %ld\n", ptl.x, ptl.y);
|
||||
|
@ -459,8 +459,8 @@ void nsWindow::InitEvent(nsGUIEvent& event, nsPoint* aPoint)
|
|||
}
|
||||
else
|
||||
{ // use the point override if provided
|
||||
event.point.x = aPoint->x;
|
||||
event.point.y = aPoint->y;
|
||||
event.refPoint.x = aPoint->x;
|
||||
event.refPoint.y = aPoint->y;
|
||||
|
||||
#if 0
|
||||
printf("++++++++++nsWindow::InitEvent point = %ld, %ld\n", aPoint->x, aPoint->y);
|
||||
|
@ -470,8 +470,8 @@ void nsWindow::InitEvent(nsGUIEvent& event, nsPoint* aPoint)
|
|||
event.time = WinQueryMsgTime( 0/*hab*/);
|
||||
|
||||
/* OS2TODO
|
||||
mLastPoint.x = event.point.x;
|
||||
mLastPoint.y = event.point.y;
|
||||
mLastPoint.x = event.refPoint.x;
|
||||
mLastPoint.y = event.refPoint.y;
|
||||
*/
|
||||
}
|
||||
|
||||
|
@ -3147,8 +3147,8 @@ PRBool nsWindow::OnMove(PRInt32 aX, PRInt32 aY)
|
|||
// Params here are in XP-space for the desktop
|
||||
nsGUIEvent event(PR_TRUE, NS_MOVE, this);
|
||||
InitEvent( event);
|
||||
event.point.x = aX;
|
||||
event.point.y = aY;
|
||||
event.refPoint.x = aX;
|
||||
event.refPoint.y = aY;
|
||||
|
||||
PRBool result = DispatchWindowEvent( &event);
|
||||
NS_RELEASE(event.widget);
|
||||
|
@ -3406,7 +3406,7 @@ PRBool nsWindow::DispatchMouseEvent( PRUint32 aEventType, MPARAM mp1, MPARAM mp2
|
|||
pluginEvent.wParam |= (event.isShift) ? MK_SHIFT : 0;
|
||||
pluginEvent.wParam |= (event.isControl) ? MK_CONTROL : 0;
|
||||
*/
|
||||
pluginEvent.lParam = MAKELONG(event.point.x, event.point.y);
|
||||
pluginEvent.lParam = MAKELONG(event.refPoint.x, event.refPoint.y);
|
||||
|
||||
event.nativeMsg = (void *)&pluginEvent;
|
||||
|
||||
|
@ -3472,7 +3472,7 @@ PRBool nsWindow::DispatchMouseEvent( PRUint32 aEventType, MPARAM mp1, MPARAM mp2
|
|||
rect.x = 0;
|
||||
rect.y = 0;
|
||||
|
||||
if (rect.Contains(event.point.x, event.point.y)) {
|
||||
if (rect.Contains(event.refPoint.x, event.refPoint.y)) {
|
||||
if (gCurrentWindow == NULL || gCurrentWindow != this) {
|
||||
if ((nsnull != gCurrentWindow) && (!gCurrentWindow->mIsDestroying)) {
|
||||
MouseTrailer::IgnoreNextCycle();
|
||||
|
@ -3504,7 +3504,7 @@ PRBool nsWindow::DispatchMouseEvent( PRUint32 aEventType, MPARAM mp1, MPARAM mp2
|
|||
result = ConvertStatus(mMouseListener->MouseMoved(event));
|
||||
nsRect rect;
|
||||
GetBounds(rect);
|
||||
if (rect.Contains(event.point.x, event.point.y)) {
|
||||
if (rect.Contains(event.refPoint.x, event.refPoint.y)) {
|
||||
if (gCurrentWindow == NULL || gCurrentWindow != this) {
|
||||
gCurrentWindow = this;
|
||||
}
|
||||
|
@ -3553,8 +3553,8 @@ PRBool nsWindow::DispatchFocus(PRUint32 aEventType, PRBool isMozWindowTakingFocu
|
|||
InitEvent(event);
|
||||
|
||||
//focus and blur event should go to their base widget loc, not current mouse pos
|
||||
event.point.x = 0;
|
||||
event.point.y = 0;
|
||||
event.refPoint.x = 0;
|
||||
event.refPoint.y = 0;
|
||||
|
||||
event.isMozWindowTakingFocus = isMozWindowTakingFocus;
|
||||
|
||||
|
|
|
@ -380,8 +380,8 @@ PRBool nsWidget::OnResize( nsRect &aRect ) {
|
|||
nsRect *foo = new nsRect(0, 0, aRect.width, aRect.height);
|
||||
event.windowSize = foo;
|
||||
|
||||
event.point.x = 0;
|
||||
event.point.y = 0;
|
||||
event.refPoint.x = 0;
|
||||
event.refPoint.y = 0;
|
||||
event.mWinWidth = aRect.width;
|
||||
event.mWinHeight = aRect.height;
|
||||
|
||||
|
@ -400,8 +400,8 @@ PRBool nsWidget::OnResize( nsRect &aRect ) {
|
|||
PRBool nsWidget::OnMove( PRInt32 aX, PRInt32 aY ) {
|
||||
nsGUIEvent event(PR_TRUE, 0, nsnull);
|
||||
InitEvent(event, NS_MOVE);
|
||||
event.point.x = aX;
|
||||
event.point.y = aY;
|
||||
event.refPoint.x = aX;
|
||||
event.refPoint.y = aY;
|
||||
return DispatchWindowEvent(&event);
|
||||
}
|
||||
|
||||
|
@ -724,8 +724,8 @@ void nsWidget::InitMouseEvent(PhPointerEvent_t *aPhButtonEvent,
|
|||
anEvent.isControl = ( aPhButtonEvent->key_mods & Pk_KM_Ctrl ) ? PR_TRUE : PR_FALSE;
|
||||
anEvent.isAlt = ( aPhButtonEvent->key_mods & Pk_KM_Alt ) ? PR_TRUE : PR_FALSE;
|
||||
anEvent.isMeta = PR_FALSE;
|
||||
anEvent.point.x = aPhButtonEvent->pos.x;
|
||||
anEvent.point.y = aPhButtonEvent->pos.y;
|
||||
anEvent.refPoint.x = aPhButtonEvent->pos.x;
|
||||
anEvent.refPoint.y = aPhButtonEvent->pos.y;
|
||||
anEvent.clickCount = aPhButtonEvent->click_count;
|
||||
}
|
||||
}
|
||||
|
@ -1259,8 +1259,8 @@ void nsWidget::DispatchDragDropEvent( PhEvent_t *phevent, PRUint32 aEventType, P
|
|||
|
||||
InitEvent( event, aEventType );
|
||||
|
||||
event.point.x = pos->x;
|
||||
event.point.y = pos->y;
|
||||
event.refPoint.x = pos->x;
|
||||
event.refPoint.y = pos->y;
|
||||
|
||||
PhDndEvent_t *dnd = ( PhDndEvent_t * ) PhGetData( phevent );
|
||||
event.isControl = ( dnd->key_mods & Pk_KM_Ctrl ) ? PR_TRUE : PR_FALSE;
|
||||
|
@ -1270,7 +1270,7 @@ void nsWidget::DispatchDragDropEvent( PhEvent_t *phevent, PRUint32 aEventType, P
|
|||
|
||||
event.widget = this;
|
||||
|
||||
///* ATENTIE */ printf("DispatchDragDropEvent pos=%d %d widget=%p\n", event.point.x, event.point.y, this );
|
||||
///* ATENTIE */ printf("DispatchDragDropEvent pos=%d %d widget=%p\n", event.refPoint.x, event.refPoint.y, this );
|
||||
|
||||
DispatchEvent( &event, status );
|
||||
}
|
||||
|
|
|
@ -857,8 +857,8 @@ nsCommonWidget::DispatchResizeEvent(nsRect &aRect, nsEventStatus &aStatus)
|
|||
nsSizeEvent event(PR_TRUE, NS_SIZE, this);
|
||||
|
||||
event.windowSize = &aRect;
|
||||
event.point.x = aRect.x;
|
||||
event.point.y = aRect.y;
|
||||
event.refPoint.x = aRect.x;
|
||||
event.refPoint.y = aRect.y;
|
||||
event.mWinWidth = aRect.width;
|
||||
event.mWinHeight = aRect.height;
|
||||
|
||||
|
@ -1072,8 +1072,8 @@ nsCommonWidget::enterEvent(QEvent *)
|
|||
|
||||
QPoint pt = QCursor::pos();
|
||||
|
||||
event.point.x = nscoord(pt.x());
|
||||
event.point.y = nscoord(pt.y());
|
||||
event.refPoint.x = nscoord(pt.x());
|
||||
event.refPoint.y = nscoord(pt.y());
|
||||
|
||||
nsEventStatus status;
|
||||
DispatchEvent(&event, status);
|
||||
|
@ -1087,8 +1087,8 @@ nsCommonWidget::leaveEvent(QEvent *aEvent)
|
|||
|
||||
QPoint pt = QCursor::pos();
|
||||
|
||||
event.point.x = nscoord(pt.x());
|
||||
event.point.y = nscoord(pt.y());
|
||||
event.refPoint.x = nscoord(pt.x());
|
||||
event.refPoint.y = nscoord(pt.y());
|
||||
|
||||
nsEventStatus status;
|
||||
DispatchEvent(&event, status);
|
||||
|
@ -1112,8 +1112,8 @@ nsCommonWidget::paintEvent(QPaintEvent *e)
|
|||
|
||||
// Generate XPFE paint event
|
||||
nsPaintEvent event(PR_TRUE, NS_PAINT, this);
|
||||
event.point.x = 0;
|
||||
event.point.y = 0;
|
||||
event.refPoint.x = 0;
|
||||
event.refPoint.y = 0;
|
||||
event.rect = ▭
|
||||
// XXX fix this!
|
||||
event.region = nsnull;
|
||||
|
@ -1158,8 +1158,8 @@ nsCommonWidget::moveEvent(QMoveEvent *e)
|
|||
}
|
||||
|
||||
nsGUIEvent event(PR_TRUE, NS_MOVE, this);
|
||||
event.point.x = pos.x();
|
||||
event.point.y = pos.y();
|
||||
event.refPoint.x = pos.x();
|
||||
event.refPoint.y = pos.y();
|
||||
|
||||
// XXX mozilla will invalidate the entire window after this move
|
||||
// complete. wtf?
|
||||
|
@ -1196,8 +1196,8 @@ nsCommonWidget::closeEvent(QCloseEvent *)
|
|||
{
|
||||
nsGUIEvent event(PR_TRUE, NS_XUL_CLOSE, this);
|
||||
|
||||
event.point.x = 0;
|
||||
event.point.y = 0;
|
||||
event.refPoint.x = 0;
|
||||
event.refPoint.y = 0;
|
||||
|
||||
nsEventStatus status;
|
||||
DispatchEvent(&event, status);
|
||||
|
@ -1274,8 +1274,8 @@ nsCommonWidget::showEvent(QShowEvent *)
|
|||
nsCOMPtr<nsIRenderingContext> rc = getter_AddRefs(GetRenderingContext());
|
||||
// Generate XPFE paint event
|
||||
nsPaintEvent event(PR_TRUE, NS_PAINT, this);
|
||||
event.point.x = 0;
|
||||
event.point.y = 0;
|
||||
event.refPoint.x = 0;
|
||||
event.refPoint.y = 0;
|
||||
event.rect = ▭
|
||||
// XXX fix this!
|
||||
event.region = nsnull;
|
||||
|
@ -1324,8 +1324,8 @@ nsCommonWidget::InitKeyEvent(nsKeyEvent *nsEvent, QKeyEvent *qEvent)
|
|||
void
|
||||
nsCommonWidget::InitMouseEvent(nsMouseEvent *nsEvent, QMouseEvent *qEvent, int aClickCount)
|
||||
{
|
||||
nsEvent->point.x = nscoord(qEvent->x());
|
||||
nsEvent->point.y = nscoord(qEvent->y());
|
||||
nsEvent->refPoint.x = nscoord(qEvent->x());
|
||||
nsEvent->refPoint.y = nscoord(qEvent->y());
|
||||
|
||||
nsEvent->isShift = qEvent->state() & Qt::ShiftButton;
|
||||
nsEvent->isControl = qEvent->state() & Qt::ControlButton;
|
||||
|
@ -1351,8 +1351,8 @@ nsCommonWidget::InitMouseWheelEvent(nsMouseScrollEvent *aEvent,
|
|||
}
|
||||
aEvent->delta = (int)((qEvent->delta() / WHEEL_DELTA) * -3);
|
||||
|
||||
aEvent->point.x = nscoord(qEvent->x());
|
||||
aEvent->point.y = nscoord(qEvent->y());
|
||||
aEvent->refPoint.x = nscoord(qEvent->x());
|
||||
aEvent->refPoint.y = nscoord(qEvent->y());
|
||||
|
||||
aEvent->isShift = qEvent->state() & Qt::ShiftButton;
|
||||
aEvent->isControl = qEvent->state() & Qt::ControlButton;
|
||||
|
|
|
@ -195,11 +195,11 @@ nsNativeDragTarget::DispatchDragDropEvent(PRUint32 aEventType, POINTL aPT)
|
|||
|
||||
if (mHWnd != NULL) {
|
||||
::ScreenToClient(mHWnd, &cpos);
|
||||
event.point.x = cpos.x;
|
||||
event.point.y = cpos.y;
|
||||
event.refPoint.x = cpos.x;
|
||||
event.refPoint.y = cpos.y;
|
||||
} else {
|
||||
event.point.x = 0;
|
||||
event.point.y = 0;
|
||||
event.refPoint.x = 0;
|
||||
event.refPoint.y = 0;
|
||||
}
|
||||
|
||||
event.isShift = IsKeyDown(NS_VK_SHIFT);
|
||||
|
|
|
@ -1183,22 +1183,21 @@ void nsWindow::InitEvent(nsGUIEvent& event, nsPoint* aPoint)
|
|||
|
||||
if (mWnd != NULL) {
|
||||
::ScreenToClient(mWnd, &cpos);
|
||||
event.point.x = cpos.x;
|
||||
event.point.y = cpos.y;
|
||||
event.refPoint.x = cpos.x;
|
||||
event.refPoint.y = cpos.y;
|
||||
} else {
|
||||
event.point.x = 0;
|
||||
event.point.y = 0;
|
||||
event.refPoint.x = 0;
|
||||
event.refPoint.y = 0;
|
||||
}
|
||||
}
|
||||
else { // use the point override if provided
|
||||
event.point.x = aPoint->x;
|
||||
event.point.y = aPoint->y;
|
||||
event.refPoint.x = aPoint->x;
|
||||
event.refPoint.y = aPoint->y;
|
||||
}
|
||||
|
||||
event.time = ::GetMessageTime();
|
||||
|
||||
mLastPoint.x = event.point.x;
|
||||
mLastPoint.y = event.point.y;
|
||||
mLastPoint = event.refPoint;
|
||||
}
|
||||
|
||||
/* In some circumstances (opening dependent windows) it makes more sense
|
||||
|
@ -5663,8 +5662,8 @@ PRBool nsWindow::OnMove(PRInt32 aX, PRInt32 aY)
|
|||
|
||||
nsGUIEvent event(PR_TRUE, NS_MOVE, this);
|
||||
InitEvent(event);
|
||||
event.point.x = aX;
|
||||
event.point.y = aY;
|
||||
event.refPoint.x = aX;
|
||||
event.refPoint.y = aY;
|
||||
|
||||
PRBool result = DispatchWindowEvent(&event);
|
||||
NS_RELEASE(event.widget);
|
||||
|
@ -5990,7 +5989,7 @@ PRBool nsWindow::DispatchMouseEvent(PRUint32 aEventType, WPARAM wParam, nsPoint*
|
|||
}
|
||||
|
||||
pluginEvent.wParam = wParam; // plugins NEED raw OS event flags!
|
||||
pluginEvent.lParam = MAKELONG(event.point.x, event.point.y);
|
||||
pluginEvent.lParam = MAKELONG(event.refPoint.x, event.refPoint.y);
|
||||
|
||||
event.nativeMsg = (void *)&pluginEvent;
|
||||
|
||||
|
@ -6047,7 +6046,7 @@ PRBool nsWindow::DispatchMouseEvent(PRUint32 aEventType, WPARAM wParam, nsPoint*
|
|||
rect.x = 0;
|
||||
rect.y = 0;
|
||||
|
||||
if (rect.Contains(event.point.x, event.point.y)) {
|
||||
if (rect.Contains(event.refPoint)) {
|
||||
if (gCurrentWindow == NULL || gCurrentWindow != this) {
|
||||
if ((nsnull != gCurrentWindow) && (!gCurrentWindow->mIsDestroying)) {
|
||||
MouseTrailer::GetSingleton().IgnoreNextCycle();
|
||||
|
@ -6079,7 +6078,7 @@ PRBool nsWindow::DispatchMouseEvent(PRUint32 aEventType, WPARAM wParam, nsPoint*
|
|||
result = ConvertStatus(mMouseListener->MouseMoved(event));
|
||||
nsRect rect;
|
||||
GetBounds(rect);
|
||||
if (rect.Contains(event.point.x, event.point.y)) {
|
||||
if (rect.Contains(event.refPoint)) {
|
||||
if (gCurrentWindow == NULL || gCurrentWindow != this) {
|
||||
gCurrentWindow = this;
|
||||
}
|
||||
|
@ -6160,8 +6159,8 @@ PRBool nsWindow::DispatchFocus(PRUint32 aEventType, PRBool isMozWindowTakingFocu
|
|||
InitEvent(event);
|
||||
|
||||
//focus and blur event should go to their base widget loc, not current mouse pos
|
||||
event.point.x = 0;
|
||||
event.point.y = 0;
|
||||
event.refPoint.x = 0;
|
||||
event.refPoint.y = 0;
|
||||
|
||||
event.isMozWindowTakingFocus = isMozWindowTakingFocus;
|
||||
|
||||
|
@ -7551,11 +7550,11 @@ void nsWindow::GetCompositionWindowPos(HIMC hIMC, PRUint32 aEventType, COMPOSITI
|
|||
|
||||
if (mWnd != NULL) {
|
||||
::ScreenToClient(mWnd, &point);
|
||||
event.point.x = point.x;
|
||||
event.point.y = point.y;
|
||||
event.refPoint.x = point.x;
|
||||
event.refPoint.y = point.y;
|
||||
} else {
|
||||
event.point.x = 0;
|
||||
event.point.y = 0;
|
||||
event.refPoint.x = 0;
|
||||
event.refPoint.y = 0;
|
||||
}
|
||||
|
||||
NS_IMM_GETCOMPOSITIONWINDOW(hIMC, cpForm);
|
||||
|
|
|
@ -595,8 +595,8 @@ nsAppShell::HandleMotionNotifyEvent(XEvent *event, nsWidget *aWidget)
|
|||
nsMouseEvent mevent(PR_TRUE, NS_MOUSE_MOVE, aWidget, nsMouseEvent::eReal);
|
||||
XEvent aEvent;
|
||||
|
||||
mevent.point.x = event->xmotion.x;
|
||||
mevent.point.y = event->xmotion.y;
|
||||
mevent.refPoint.x = event->xmotion.x;
|
||||
mevent.refPoint.y = event->xmotion.y;
|
||||
|
||||
mevent.isShift = mShiftDown;
|
||||
mevent.isControl = mCtrlDown;
|
||||
|
@ -610,8 +610,8 @@ nsAppShell::HandleMotionNotifyEvent(XEvent *event, nsWidget *aWidget)
|
|||
win,
|
||||
ButtonMotionMask,
|
||||
&aEvent)) {
|
||||
mevent.point.x = aEvent.xmotion.x;
|
||||
mevent.point.y = aEvent.xmotion.y;
|
||||
mevent.refPoint.x = aEvent.xmotion.x;
|
||||
mevent.refPoint.y = aEvent.xmotion.y;
|
||||
}
|
||||
NS_ADDREF(aWidget);
|
||||
aWidget->DispatchMouseEvent(mevent);
|
||||
|
@ -649,8 +649,8 @@ nsAppShell::HandleButtonEvent(XEvent *event, nsWidget *aWidget)
|
|||
scrollEvent.delta = (event->xbutton.button == 4) ? -3 : 3;
|
||||
scrollEvent.scrollFlags = nsMouseScrollEvent::kIsVertical;
|
||||
|
||||
scrollEvent.point.x = event->xbutton.x;
|
||||
scrollEvent.point.y = event->xbutton.y;
|
||||
scrollEvent.refPoint.x = event->xbutton.x;
|
||||
scrollEvent.refPoint.y = event->xbutton.y;
|
||||
|
||||
scrollEvent.isShift = mShiftDown;
|
||||
scrollEvent.isControl = mCtrlDown;
|
||||
|
@ -687,8 +687,8 @@ nsAppShell::HandleButtonEvent(XEvent *event, nsWidget *aWidget)
|
|||
mevent.isControl = mCtrlDown;
|
||||
mevent.isAlt = mAltDown;
|
||||
mevent.isMeta = mMetaDown;
|
||||
mevent.point.x = event->xbutton.x;
|
||||
mevent.point.y = event->xbutton.y;
|
||||
mevent.refPoint.x = event->xbutton.x;
|
||||
mevent.refPoint.y = event->xbutton.y;
|
||||
mevent.time = PR_Now();
|
||||
|
||||
// If we are waiting longer than 1 sec for the second click, this is not a
|
||||
|
@ -778,8 +778,8 @@ nsAppShell::HandleConfigureNotifyEvent(XEvent *event, nsWidget *aWidget)
|
|||
nsSizeEvent sevent(PR_TRUE, NS_SIZE, aWidget);
|
||||
sevent.windowSize = new nsRect (event->xconfigure.x, event->xconfigure.y,
|
||||
event->xconfigure.width, event->xconfigure.height);
|
||||
sevent.point.x = event->xconfigure.x;
|
||||
sevent.point.y = event->xconfigure.y;
|
||||
sevent.refPoint.x = event->xconfigure.x;
|
||||
sevent.refPoint.y = event->xconfigure.y;
|
||||
sevent.mWinWidth = event->xconfigure.width;
|
||||
sevent.mWinHeight = event->xconfigure.height;
|
||||
// XXX fix sevent.time
|
||||
|
@ -956,8 +956,8 @@ nsAppShell::HandleKeyReleaseEvent(XEvent *event, nsWidget *aWidget)
|
|||
keyEvent.isControl = (event->xkey.state & ControlMask) ? 1 : 0;
|
||||
keyEvent.isAlt = (event->xkey.state & Mod1Mask) ? 1 : 0;
|
||||
keyEvent.isMeta = (event->xkey.state & Mod1Mask) ? 1 : 0;
|
||||
keyEvent.point.x = event->xkey.x;
|
||||
keyEvent.point.y = event->xkey.y;
|
||||
keyEvent.refPoint.x = event->xkey.x;
|
||||
keyEvent.refPoint.y = event->xkey.y;
|
||||
|
||||
NS_ADDREF(aWidget);
|
||||
|
||||
|
@ -1027,8 +1027,8 @@ nsAppShell::HandleEnterEvent(XEvent *event, nsWidget *aWidget)
|
|||
nsMouseEvent::eReal);
|
||||
|
||||
enterEvent.time = event->xcrossing.time;
|
||||
enterEvent.point.x = nscoord(event->xcrossing.x);
|
||||
enterEvent.point.y = nscoord(event->xcrossing.y);
|
||||
enterEvent.refPoint.x = nscoord(event->xcrossing.x);
|
||||
enterEvent.refPoint.y = nscoord(event->xcrossing.y);
|
||||
|
||||
// make sure this is in focus. This will do until I rewrite all the
|
||||
// focus routines. KenF
|
||||
|
@ -1059,8 +1059,8 @@ nsAppShell::HandleLeaveEvent(XEvent *event, nsWidget *aWidget)
|
|||
nsMouseEvent::eReal);
|
||||
|
||||
leaveEvent.time = event->xcrossing.time;
|
||||
leaveEvent.point.x = nscoord(event->xcrossing.x);
|
||||
leaveEvent.point.y = nscoord(event->xcrossing.y);
|
||||
leaveEvent.refPoint.x = nscoord(event->xcrossing.x);
|
||||
leaveEvent.refPoint.y = nscoord(event->xcrossing.y);
|
||||
|
||||
NS_ADDREF(aWidget);
|
||||
aWidget->DispatchWindowEvent(leaveEvent);
|
||||
|
@ -1145,8 +1145,8 @@ void nsAppShell::HandleDragMotionEvent(XEvent *event, nsWidget *aWidget) {
|
|||
|
||||
nsMouseEvent mevent(PR_TRUE, NS_DRAGDROP_OVER, aWidget,
|
||||
nsMouseEvent::eReal);
|
||||
mevent.point.x = event->xmotion.x;
|
||||
mevent.point.y = event->xmotion.y;
|
||||
mevent.refPoint.x = event->xmotion.x;
|
||||
mevent.refPoint.y = event->xmotion.y;
|
||||
|
||||
NS_ADDREF(aWidget);
|
||||
aWidget->DispatchMouseEvent(mevent);
|
||||
|
@ -1171,8 +1171,8 @@ void nsAppShell::HandleDragEnterEvent(XEvent *event, nsWidget *aWidget) {
|
|||
nsMouseEvent enterEvent(PR_TRUE, NS_DRAGDROP_ENTER, aWidget,
|
||||
nsMouseEvent::eReal);
|
||||
|
||||
enterEvent.point.x = event->xcrossing.x;
|
||||
enterEvent.point.y = event->xcrossing.y;
|
||||
enterEvent.refPoint.x = event->xcrossing.x;
|
||||
enterEvent.refPoint.y = event->xcrossing.y;
|
||||
|
||||
NS_ADDREF(aWidget);
|
||||
aWidget->DispatchWindowEvent(enterEvent);
|
||||
|
@ -1199,8 +1199,8 @@ void nsAppShell::HandleDragLeaveEvent(XEvent *event, nsWidget *aWidget) {
|
|||
nsMouseEvent leaveEvent(PR_TRUE, NS_DRAGDROP_EXIT, aWidget,
|
||||
nsMouseEvent::eReal);
|
||||
|
||||
leaveEvent.point.x = event->xcrossing.x;
|
||||
leaveEvent.point.y = event->xcrossing.y;
|
||||
leaveEvent.refPoint.x = event->xcrossing.x;
|
||||
leaveEvent.refPoint.y = event->xcrossing.y;
|
||||
|
||||
NS_ADDREF(aWidget);
|
||||
aWidget->DispatchWindowEvent(leaveEvent);
|
||||
|
@ -1226,8 +1226,8 @@ void nsAppShell::HandleDragDropEvent(XEvent *event, nsWidget *aWidget) {
|
|||
if (currentlyDragging) {
|
||||
nsMouseEvent mevent(PR_TRUE, NS_DRAGDROP_DROP, aWidget,
|
||||
nsMouseEvent::eReal);
|
||||
mevent.point.x = event->xbutton.x;
|
||||
mevent.point.y = event->xbutton.y;
|
||||
mevent.refPoint.x = event->xbutton.x;
|
||||
mevent.refPoint.y = event->xbutton.y;
|
||||
|
||||
NS_IF_ADDREF(aWidget);
|
||||
aWidget->DispatchMouseEvent(mevent);
|
||||
|
|
|
@ -1084,7 +1084,7 @@ PRBool nsWidget::DispatchMouseEvent(nsMouseEvent& aEvent)
|
|||
case NS_MOUSE_LEFT_BUTTON_DOWN:
|
||||
case NS_MOUSE_MIDDLE_BUTTON_DOWN:
|
||||
case NS_MOUSE_RIGHT_BUTTON_DOWN:
|
||||
if (HandlePopup(aEvent.point.x, aEvent.point.y)){
|
||||
if (HandlePopup(aEvent.refPoint.x, aEvent.refPoint.y)){
|
||||
// Should we return here as GTK does?
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
@ -1201,7 +1201,7 @@ nsWidget::DebugPrintEvent(nsGUIEvent & aEvent,
|
|||
(void *) this,
|
||||
(void *) aWindow);
|
||||
|
||||
printf(" , x=%-3d, y=%d)",aEvent.point.x,aEvent.point.y);
|
||||
printf(" , x=%-3d, y=%d)",aEvent.refPoint.x,aEvent.refPoint.y);
|
||||
|
||||
printf("\n");
|
||||
}
|
||||
|
|
|
@ -553,8 +553,8 @@ nsWindow::DoPaint (PRInt32 aX, PRInt32 aY, PRInt32 aWidth, PRInt32 aHeight,
|
|||
if (mEventCallback) {
|
||||
nsPaintEvent event(PR_TRUE, NS_PAINT, this);
|
||||
nsRect rect(aX, aY, aWidth, aHeight);
|
||||
event.point.x = aX;
|
||||
event.point.y = aY;
|
||||
event.refPoint.x = aX;
|
||||
event.refPoint.y = aY;
|
||||
event.time = PR_Now(); /* No time in EXPOSE events */
|
||||
event.rect = ▭
|
||||
|
||||
|
|
|
@ -1284,14 +1284,14 @@ nsBaseWidget::debug_DumpEvent(FILE * aFileOut,
|
|||
nsCAutoString tempString; tempString.AssignWithConversion(debug_GuiEventToString(aGuiEvent).get());
|
||||
|
||||
fprintf(aFileOut,
|
||||
"%4d %-26s widget=%-8p name=%-12s id=%-8p pos=%d,%d\n",
|
||||
"%4d %-26s widget=%-8p name=%-12s id=%-8p refpt=%d,%d\n",
|
||||
_GetPrintCount(),
|
||||
tempString.get(),
|
||||
(void *) aWidget,
|
||||
aWidgetName.get(),
|
||||
(void *) (aWindowID ? aWindowID : 0x0),
|
||||
aGuiEvent->point.x,
|
||||
aGuiEvent->point.y);
|
||||
aGuiEvent->refPoint.x,
|
||||
aGuiEvent->refPoint.y);
|
||||
}
|
||||
//////////////////////////////////////////////////////////////
|
||||
/* static */ void
|
||||
|
|
Загрузка…
Ссылка в новой задаче