rust-windowing / winit

Window handling library in pure Rust
https://docs.rs/winit/
Apache License 2.0
4.88k stars 913 forks source link

[Question] set_cursor_hittest(false) makes cursor and more visible #3939

Closed The-Mr-L closed 1 month ago

The-Mr-L commented 1 month ago

Hi :) first of all thanks for maintaining this crate! I have a question that might seem pretty stupid but is it expected to be able to see the mouse and text cursor in the back of the window when doing window.set_cursor_hittest(false),? so I get why this is probably what you want but I would expect this to only happen when setting window.set_transparent(true)

the thing is I am trying to build a screen magnifer so I want the be able to ignore inputs and send them to underlaying context and keep an opaque image, but I kinda hit a wall here :s for now at least :) any suggestions are much apricated

kchibisov commented 1 month ago

transparency is a hint, it doesn't mean that transparency won't work. If you draw opaque content you won't see through.

The-Mr-L commented 1 month ago

hm so set_cursor_hittest is expected to make cursors and context menu's see through without setting transparent to true?

kchibisov commented 1 month ago

What set_cursor_hittest does is up to WM/compositor you're using. You can also check the implementation of set_cursor_hittest on the platform you're using.

The-Mr-L commented 1 month ago

okay thanks , I realize that it is hard to help here when I did not even mention os etc. I am on windows 11 and using pixels crate and when setting clear_color to black and it has an alpha at 1.0 I can still see when I right click my desktop . I suspect it could be that the right click context menu etc will be set to the top most window and then shows up on my alwaysontop window :s . but thanks again , have a nice day