summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibGUI/AbstractView.cpp
diff options
context:
space:
mode:
authorKarol Kosek <krkk@serenityos.org>2022-08-21 11:27:10 +0200
committerSam Atkins <atkinssj@gmail.com>2022-08-31 17:29:44 +0100
commita0ef00cab2e239d2c1853cf13ca850c9c1111915 (patch)
tree92acb5806a01e98cc11ac5535b4455be05d4ddad /Userland/Libraries/LibGUI/AbstractView.cpp
parent1d9ec8bd56b76749ddc8f22e0a24ce059e3653d4 (diff)
downloadserenity-a0ef00cab2e239d2c1853cf13ca850c9c1111915.zip
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.
Diffstat (limited to 'Userland/Libraries/LibGUI/AbstractView.cpp')
-rw-r--r--Userland/Libraries/LibGUI/AbstractView.cpp6
1 files changed, 5 insertions, 1 deletions
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.