Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Objective
WindowsWindowInner::handle_cursor_changedchecks whether any cursor was already set and skips theSetCursorcall. This makes changes between differentCursorStylevariants to be ignored.This was probably not noticed yet because Windows'
WM_SETCURSORmessage is usually dispatched on every mouse movement, soWindowsWindowInner::handle_set_cursorends up setting the correct cursor shortly after. However, since GPUI unconditionally callsSetCaptureonWM_[LRM]BUTTONDOWNmessages, theWM_SETCURSORmessage stops being dispatched while the mouse is down, causing the bug to surface as making it impossible to ever change the cursor while the user's dragging the mouse (even if there's nocx.active_dragor active captured hitbox).Solution
We can unconditionally call
SetCursorfromWindowsWindowInner::handle_cursor_changed. This shouldn't be problematic, sinceWindowsPlatform::set_cursor_stylealready checks whether the cursor already changed before dispatchingWM_GPUI_CURSOR_STYLE_CHANGED(which is the only path tohandle_cursor_changedbeing called in the first place).Linux and MacOS do not show this behavior and already allow cursor changes during drags.
Testing
I've only manually tested it; I don't know how we'd add a test for this behavior.
Any app with
div().cursor(CursorStyle::SomeCursor)orwindow.set_cursor_style()calls is affected by being unable to set cursors while the mouse is clicked.Self-Review Checklist:
Release Notes: