-
Notifications
You must be signed in to change notification settings - Fork 891
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature Request: Get Cursor Icon Size #3788
Comments
Hmm, on macOS / AppKit, I don't think you can change the size of the cursor programmatically, and I also don't know of a way to query the size of it? This may not be information that's available on Wayland either. There is the concept of a "cursor hotspot" though (see the docs), I think that's available on some of the other platforms too, and will probably influence any calculation you would make here? (I will note that another solution to this problem would be to make your "attack" button larger). |
AFAIK cursor hotspot is available on all platforms. I'm quite sure this is not possible to implement on Web. |
Thanks for taking a look at this issue!
Kind of, in this example I actually created a tooltip at the cursor position, because I wanted it to follow the cursor around. But yeah, if the tooltip was on the button, that would work. Actually, I solved it by just moving the tooltip to the right of the button, which looks fine in my case (so very similar to what you proposed): However, this is actually an issue in a lot of applications, e.g., in browsers: Which is why I'm kind of happy if it receives some attention :) Edit: Other people run into this as well, e.g. (sorry for twitter link): https://x.com/jacobmparis/status/1715031810609185249/ |
You can not use hotspot alone for that because you don't know the shape of the cursor. hotspot also solves literally nothing because it determines the top-left corner of the cursor icon relative to the pointer location, so this information can not solve the issue, because it shows the offset, and offset could be zero regardless of the size/shape of the cursor icon. However, if you have both size and hotspot you can approximate the area which will be obscured, but you need both of them at the same time. On Wayland neither are available for example, on macOS it's just hotspot. On X11 I'm pretty sure you can not do that unless somehow figure out what is actually used right now, but I'm pretty sure you can not do that, it's not reliable at all. What I'd say that systems compositor should figure this stuff out, since they have all the information available in the end of the day. We could still probably add a best effort API, but it'll be really rare to have both hotspot and cursor icon size at the same time available, so the usefulness of such API is questionably since you need both. |
I've kept only windows since it's likely old enough to have some hacks in place or the API generally stable enough for these hacks to work. Also, if you set a custom cursor you have all the sizes/hotspot informations available, so it's not an issue either. |
Just stumbled on this for MacOS: Basically there is a way to get the accessibility setting that determines cursor size, that way the native cursor size might be calculated. This is probably not really viable, but just leaving that here. |
As far as I can tell there aren't any APIs in any eminent GUI frameworks that expose this functionality. I'm not even sure what such an API would look like. |
Yeah, the problem is really prevalent in basically all applications/OSs when increasing the cursor size (i.e., cursor will start noticeably overlapping tooltips). So I'm not really surprised that other GUI frameworks don't support it either 🙈 |
Description
Hi,
I have a larger-than-usual cursor size, which causes tooltips to look like this:
I.e., the mouse cursor icon covers part of the tooltip.
What I would like is a way to get the dimensions of the current cursor icon, so that I can adjust the tooltip's position.
I looked around a bit, and found #3306, which is about custom cursors, but it doesn't deal with cursor icon size.
For Windows, I found this (old, but might still work) post where someone figured out how to retrieve the cursor icon size:
https://forums.codeguru.com/showthread.php?449040-get-the-system-current-cursor-size&s=6da505d928b0363ffa51abafcdaefd0e&p=1757676#post1757676
I guess this is annoying to implement? 🙈 Thanks for taking a look already! :)
Relevant platforms
Windows, macOS, Wayland, X11, Web
The text was updated successfully, but these errors were encountered: