From a0ef00cab2e239d2c1853cf13ca850c9c1111915 Mon Sep 17 00:00:00 2001 From: Karol Kosek Date: Sun, 21 Aug 2022 11:27:10 +0200 Subject: [PATCH] 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. --- Userland/Libraries/LibGUI/AbstractView.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Userland/Libraries/LibGUI/AbstractView.cpp b/Userland/Libraries/LibGUI/AbstractView.cpp index 1c24d09583..7ca950a281 100644 --- a/Userland/Libraries/LibGUI/AbstractView.cpp +++ b/Userland/Libraries/LibGUI/AbstractView.cpp @@ -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.