diff options
author | Karol Kosek <krkk@serenityos.org> | 2022-11-04 22:32:17 +0100 |
---|---|---|
committer | Andrew Kaster <andrewdkaster@gmail.com> | 2022-11-13 16:13:03 -0700 |
commit | 0b7f5bbdfb87912494e3ba0b8280f02b459c74f5 (patch) | |
tree | d716d30e71b1278b1e74965ad09008269770bee9 /Userland/Applications/PixelPaint/MainWidget.cpp | |
parent | 461ee18d640d87733509e7b4b8ee3147327bbc40 (diff) | |
download | serenity-0b7f5bbdfb87912494e3ba0b8280f02b459c74f5.zip |
Userland: Accept drag_enter events for widgets supporting file drops
This patch will switch cursor to DragCopy when a user enters a widget
while dragging file(s), giving them a visual clue that it *might* be
dropped into this widget.
This is a rather naive approach, as the cursor icon will change for any
kind of file, as currently programs don't know the drag contents before
dropping it. But after all I think it's better than nothing. :^)
Diffstat (limited to 'Userland/Applications/PixelPaint/MainWidget.cpp')
-rw-r--r-- | Userland/Applications/PixelPaint/MainWidget.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Userland/Applications/PixelPaint/MainWidget.cpp b/Userland/Applications/PixelPaint/MainWidget.cpp index 02b1878cc9..b33c9f1829 100644 --- a/Userland/Applications/PixelPaint/MainWidget.cpp +++ b/Userland/Applications/PixelPaint/MainWidget.cpp @@ -1145,6 +1145,13 @@ ImageEditor& MainWidget::create_new_editor(NonnullRefPtr<Image> image) return image_editor; } +void MainWidget::drag_enter_event(GUI::DragEvent& event) +{ + auto const& mime_types = event.mime_types(); + if (mime_types.contains_slow("text/uri-list")) + event.accept(); +} + void MainWidget::drop_event(GUI::DropEvent& event) { if (!event.mime_data().has_urls()) |