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

gpui: Fix popup kind window support on Windows #14063

Merged

Conversation

huacnlee
Copy link
Contributor

@huacnlee huacnlee commented Jul 10, 2024

Release Notes:

  • N/A

Continue #14044 for Windows

The problem

The cx.open_window method has provided us a window_kind option to allows creating a Popup kind. This behavior can work on macOS, the popup kind window have no-border, no-shadow, no-resize, and followed the is_movable if present true it can't move.

This PR to fix those supports on Windows.

The border and shadow still exist, I have tried to use WS_POPUP window_style, but it will crash:

This is looks like complex, it is out of my known.

    Blocking waiting for file lock on build directory
   Compiling gpui v0.1.0 (F:\work\zed\crates\gpui)
    Finished `dev` profile [unoptimized   debuginfo] target(s) in 13.96s
     Running `target\debug\examples\window_positioning.exe`
thread 'main' panicked at F:\Users\jason\.cargo\git\checkouts\blade-b2bcd1de1cf7ab6a\21a56f7\blade-graphics\src\vulkan\init.rs:864:18:
called `Result::unwrap()` on an `Err` value: ERROR_OUT_OF_DEVICE_MEMORY
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
error: process didn't exit successfully: `target\debug\examples\window_positioning.exe` (exit code: 0xc0000409, STATUS_STACK_BUFFER_OVERRUN)

So I just make a simple change, to use WS_EX_TOOLWINDOW this can disable resize, and connect is_movable to handle_hit_test_msg to disable move, and also no Status Bar icon.

Before

before.mp4

After

after.mp4

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Jul 10, 2024
@ConradIrwin
Copy link
Collaborator

Thanks!

@ConradIrwin ConradIrwin merged commit 1887a6d into zed-industries:main Jul 10, 2024
11 checks passed
@huacnlee huacnlee deleted the fix-windows-popup-kind-window branch July 11, 2024 00:21
ConradIrwin pushed a commit that referenced this pull request Jul 11, 2024
Release Notes:

- N/A

----

Fix #14106 

Sorry, the previous change in #14063 I have made a mistake. I shouldn't
have changed the previous logic.

```diff
- if !state_ptr.hide_title_bar {
  if state_ptr.hide_title_bar {
```

## Test


https://github.com/zed-industries/zed/assets/5518/e03fbcac-be6b-4a9d-8937-d3b5e236b564

And the popup window limit is still works.
@MatinAniss
Copy link
Contributor

MatinAniss commented Jul 11, 2024

I'm wondering why the window extended style was changed from WS_EX_APPWINDOW to WS_EX_OVERLAPPEDWINDOW due to this change when selecting or unselecting the WindowKind::Normal window sometimes a strange white border is shown around inside edge of the window. I'm experiencing this on Windows 11. @huacnlee

@huacnlee
Copy link
Contributor Author

huacnlee commented Jul 11, 2024

... Sorry.

This is what I tried to change when I was repeatedly experimenting with the Popup window style. I forgot to revert it before a push. There was no need to modify it originally.

ConradIrwin pushed a commit that referenced this pull request Jul 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed The user has signed the Contributor License Agreement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants