WindowSizePolicy::Content leaves a gap on Windows
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 9.7k
- Forks
- 565
- PR merge metrics
- No merged PRs in 30d
Description
Building from `git+https://github.com/linebender/druid.git?branch=master#b6d389dec1aaafb239e7f0e72caac0d9de4285b6`.
For code,
```rust
use druid::widget::{TextBox};
use druid::{AppLauncher, Data, Lens, PlatformError, Widget, WidgetExt, WindowDesc};
#[derive(Clone, Data, Lens)]
struct State {
input: String,
}
fn main() -> Result<(), PlatformError> {
let main_window = WindowDesc::new(ui_builder())
.show_titlebar(true)
.window_size_policy(druid::WindowSizePolicy::Content);
let initial_state = State { input: String::new() };
AppLauncher::with_window(main_window)
.launch(initial_state)
}
fn ui_builder() -> impl Widget {
TextBox::new()
.lens(State::input)
.fix_width(350.0)
}
```
When `show_titlebar` is true, the main window size is perfect: https://snipboard.io/d2U4pv.jpg
When `show_titlebar` is false, the main window size is too tall, leaving a gap between the text box and the bottom border of the main window: https://snipboard.io/1o9ts4.jpg
This bug only happens on Windows. On Macos, both cases are fine.
Windows version info: 20H2 (OS Build 19042.1288)
---
Additional info: height of the gap changes with font family. For example, after I changed textbox's font to the monospace family, the gap got visibly bigger.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue with the provided Rust example using WindowSizePolicy::Content, comparing show_titlebar(true) and false on Windows. Search the WindowSizePolicy implementation and Windows window-sizing entry points, then trace how the content height is calculated. Done means titlebar and borderless windows fit the TextBox without a gap, including with different font families.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- desktop
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100