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

Zed Cannot Display a Window on Windows OS after Being Built #18610

Closed
1 task done
InfyniteHeap opened this issue Oct 2, 2024 · 6 comments · Fixed by #18705
Closed
1 task done

Zed Cannot Display a Window on Windows OS after Being Built #18610

InfyniteHeap opened this issue Oct 2, 2024 · 6 comments · Fixed by #18705
Labels
bug [core label] windows workspace Feedback for workspace management, layout, interactions, etc

Comments

@InfyniteHeap
Copy link

Check for existing issues

  • Completed

Describe the bug / provide steps to reproduce it

Descriptions

I cloned the source code, built and tried running it, but it cannot display an window, and threw errors instead.

Here are the errors:

[2024-10-02T14:04:52+08:00 ERROR fs.rs] Error { kind: Generic("Input watch path is neither a file nor a directory."), paths: [] }
[2024-10-02T14:04:52+08:00 ERROR fs.rs] Error { kind: Generic("Input watch path is neither a file nor a directory."), paths: [] }
[2024-10-02T14:04:53+08:00 ERROR fs.rs] Error { kind: Generic("Input watch path is neither a file nor a directory."), paths: [] }
[2024-10-02T14:04:53+08:00 ERROR fs.rs] Error { kind: Generic("Input watch path is neither a file nor a directory."), paths: [] }
[2024-10-02T14:04:53+08:00 ERROR fs.rs] Error { kind: Generic("Input watch path is neither a file nor a directory."), paths: [] }
[2024-10-02T14:04:54+08:00 ERROR blade_graphics::hal::init] No composite alpha flag for transparency: OPAQUE
[2024-10-02T14:04:54+08:00 ERROR blade_graphics::hal::init] No composite alpha flag for transparency: OPAQUE
[2024-10-02T14:04:54+08:00 ERROR blade_graphics::hal::init] No composite alpha flag for transparency: OPAQUE
[2024-10-02T14:04:55+08:00 ERROR fs.rs] Error { kind: Generic("Input watch path is neither a file nor a directory."), paths: [] }
[2024-10-02T14:04:55+08:00 ERROR] Error { code: HRESULT(0x80070057), message: "参数错误。" }
[2024-10-02T14:04:55+08:00 ERROR] Error { code: HRESULT(0x80070057), message: "参数错误。" }
[2024-10-02T14:04:55+08:00 ERROR fs.rs] Error { kind: Generic("Input watch path is neither a file nor a directory."), paths: [] }
[2024-10-02T14:04:55+08:00 ERROR] no worktrees when constructing LocalLspAdapterDelegate

How to Reproduce

  1. Clone this repo on a Windows computer.
  2. Just build it!
  3. Double-click zed.exe and wait for errors.

Environment

As what the bug described, I cannot run the command and have to provide the environment manually:
Zed: v0.156.0 (Zed Dev 563a1dc)
OS: Windows 10.0.22631
Memory: 15.2 GiB
Architecture: x86_64
GPU: NVIDIA GeForce RTX 3050 Ti Laptop GPU || Nvidia Corporation || 32.0.15.6094

If applicable, add mockups / screenshots to help explain present your vision of the feature

No response

If applicable, attach your Zed.log file to this issue.

Zed.log
@InfyniteHeap InfyniteHeap added admin read bug [core label] labels Oct 2, 2024
@Rar9
Copy link

Rar9 commented Oct 2, 2024

+1 it startes but doesnt open windows

@CharlesChen0823
Copy link
Contributor

CharlesChen0823 commented Oct 2, 2024

@Nadiro05
Copy link

Nadiro05 commented Oct 2, 2024

same problem. I see it in task manager but does not display any window

@zhouxs1023
Copy link

+1 error as below:
Error { kind: Generic("Input watch path is neither a file nor a directory."), paths: [] }

@vhanla
Copy link

vhanla commented Oct 7, 2024

You need to set WindowOptions to visible at crates\zed\src\zed.rs

pub fn build_window_options(display_uuid: Option<Uuid>, cx: &mut AppContext) -> WindowOptions {
    let display = display_uuid.and_then(|uuid| {
        cx.displays()
            .into_iter()
            .find(|display| display.uuid().ok() == Some(uuid))
    });
    let app_id = ReleaseChannel::global(cx).app_id();
    let window_decorations = match std::env::var("ZED_WINDOW_DECORATIONS") {
        Ok(val) if val == "server" => gpui::WindowDecorations::Server,
        Ok(val) if val == "client" => gpui::WindowDecorations::Client,
        _ => gpui::WindowDecorations::Client,
    };

    WindowOptions {
        titlebar: Some(TitlebarOptions {
            title: None,
            appears_transparent: true,
            traffic_light_position: Some(point(px(9.0), px(9.0))),
        }),
        window_bounds: None,
        focus: false,
        show: true, ////////////<---------- HERE IS SET TO FALSE, CHANGE IT
        kind: WindowKind::Normal,
        is_movable: true,
        display_id: display.map(|display| display.id()),
        window_background: cx.theme().window_background_appearance(),
        app_id: Some(app_id.to_owned()),
        window_decorations: Some(window_decorations),
        window_min_size: Some(gpui::Size {
            width: px(360.0),
            height: px(240.0),
        }),
    }
}

@G-Costa
Copy link

G-Costa commented Oct 8, 2024

Solution provided by vhanla works for me.

SomeoneToIgnore pushed a commit that referenced this issue Oct 10, 2024
- Closes #18610


This PR addresses the same issue as PR #18578. After a full day of
research and testing, I believe I’ve found the best solution to resolve
this issue. With this PR, the window creation behavior on Windows
becomes more consistent with macOS:

- When `params.show` is `true`: The window is created and immediately
displayed.
- When `params.show` is `false`: The window is created but remains
hidden until the first call to `activate_window`.

As I mentioned in #18578, `winit` creates hidden windows by setting the
window's `exstyle` to `WS_EX_NOACTIVATE | WS_EX_TRANSPARENT |
WS_EX_LAYERED | WS_EX_TOOLWINDOW`, which is different from the method
used in this PR. Here, the window is created with normal parameters, but
we do not call `ShowWindow` so the window is not shown.

I'm not sure why `winit` doesn't use a smilliar approach like this PR to
create hidden windows. My guess is that `winit` is creating this hidden
window to function as a "DispatchWindow" — serving a purpose similar to
`WindowsPlatform` in `zed`. To ensure the window stays hidden even if
`ShowWindow` is called, they use the `exstyle` approach.

With the method used in this PR, my initial tests haven't revealed any
issues.



Release Notes:

- N/A
noaccOS pushed a commit to noaccOS/zed that referenced this issue Oct 19, 2024
- Closes zed-industries#18610


This PR addresses the same issue as PR zed-industries#18578. After a full day of
research and testing, I believe I’ve found the best solution to resolve
this issue. With this PR, the window creation behavior on Windows
becomes more consistent with macOS:

- When `params.show` is `true`: The window is created and immediately
displayed.
- When `params.show` is `false`: The window is created but remains
hidden until the first call to `activate_window`.

As I mentioned in zed-industries#18578, `winit` creates hidden windows by setting the
window's `exstyle` to `WS_EX_NOACTIVATE | WS_EX_TRANSPARENT |
WS_EX_LAYERED | WS_EX_TOOLWINDOW`, which is different from the method
used in this PR. Here, the window is created with normal parameters, but
we do not call `ShowWindow` so the window is not shown.

I'm not sure why `winit` doesn't use a smilliar approach like this PR to
create hidden windows. My guess is that `winit` is creating this hidden
window to function as a "DispatchWindow" — serving a purpose similar to
`WindowsPlatform` in `zed`. To ensure the window stays hidden even if
`ShowWindow` is called, they use the `exstyle` approach.

With the method used in this PR, my initial tests haven't revealed any
issues.



Release Notes:

- N/A
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug [core label] windows workspace Feedback for workspace management, layout, interactions, etc
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants