mirror of
https://github.com/tauri-apps/tauri.git
synced 2024-12-20 17:22:08 +03:00
c77b40324e
* feat: update to latest wry * wry dev branch [skip ci] * fix linux [skip ci] * refactor(runtime): split webview and window types * split dispatch * implement create_webview * move webview message * wip webview mod * create webview manager, finish webview struct and builder * fix tests and docs * rename WindowUrl to WebviewUrl * update examples * event refactor * update JS API * fix events * update example * add WebviewWindow class on JS * fix macos build * allow creating window+webview on the same runtime call * rename tauri://window-created to tauri://webview-created * Window::add_child * use inner_size from webview on macOS * add multiwebview example * automatically resize webviews on window resize * fix tests * set_position, set_size * position, size getters * set_focus * add close fn * update mock runtime * lint [skip ci] * fix inner_size getter [skip ci] * import hwnd [skip ci] * update webview bound ratios on set_size/set_position * add auto_resize option * fix android * fix build on windows * typo * with_webview isnt desktop only * add WebviewWindow rust struct (and builder) * fix build on android * license header * fix macos/windows * fix macos build * resolve todo * handle window not found * hide unstable features * document unstable feature [skip ci] * webview plugin permissions * hide more stuff * fix doctests * typos * add change files * fix examples * rename hook
59 lines
1.9 KiB
Rust
59 lines
1.9 KiB
Rust
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
|
|
|
|
use tauri::{LogicalPosition, LogicalSize, WebviewUrl};
|
|
|
|
fn main() {
|
|
tauri::Builder::default()
|
|
.setup(|app| {
|
|
let width = 800.;
|
|
let height = 600.;
|
|
let window = tauri::window::WindowBuilder::new(app, "main")
|
|
.inner_size(width, height)
|
|
.build()?;
|
|
|
|
let _webview1 = window.add_child(
|
|
tauri::webview::WebviewBuilder::new("main1", WebviewUrl::App(Default::default()))
|
|
.auto_resize(),
|
|
LogicalPosition::new(0., 0.),
|
|
LogicalSize::new(width / 2., height / 2.),
|
|
)?;
|
|
let _webview2 = window.add_child(
|
|
tauri::webview::WebviewBuilder::new(
|
|
"main2",
|
|
WebviewUrl::External("https://github.com/tauri-apps/tauri".parse().unwrap()),
|
|
)
|
|
.auto_resize(),
|
|
LogicalPosition::new(width / 2., 0.),
|
|
LogicalSize::new(width / 2., height / 2.),
|
|
)?;
|
|
let _webview3 = window.add_child(
|
|
tauri::webview::WebviewBuilder::new(
|
|
"main3",
|
|
WebviewUrl::External("https://tauri.app".parse().unwrap()),
|
|
)
|
|
.auto_resize(),
|
|
LogicalPosition::new(0., height / 2.),
|
|
LogicalSize::new(width / 2., height / 2.),
|
|
)?;
|
|
let _webview4 = window.add_child(
|
|
tauri::webview::WebviewBuilder::new(
|
|
"main4",
|
|
WebviewUrl::External("https://twitter.com/TauriApps".parse().unwrap()),
|
|
)
|
|
.auto_resize(),
|
|
LogicalPosition::new(width / 2., height / 2.),
|
|
LogicalSize::new(width / 2., height / 2.),
|
|
)?;
|
|
|
|
Ok(())
|
|
})
|
|
.run(tauri::generate_context!(
|
|
"../../examples/multiwebview/tauri.conf.json"
|
|
))
|
|
.expect("error while running tauri application");
|
|
}
|