update to support winit multi-window

This commit is contained in:
Ashley Wulber 2023-12-07 15:27:52 -05:00 committed by Ashley Wulber
parent 77e9a160c4
commit c66e4aafd0
13 changed files with 149 additions and 97 deletions

View file

@ -4,6 +4,7 @@
//! Application API example
use cosmic::app::{Command, Core, Settings};
use cosmic::iced_core::Size;
use cosmic::widget::nav_bar;
use cosmic::{executor, iced, ApplicationExt, Element};
@ -43,7 +44,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
.default_icon_theme("Pop")
.default_text_size(16.0)
.scale_factor(1.0)
.size((1024, 768))
.size(Size::new(1024., 768.))
.theme(cosmic::Theme::dark());
cosmic::app::run::<App>(settings, input)?;

View file

@ -15,6 +15,6 @@ pub fn main() -> cosmic::iced::Result {
env_logger::init_from_env(env);
cosmic::icon_theme::set_default("Pop");
let mut settings = Settings::default();
settings.window.min_size = Some((600, 300));
settings.window.min_size = Some(cosmic::iced::Size::new(600., 300.));
Window::run(settings)
}

View file

@ -436,10 +436,10 @@ impl Application for Window {
Message::ToggleNavBarCondensed => {
self.nav_bar_toggled_condensed = !self.nav_bar_toggled_condensed
}
Message::Drag => return drag(),
Message::Close => return close(),
Message::Minimize => return minimize(true),
Message::Maximize => return toggle_maximize(),
Message::Drag => return drag(window::Id::MAIN),
Message::Close => return close(window::Id::MAIN),
Message::Minimize => return minimize(window::Id::MAIN, true),
Message::Maximize => return toggle_maximize(window::Id::MAIN),
Message::InputChanged => {}

View file

@ -16,7 +16,7 @@ use url::Url;
#[rustfmt::skip]
fn main() -> Result<(), Box<dyn std::error::Error>> {
let settings = Settings::default()
.size((1024, 768));
.size(cosmic::iced::Size::new(1024.0, 768.0));
cosmic::app::run::<App>(settings, ())?;
@ -77,7 +77,10 @@ impl cosmic::Application for App {
};
app.set_header_title("Open a file".into());
let cmd = app.set_window_title("COSMIC OpenDialog Demo".into());
let cmd = app.set_window_title(
"COSMIC OpenDialog Demo".into(),
cosmic::iced::window::Id::MAIN,
);
(app, cmd)
}