Bug 1731737 [Linux] Call nsDragService::RunScheduledTask() event handler faster and disable its re-entrance r=emilio

We sometimes miss reply to D&D motion event due to delayed DnsDragService::RunScheduledTask() call.
We can't call D&D handler directly from drag-motion event as it causes nested recursions and re-entrance
in glib loop so use higher priority for the delayed handler call at least.

Disable re-entrance of nsDragService::RunScheduledTask() which may happen when
we get D&D data from drag_drop event.

Provide more loggig to D&D code.

Differential Revision: https://phabricator.services.mozilla.com/D126182
This commit is contained in:
stransky
2021-09-21 13:30:44 +00:00
parent 4f58131e06
commit dcadf2b1b3
3 changed files with 73 additions and 16 deletions

View File

@@ -8154,14 +8154,18 @@ static gboolean drag_motion_event_cb(GtkWidget* aWidget,
void WindowDragLeaveHandler(GtkWidget* aWidget) {
LOGDRAG(("WindowDragLeaveHandler()\n"));
RefPtr<nsDragService> dragService = nsDragService::GetInstance();
if (!dragService->IsDragActive()) {
LOGDRAG((" Already finished.\n"));
return;
}
RefPtr<nsWindow> window = get_window_for_gtk_widget(aWidget);
if (!window) {
LOGDRAG((" Failed - can't find nsWindow!\n"));
return;
}
RefPtr<nsDragService> dragService = nsDragService::GetInstance();
nsWindow* mostRecentDragWindow = dragService->GetMostRecentDestWindow();
if (!mostRecentDragWindow) {
// This can happen when the target will not accept a drop. A GTK drag