mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-27 04:37:22 +00:00
WindowServer: Don't start a drag and drop unless holding Primary mouse
Adds a member to record the last processed mouse buttons. If they do not include MouseButton::Primary, return early before creating a new drag and drop client. This fixes race conditions in which MouseUp events canceling or completing a drop could be swallowed by Overlay creation or postponed by an executing DragOperation, leaving the operation in limbo.
This commit is contained in:
parent
db058a22ae
commit
9bcd7dc0ce
Notes:
sideshowbarker
2024-07-17 08:12:16 +09:00
Author: https://github.com/thankyouverycool
Commit: 9bcd7dc0ce
Pull-request: https://github.com/SerenityOS/serenity/pull/14888
Issue: https://github.com/SerenityOS/serenity/issues/12650
4 changed files with 6 additions and 2 deletions
|
@ -817,7 +817,7 @@ void ConnectionFromClient::start_window_resize(i32 window_id)
|
|||
Messages::WindowServer::StartDragResponse ConnectionFromClient::start_drag(String const& text, HashMap<String, ByteBuffer> const& mime_data, Gfx::ShareableBitmap const& drag_bitmap)
|
||||
{
|
||||
auto& wm = WindowManager::the();
|
||||
if (wm.dnd_client())
|
||||
if (wm.dnd_client() || !(wm.last_processed_buttons() & MouseButton::Primary))
|
||||
return false;
|
||||
|
||||
wm.start_dnd_drag(*this, text, drag_bitmap.bitmap(), Core::MimeData::construct(mime_data));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue