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
This commit is contained in:
Meriipu 2020-08-06 15:05:43 +02:00
parent 6831da630f
commit 44657db3e2

View file

@ -814,7 +814,14 @@ void Viewport::_notification(int p_what) {
}
} break;
case NOTIFICATION_WM_MOUSE_EXIT:
case 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 NOTIFICATION_WM_WINDOW_FOCUS_OUT: {
_drop_physics_mouseover();