If the mouse is held on notification_wm_mouse_exit, do not drop focus

This fixes a bug where users of the scrollbar had to be very careful
not to move the mouse outside the viewport, otherwise the scrollbar
would drop its drag-action and stop scrolling until clicked again.

The existing behaviour had the side-effect of also dropping the
cosmetic highlighting of the scrollbar (in addition to the dragging),
for the specific case where the mouse was move outside the window.
The previous behaviour did nothing to remove the highlight if the
mouse was released (but not moved) inside the viewport.

This separate issue with the lingering highlight of the scrollbar
(until a mouse-movement action is performed inside the viewport) is
fixed in an immediate followup to this commit.

Closes bug #39634

(cherry picked from commit 44657db3e2)
This commit is contained in:
Meriipu 2020-08-06 15:05:43 +02:00 committed by Rémi Verschelde
parent 28e36dc7b9
commit 6f77f1bb3e

View file

@ -428,7 +428,15 @@ void Viewport::_notification(int p_what) {
_process_picking(false);
}
} break;
case SceneTree::NOTIFICATION_WM_MOUSE_EXIT:
case SceneTree::NOTIFICATION_WM_MOUSE_EXIT: {
_drop_physics_mouseover();
// Unlike on loss of focus (NOTIFICATION_WM_WINDOW_FOCUS_OUT), do not
// drop the gui mouseover here, as a scrollbar may be dragged while the
// mouse is outside the window (without the window having lost focus).
// See bug #39634
} break;
case SceneTree::NOTIFICATION_WM_FOCUS_OUT: {
_drop_physics_mouseover();