Skip to content

Release capture after switching to other app w/Alt+tab (fix #325, #5601)#5691

Merged
dacap merged 1 commit into
aseprite:mainfrom
dacap:alt-tab
Apr 1, 2026
Merged

Release capture after switching to other app w/Alt+tab (fix #325, #5601)#5691
dacap merged 1 commit into
aseprite:mainfrom
dacap:alt-tab

Conversation

@dacap

@dacap dacap commented Mar 6, 2026

Copy link
Copy Markdown
Member

This should fix #325, after receiving an os::Event::WindowLeave message (e.g. because another native window is activated by the user), we check if there is a widget with the mouse capture and generate an kMouseUpMessage without buttons (kButtonNone) for that specific widget, which can be processed just like a regular kMouseUpMessage.

It's similar to #5601 but doesn't require a new ui::MessageType and this fixes issues with the sprite Editor, Timeline, and color bar (PaletteView, e.g. when we are dragging colors).

@aseprite-bot

Copy link
Copy Markdown
Collaborator

clang-tidy review says "All clean, LGTM! 👍"

@dacap dacap assigned dacap and unassigned Gasparoken Mar 6, 2026
@dacap

dacap commented Mar 6, 2026

Copy link
Copy Markdown
Member Author

I'm taking this PR back because https://github.com/aseprite/aseprite/actions/runs/22776507662/job/66071133540 is failing, it looks like on Windows a WA_INACTIVE message is received when the HWND is being destroyed and a reference to a deleted os::Window used in some place.

@aseprite-bot

Copy link
Copy Markdown
Collaborator

clang-tidy review says "All clean, LGTM! 👍"

@dacap dacap assigned Gasparoken and unassigned dacap Mar 9, 2026
@dacap

dacap commented Mar 9, 2026

Copy link
Copy Markdown
Member Author

I'm taking this PR back because https://github.com/aseprite/aseprite/actions/runs/22776507662/job/66071133540 is failing, it looks like on Windows a WA_INACTIVE message is received when the HWND is being destroyed and a reference to a deleted os::Window used in some place.

Fixed with: aseprite/laf@57b22eb

@dacap dacap assigned dacap and unassigned Gasparoken Apr 1, 2026
, aseprite#5601)

Switching to another app will generate a kMouseUpMessage without
button (kButtonNone) for the capture_widget so it can release the
mouse and go back to its idle state.
@aseprite-bot

Copy link
Copy Markdown
Collaborator

clang-tidy review says "All clean, LGTM! 👍"

@dacap dacap merged commit c31aada into aseprite:main Apr 1, 2026
12 checks passed
@dacap dacap deleted the alt-tab branch April 1, 2026 17:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Alt-tabbing while using hand tool locks mouse in other windows.

3 participants