mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 19:35:51 +00:00
b=497498 use a helper method for dispatching destination drag events r=roc
--HG-- extra : rebase_source : fd151e844ca1454d585e8c254e1b91668427fdc6
This commit is contained in:
parent
9753a6327c
commit
5801cc535a
@ -3323,6 +3323,23 @@ nsWindow::CheckNeedDragLeave(nsWindow* aInnerMostWidget,
|
|||||||
sLastDragMotionWindow = aInnerMostWidget;
|
sLastDragMotionWindow = aInnerMostWidget;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
nsWindow::DispatchDragEvent(PRUint32 aMsg, const nsIntPoint& aRefPoint,
|
||||||
|
guint aTime)
|
||||||
|
{
|
||||||
|
nsDragEvent event(true, aMsg, this);
|
||||||
|
|
||||||
|
if (aMsg == NS_DRAGDROP_OVER) {
|
||||||
|
InitDragEvent(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
event.refPoint = aRefPoint;
|
||||||
|
event.time = aTime;
|
||||||
|
|
||||||
|
nsEventStatus status;
|
||||||
|
DispatchEvent(&event, status);
|
||||||
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
nsWindow::OnDragMotionEvent(GtkWidget *aWidget,
|
nsWindow::OnDragMotionEvent(GtkWidget *aWidget,
|
||||||
GdkDragContext *aDragContext,
|
GdkDragContext *aDragContext,
|
||||||
@ -3385,16 +3402,8 @@ nsWindow::OnDragMotionEvent(GtkWidget *aWidget,
|
|||||||
|
|
||||||
dragService->FireDragEventAtSource(NS_DRAGDROP_DRAG);
|
dragService->FireDragEventAtSource(NS_DRAGDROP_DRAG);
|
||||||
|
|
||||||
nsDragEvent event(true, NS_DRAGDROP_OVER, innerMostWidget);
|
innerMostWidget->
|
||||||
|
DispatchDragEvent(NS_DRAGDROP_OVER, nsIntPoint(retx, rety), aTime);
|
||||||
InitDragEvent(event);
|
|
||||||
|
|
||||||
event.refPoint.x = retx;
|
|
||||||
event.refPoint.y = rety;
|
|
||||||
event.time = aTime;
|
|
||||||
|
|
||||||
nsEventStatus status;
|
|
||||||
innerMostWidget->DispatchEvent(&event, status);
|
|
||||||
|
|
||||||
// Reply to tell the source whether we can drop and what action would be
|
// Reply to tell the source whether we can drop and what action would be
|
||||||
// taken.
|
// taken.
|
||||||
@ -3497,16 +3506,8 @@ nsWindow::OnDragDropEvent(GtkWidget *aWidget,
|
|||||||
|
|
||||||
dragService->FireDragEventAtSource(NS_DRAGDROP_DRAG);
|
dragService->FireDragEventAtSource(NS_DRAGDROP_DRAG);
|
||||||
|
|
||||||
nsDragEvent event(true, NS_DRAGDROP_OVER, innerMostWidget);
|
innerMostWidget->
|
||||||
|
DispatchDragEvent(NS_DRAGDROP_OVER, nsIntPoint(retx, rety), aTime);
|
||||||
InitDragEvent(event);
|
|
||||||
|
|
||||||
event.refPoint.x = retx;
|
|
||||||
event.refPoint.y = rety;
|
|
||||||
event.time = aTime;
|
|
||||||
|
|
||||||
nsEventStatus status;
|
|
||||||
innerMostWidget->DispatchEvent(&event, status);
|
|
||||||
|
|
||||||
gboolean success = FALSE;
|
gboolean success = FALSE;
|
||||||
|
|
||||||
@ -3517,12 +3518,8 @@ nsWindow::OnDragDropEvent(GtkWidget *aWidget,
|
|||||||
bool canDrop;
|
bool canDrop;
|
||||||
dragServiceGTK->GetCanDrop(&canDrop);
|
dragServiceGTK->GetCanDrop(&canDrop);
|
||||||
PRUint32 msg = canDrop ? NS_DRAGDROP_DROP : NS_DRAGDROP_EXIT;
|
PRUint32 msg = canDrop ? NS_DRAGDROP_DROP : NS_DRAGDROP_EXIT;
|
||||||
nsDragEvent event(true, msg, innerMostWidget);
|
|
||||||
event.refPoint.x = retx;
|
|
||||||
event.refPoint.y = rety;
|
|
||||||
|
|
||||||
nsEventStatus status = nsEventStatus_eIgnore;
|
innerMostWidget->DispatchDragEvent(msg, nsIntPoint(retx, rety), aTime);
|
||||||
innerMostWidget->DispatchEvent(&event, status);
|
|
||||||
|
|
||||||
success = canDrop;
|
success = canDrop;
|
||||||
}
|
}
|
||||||
@ -3572,10 +3569,7 @@ nsWindow::OnDragLeave(void)
|
|||||||
{
|
{
|
||||||
LOGDRAG(("nsWindow::OnDragLeave(%p)\n", (void*)this));
|
LOGDRAG(("nsWindow::OnDragLeave(%p)\n", (void*)this));
|
||||||
|
|
||||||
nsDragEvent event(true, NS_DRAGDROP_EXIT, this);
|
DispatchDragEvent(NS_DRAGDROP_EXIT, nsIntPoint(0, 0), 0);
|
||||||
|
|
||||||
nsEventStatus status;
|
|
||||||
DispatchEvent(&event, status);
|
|
||||||
|
|
||||||
nsCOMPtr<nsIDragService> dragService = do_GetService(kCDragServiceCID);
|
nsCOMPtr<nsIDragService> dragService = do_GetService(kCDragServiceCID);
|
||||||
|
|
||||||
|
@ -315,6 +315,9 @@ public:
|
|||||||
GdkWindow* GetGdkWindow() { return mGdkWindow; }
|
GdkWindow* GetGdkWindow() { return mGdkWindow; }
|
||||||
bool IsDestroyed() { return mIsDestroyed; }
|
bool IsDestroyed() { return mIsDestroyed; }
|
||||||
|
|
||||||
|
void DispatchDragEvent(PRUint32 aMsg,
|
||||||
|
const nsIntPoint& aRefPoint,
|
||||||
|
guint aTime);
|
||||||
// If this dispatched the keydown event actually, this returns TRUE,
|
// If this dispatched the keydown event actually, this returns TRUE,
|
||||||
// otherwise, FALSE.
|
// otherwise, FALSE.
|
||||||
bool DispatchKeyDownEvent(GdkEventKey *aEvent,
|
bool DispatchKeyDownEvent(GdkEventKey *aEvent,
|
||||||
|
Loading…
Reference in New Issue
Block a user