Skip to content

macOS: add the ability to change the mouse cursor#128

Merged
prokopyl merged 15 commits into
RustAudio:masterfrom
discordance:feature/set-mouse-cursor
Jun 13, 2026
Merged

macOS: add the ability to change the mouse cursor#128
prokopyl merged 15 commits into
RustAudio:masterfrom
discordance:feature/set-mouse-cursor

Conversation

@discordance

Copy link
Copy Markdown
Contributor

The feature was already there for X11, but wasn't available in MacOS and Windows.

The code is based on winit code mostly.
I've tested locally with a modified version of iced_baseview that I am working on for a project.
Not sure if adding a set_mouse_cursor to the window is the way to go but it works for me.

This is related to the #123 issue.

@robbert-vdh robbert-vdh left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rebased here, tested on Windows/Wine and Linux (can also boot up a Mac if noone's tested that). Mostly LGTM functionality wise, though I have some comments on how this changes the current behavior on WIndows.

I would suggest using the same list of cursors and the same cursor assignments as winit though. And thus also dropping MouseCursor::Pointer again. The existing cursor enum was already based on this, so bringing everything back in line with winit's current definitions shouldn't be too difficult. The enum can be found here, and I linked the platform-specific cursor assignments in the comments below. This way it becomes easier to switch between winit and baseview backends for GUI frameworks that support both, as the cursors will look the same on both platforms.

Comment thread src/x11/cursor.rs Outdated
Comment thread src/macos/cursor.rs Outdated
Comment thread src/win/cursor.rs Outdated
Comment thread src/win/window.rs Outdated
@discordance discordance force-pushed the feature/set-mouse-cursor branch from 6f9ad7f to 5744a2b Compare September 3, 2023 09:54
@BillyDM BillyDM mentioned this pull request Mar 18, 2024
27 tasks
andrewmcveigh added a commit to andrewmcveigh/baseview that referenced this pull request Jul 23, 2025
@prokopyl prokopyl self-assigned this Jun 13, 2026
@prokopyl prokopyl dismissed robbert-vdh’s stale review June 13, 2026 23:51

I put the list of cursors back to how it was, and also reverted the Windows implementation since it has already been integrated since then.

@prokopyl

prokopyl commented Jun 13, 2026

Copy link
Copy Markdown
Member

I took the liberty of updating this PR and addressing the few issues that were previously raised.
Tested and works as expected!

@discordance Sorry that was quite a bit late, but thank you for this PR! 🙂

@prokopyl prokopyl changed the title Adding the ability to change the mouse cursor for MacOS and Windows macOS: add the ability to change the mouse cursor Jun 13, 2026
@prokopyl prokopyl merged commit 066fb12 into RustAudio:master Jun 13, 2026
7 checks passed
@prokopyl prokopyl linked an issue Jun 14, 2026 that may be closed by this pull request
@prokopyl prokopyl mentioned this pull request Jun 14, 2026
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.

Setting the cursor icon

3 participants