1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 13:38:11 +00:00

LibGUI: Don't accept drag events in AbstractView if it's not editable

With a new DragCopy cursor icon being used on accepted events, this
caused a 'false assumption' that everything can be dropped into
AbstractView.

This will now only happen if the View is editable, which still isn't
perfect, but at least the Settings app will no longer change cursors.
Also note that we won't get "drag move" events as the comment below
says, which disables automatic scrolling when dragging an element.
This commit is contained in:
Karol Kosek 2022-08-21 11:27:10 +02:00 committed by Sam Atkins
parent 1d9ec8bd56
commit a0ef00cab2

View file

@ -770,7 +770,11 @@ void AbstractView::drag_enter_event(DragEvent& event)
{
if (!model())
return;
// NOTE: Right now, AbstractView always accepts drags since we won't get "drag move" events
if (!is_editable())
return;
// NOTE: Right now, AbstractView accepts drags since we won't get "drag move" events
// unless we accept the "drag enter" event.
// We might be able to reduce event traffic by communicating the set of drag-accepting
// rects in this widget to the windowing system somehow.