1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 11:37:34 +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:
thankyouverycool 2022-08-12 19:34:04 -04:00 committed by Andreas Kling
parent db058a22ae
commit 9bcd7dc0ce
4 changed files with 6 additions and 2 deletions

View file

@ -347,6 +347,8 @@ public:
Window const* automatic_cursor_tracking_window() const { return m_automatic_cursor_tracking_window; }
void set_automatic_cursor_tracking_window(Window* window) { m_automatic_cursor_tracking_window = window; }
u8 last_processed_buttons() { return m_last_processed_buttons; }
private:
explicit WindowManager(Gfx::PaletteImpl const&);
@ -469,6 +471,7 @@ private:
ResizeDirection m_resize_direction { ResizeDirection::None };
u8 m_keyboard_modifiers { 0 };
u8 m_last_processed_buttons { MouseButton::None };
NonnullRefPtr<WindowSwitcher> m_switcher;
NonnullRefPtr<KeymapSwitcher> m_keymap_switcher;