You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I’ve noticed that winit doesn’t have an option to set a custom HiDPI mouse cursor on MacOS. Most MacBook and iMac screens are scaled x2, even the mouse cursor is doubled. I think it’s worth considering because a custom cursor is currently blurred on retina displays.
I took a look at the implementation and managed to achieve a sharp cursor by dividing the size of the NSImage by 2. By keeping the physical representation, I only changed the logical representation. It’s worth mentioning that the hotspot also needs to be changed. For testing, I set it to 0. This is just a test, not a final solution.
File src/platform_impl/apple/appkit/cursor.rs
let image = unsafe {
NSImage::initWithSize(NSImage::alloc(), NSSize::new((width / 2).into(), (height / 2).into()))
};
unsafe { image.addRepresentation(&bitmap) };
let hotspot = NSPoint::new(0 as f64, 0 as f64);
What do you think about it?
Relevant platforms
macOS
The text was updated successfully, but these errors were encountered:
Description
I’ve noticed that winit doesn’t have an option to set a custom HiDPI mouse cursor on MacOS. Most MacBook and iMac screens are scaled x2, even the mouse cursor is doubled. I think it’s worth considering because a custom cursor is currently blurred on retina displays.
I took a look at the implementation and managed to achieve a sharp cursor by dividing the size of the NSImage by 2. By keeping the physical representation, I only changed the logical representation. It’s worth mentioning that the hotspot also needs to be changed. For testing, I set it to 0. This is just a test, not a final solution.
File
src/platform_impl/apple/appkit/cursor.rs
What do you think about it?
Relevant platforms
macOS
The text was updated successfully, but these errors were encountered: