Skip to content

Possibility of supporting the ability to make a window visible but not active? #2580

@fgimian

Description

@fgimian

Hey there folks, hope all is well 😄

As per the code at https://github.com/rust-windowing/winit/blob/master/src/platform_impl/windows/window_state.rs#L304, winit will use the SW_SHOW flag when the window is set to visible which will both make it visible and activate the window (i.e. switch to it). Here are the relevant SDK docs.

Since I'm developing a widget application which is really intended as an overlay, I'm using window settings such as these below:

    let window_builder = WindowBuilder::new()
        .with_title("TotalMix Volume Control")
        .with_always_on_top(true)
        .with_decorations(false)
        .with_skip_taskbar(true)
        .with_drag_and_drop(false)
        .with_resizable(false)
        .with_transparent(true)
...
                // Allow the mouse cursor to pass through the window.
                gl_window.window().set_cursor_hittest(false).unwrap();
...

This works great but I'd really like the ability to make the window visible without activating it (using the SW_SHOWNOACTIVATE flag) so that focus is not taken away from whatever window the user is working on. I've verified this indeed works exactly as expected too.

Do you think this is something we could support in winit? I'm not sure if this is possible in all OSs but I know that it definitely works on Windows.

Thanks heaps!
Fotis

Metadata

Metadata

Assignees

No one assigned

    Labels

    DS - win32Affects the Win32/Windows backendS - apiDesign and usability

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions