Skip to content

WindowSizePolicy::Content leaves a gap on Windows #2030

Open
@ghost

Description

Building from git+https://github.com/linebender/druid.git?branch=master#b6d389dec1aaafb239e7f0e72caac0d9de4285b6.

For code,

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<State> {
    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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugdoes not behave the way it is supposed toshell/winconcerns the Windows backend

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions