fix for #27791. assume that any drag motion events are not valid drop targets unless someone explicitly sets the canDrop = true in the JS event handler. this makes dragging feedback correct on linux. r=pavlov

This commit is contained in:
blizzard%redhat.com 2000-03-18 05:00:45 +00:00
Родитель 677c58f65d
Коммит 4602ee02e7
6 изменённых файлов: 56 добавлений и 13 удалений

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

@ -39,7 +39,10 @@ class nsIDragSessionGTK : public nsISupports {
NS_IMETHOD SetLastContext (GtkWidget *aWidget,
GdkDragContext *aContext,
guint aTime) = 0;
NS_IMETHOD UpdateDragStatus(GtkWidget *aWidget,
NS_IMETHOD StartDragMotion (GtkWidget *aWidget,
GdkDragContext *aContext,
guint aTime) = 0;
NS_IMETHOD EndDragMotion (GtkWidget *aWidget,
GdkDragContext *aContext,
guint aTime) = 0;
NS_IMETHOD SetDataReceived (GtkWidget *aWidget,

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

@ -341,12 +341,25 @@ NS_IMETHODIMP nsDragService::SetLastContext (GtkWidget *aWidget,
return NS_OK;
}
NS_IMETHODIMP nsDragService::UpdateDragStatus(GtkWidget *aWidget,
GdkDragContext *aContext,
guint aTime)
NS_IMETHODIMP nsDragService::StartDragMotion(GtkWidget *aWidget,
GdkDragContext *aContext,
guint aTime)
{
#ifdef DEBUG_DD
g_print("UpdateDragStatus: %d\n", mCanDrop);
g_print("StartDragMotion\n");
#endif
// set our drop target to false since we probably won't get
// notification if there's no JS DND listener.
mCanDrop = PR_FALSE;
return NS_OK;
}
NS_IMETHODIMP nsDragService::EndDragMotion(GtkWidget *aWidget,
GdkDragContext *aContext,
guint aTime)
{
#ifdef DEBUG_DD
g_print("EndDragMotion: %d\n", mCanDrop);
#endif
if (mCanDrop)
gdk_drag_status(aContext, GDK_ACTION_COPY, aTime);

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

@ -59,9 +59,12 @@ public:
NS_IMETHOD SetLastContext (GtkWidget *aWidget,
GdkDragContext *aContext,
guint aTime);
NS_IMETHOD UpdateDragStatus(GtkWidget *aWidget,
GdkDragContext *aContext,
guint aTime);
NS_IMETHOD StartDragMotion (GtkWidget *aWidget,
GdkDragContext *aContext,
guint aTime);
NS_IMETHOD EndDragMotion (GtkWidget *aWidget,
GdkDragContext *aContext,
guint aTime);
NS_IMETHOD SetDataReceived (GtkWidget *aWidget,
GdkDragContext *context,
gint x,

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

@ -2973,7 +2973,7 @@ void nsWidget::UpdateDragContext(GtkWidget *aWidget, GdkDragContext *aGdkDragCon
}
/* virtual */
void nsWidget::UpdateDragStatus(GtkWidget *aWidget, GdkDragContext *aGdkDragContext, guint aTime)
void nsWidget::StartDragMotion(GtkWidget *aWidget, GdkDragContext *aGdkDragContext, guint aTime)
{
// make sure that we tell the drag manager what the hell is going on.
nsCOMPtr<nsIDragService> dragService;
@ -2989,7 +2989,27 @@ void nsWidget::UpdateDragStatus(GtkWidget *aWidget, GdkDragContext *aGdkDragCont
if (!dragServiceGTK) {
return;
}
dragServiceGTK->UpdateDragStatus(aWidget, aGdkDragContext, aTime);
dragServiceGTK->StartDragMotion(aWidget, aGdkDragContext, aTime);
}
/* virtual */
void nsWidget::EndDragMotion(GtkWidget *aWidget, GdkDragContext *aGdkDragContext, guint aTime)
{
// make sure that we tell the drag manager what the hell is going on.
nsCOMPtr<nsIDragService> dragService;
nsresult rv = nsServiceManager::GetService(kCDragServiceCID,
nsIDragService::GetIID(),
(nsISupports **)&dragService);
if (NS_FAILED(rv)) {
g_print("*** warning: failed to get the drag service. this is a _bad_ thing.\n");
return;
}
nsCOMPtr<nsIDragSessionGTK> dragServiceGTK;
dragServiceGTK = do_QueryInterface(dragService);
if (!dragServiceGTK) {
return;
}
dragServiceGTK->EndDragMotion(aWidget, aGdkDragContext, aTime);
}
#ifdef NS_DEBUG

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

@ -202,7 +202,8 @@ public:
protected:
virtual void UpdateDragContext(GtkWidget *aWidget, GdkDragContext *aGdkDragContext, guint aTime);
virtual void UpdateDragStatus(GtkWidget *aWidget, GdkDragContext *aGdkDragContext, guint aTime);
virtual void StartDragMotion(GtkWidget *aWidget, GdkDragContext *aGdkDragContext, guint aTime);
virtual void EndDragMotion(GtkWidget *aWidget, GdkDragContext *aGdkDragContext, guint aTime);
virtual void InitCallbacks(char * aName = nsnull);

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

@ -1357,6 +1357,9 @@ nsWindow::OnToplevelDragMotion (GtkWidget *aWidget,
innerMostWidget->OnDragEnterSignal(aDragContext, x, y, aTime);
}
// notify the drag service that we are starting a drag motion.
StartDragMotion(aWidget, aDragContext, aTime);
nsMouseEvent event;
event.message = NS_DRAGDROP_OVER;
@ -1373,8 +1376,8 @@ nsWindow::OnToplevelDragMotion (GtkWidget *aWidget,
innerMostWidget->Release();
// now that we've dispatched the signal, update the drag context
UpdateDragStatus(aWidget, aDragContext, aTime);
// we're done with the drag motion event. notify the drag service.
EndDragMotion(aWidget, aDragContext, aTime);
}
void