Skip to content
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

eframe: Request window focus #2843

Closed
philpax opened this issue Mar 26, 2023 · 1 comment
Closed

eframe: Request window focus #2843

philpax opened this issue Mar 26, 2023 · 1 comment
Labels
feature New feature or request

Comments

@philpax
Copy link

philpax commented Mar 26, 2023

Is your feature request related to a problem? Please describe.
I'm building an overlay that pops up (using frame.set_visible) on a hotkey with eframe and egui, and I'd like it to consistently focus the input widget. However, Response::request_focus does not appear to focus the widget the first time around.

I believe this is because the overlay window itself is not focused.

Describe the solution you'd like
eframe::Frame::request_focus, which requests the frame to be focused on platforms where it's supported.

I believe this would be relatively simple for the winit backend of epi: it should just be a call to winit::Window::focus_window.

Describe alternatives you've considered
Response::request_focus could implicitly focus the window, but that may be unexpected behaviour (especially as it would likely break existing workflows)

Additional context
I'm happy to implement this myself and submit a PR, but I wanted to check that this would fit within the purview of eframe first.

@philpax philpax added the feature New feature or request label Mar 26, 2023
@TicClick
Copy link
Contributor

TicClick commented May 6, 2023

this has been added in #2900, but not yet released under any tag

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants