From 45701b9bfbef6120e5e72516530c6dfb18b5a91d Mon Sep 17 00:00:00 2001 From: "mcafee%netscape.com" Date: Tue, 12 Oct 1999 07:26:47 +0000 Subject: [PATCH] Applying patch from buhr@stat.wisc.edu. Fixes destination widget confusion (14759). Unix-only, a=mscott --- widget/src/gtk/nsWidget.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/widget/src/gtk/nsWidget.cpp b/widget/src/gtk/nsWidget.cpp index ad6dd1801d7c..2b08e92c0d93 100644 --- a/widget/src/gtk/nsWidget.cpp +++ b/widget/src/gtk/nsWidget.cpp @@ -1880,7 +1880,19 @@ nsWidget::OnButtonReleaseSignal(GdkEventButton * aGdkButtonEvent) InitMouseEvent(aGdkButtonEvent, event, eventType); - event.widget = sButtonMotionTarget ? sButtonMotionTarget : this; + if (sButtonMotionTarget) { + gint diffX = 0; + gint diffY = 0; + + diffX = (gint) aGdkButtonEvent->x_root - sButtonMotionRootX; + diffY = (gint) aGdkButtonEvent->y_root - sButtonMotionRootY; + + event.widget = sButtonMotionTarget; + + // see comments in nsWidget::OnMotionNotifySignal + event.point.x = nscoord(sButtonMotionWidgetX + diffX); + event.point.y = nscoord(sButtonMotionWidgetY + diffY); + } NS_ADDREF(event.widget); NS_STATIC_CAST(nsWidget*,event.widget)->DispatchMouseEvent(event);