-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Input Passthrough #374
Comments
so.. after a lot of digging through stuff, i found that there is a issue pending on winit rust-windowing/winit#1434 and rust-windowing/winit#1884 , which is trying to get input transparency working on X11. it is right now pending as there is no X11 maintainer. and will stay that way until we get a new maintainer. i'm guessing until winit doesn't implement that, egui cannot either. |
egui is agnostic to how it gets its input. egui_glium uses winit and so depends on features landing there first. But perhaps it's worth investigating alternatives like egui-miniquad |
Oh, i actually already got this. glfw has input passthrough in the next version (which might take a long time to release), so, i forked glfw-rs and glfw-sys, copied the relevant code, and i can just do window.set_passthrough(bool) to go fully input passthrough or normal window mode. right now, i use the egui's wants_pointer_input and wants_keyboard_input functions, and if egui wants it, then i set passthrough to false and if egui doesn't need input, i set passthrough to true. its working very very well <3 winit can't get it because the x11 library that winit depends on doesn't have bindings for xshape extension yet, although there was an attempt to get it going for mac rust-windowing/winit#1884 , that pr has been abandoned for 5 months now. the x11 library that winit depends on is abandoned too atm :( and winit itself lacks X11 maintainers rust-windowing/winit#1940 . |
https://github.com/coderedart/glfw-rs is the repo where i have input_passthrough added. if someone wants a similar thing. those wants_input functions are godsend honestly :D the only glue i need is to query the mouse position with window.get_cursor_pos() which takes like 30 micro seconds, so i can gladly do that every frame and set it. then, just ask egui if it wants input. I can also use a library like device_query or my favorite rdev which will give us global mouse position (or other global events like keypresses) which we can convert to local coordinates by offsetting them with window position, but that's for more advanced cases like global shortcut to make the window passthrough/not so that it kind works like discord overlay. |
Thanks for sharing! |
Is your feature request related to a problem? Please describe.
i want to make an overlay for a game. and as i will draw routes and stuff transparently over the game, i want the input to passthrough the program to the game.
Describe the solution you'd like
keyboard or mouse events should just passthrough the window as if it did not exist.
Describe alternatives you've considered
Qt::WindowTransparentForInput in qt framework is basically that. but i don't wanna use c++
Additional context
I will link my discussion as it has an example screenshots of another similar addon and other features like always_on_top etc.. which i wanted for this project.
#354
The text was updated successfully, but these errors were encountered: