Shell: windows implementation from content_insets#1592
Shell: windows implementation from content_insets#1592cmyr merged 1 commit intolinebender:masterfrom
Conversation
|
longing for it ^^, #1589 |
|
I won't be able to test this until tomorrow afternoon at the earliest. If anyone else on windows is able to do a review I'm happy to delegate approval to them :) |
|
i don't know if i should post it here but, |
|
@rjwittams any thoughts on this size business? |
|
I don't know off the top of my head. I do think that without the content offsets we could end up iteratively shrinking the window. I don't have windows currently to test with. |
|
@Zenthae did you have an example to reproduce this ? Myself I test using WindowSizePolicy::Content, with no size set on the tree example from nursery and it work fine. |
|
Okay I'm in front of a computer where I could test this, if anyone has any suggestions for what I should be testing? |
|
During my tests I checked the dropdown example from nursery, previously the sub_windows didn't pop where there should (and it's still the case if you use HiDPI monitor). And I tested WindowSizePolicy::Content on tree as explain, I don't know if there is better tests to do. |
cmyr
left a comment
There was a problem hiding this comment.
This looks correct to me; content_insets is supposed to return a pixel value, so it's possible that elsewhere there is something that is working in logical units and needs to be converted to pixels?
This is actually a bit iffy, though, I would expect window sizes to be in logical units, and not be display dependant, but this does at least do what the docs say it does.
Thanks!
|
Thanks! |
it's the beginning of a new app i'm doing. i used this as a test use druid::{
widget::{Label, Padding},
AppLauncher, Data, Lens, Widget, WindowDesc, WindowSizePolicy,
};
#[derive(Debug, Default, Data, Clone, Lens)]
struct AppState {}
fn ui_builder() -> impl Widget<AppState> {
Padding::new(5., Label::new("Hello Bluetooth monitor"))
}
fn main() -> windows::Result<()> {
let main_window = WindowDesc::new(ui_builder())
.title("Bluetooth Monitor")
// .window_size((100.0, 40.0))
.window_size_policy(WindowSizePolicy::Content);
AppLauncher::with_window(main_window)
.use_simple_logger()
.launch(AppState::default())
.expect("Failed to start the app");
Ok(())
} |
With this dropdown should be better on windows.
There is still an issue with HiDPI screen, it doesn't look like using the scale factor in this function helps.