mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-07-03 11:31:47 +02:00
Support CEF runtime in window commands
This commit is contained in:
@@ -183,7 +183,7 @@ struct AppMetaData {
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
async fn cmd_metadata(app_handle: AppHandle) -> YaakResult<AppMetaData> {
|
||||
async fn cmd_metadata<R: Runtime>(app_handle: AppHandle<R>) -> YaakResult<AppMetaData> {
|
||||
let app_data_dir = app_handle.path().app_data_dir()?;
|
||||
let app_log_dir = app_handle.path().app_log_dir()?;
|
||||
let vendored_plugin_dir =
|
||||
@@ -968,7 +968,7 @@ async fn cmd_send_ephemeral_request<R: Runtime>(
|
||||
mut request: HttpRequest,
|
||||
environment_id: Option<&str>,
|
||||
cookie_jar_id: Option<&str>,
|
||||
window: WebviewWindow,
|
||||
window: WebviewWindow<R>,
|
||||
app_handle: AppHandle<R>,
|
||||
) -> YaakResult<HttpResponse> {
|
||||
let response = HttpResponse::default();
|
||||
@@ -1594,8 +1594,8 @@ async fn cmd_get_workspace_meta<R: Runtime>(
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
async fn cmd_new_child_window(
|
||||
parent_window: WebviewWindow,
|
||||
async fn cmd_new_child_window<R: Runtime>(
|
||||
parent_window: WebviewWindow<R>,
|
||||
url: &str,
|
||||
label: &str,
|
||||
title: &str,
|
||||
@@ -1615,7 +1615,7 @@ async fn cmd_new_child_window(
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
async fn cmd_new_main_window(app_handle: AppHandle, url: &str) -> YaakResult<()> {
|
||||
async fn cmd_new_main_window<R: Runtime>(app_handle: AppHandle<R>, url: &str) -> YaakResult<()> {
|
||||
let use_native_titlebar = app_handle.db().get_settings().use_native_titlebar;
|
||||
let win = yaak_window::window::create_main_window(&app_handle, url, use_native_titlebar)?;
|
||||
setup_window_menu(&win)?;
|
||||
|
||||
@@ -119,11 +119,11 @@ pub fn create_window<R: Runtime>(
|
||||
Ok(win)
|
||||
}
|
||||
|
||||
pub fn create_main_window(
|
||||
handle: &AppHandle,
|
||||
pub fn create_main_window<R: Runtime>(
|
||||
handle: &AppHandle<R>,
|
||||
url: &str,
|
||||
use_native_titlebar: bool,
|
||||
) -> tauri::Result<WebviewWindow> {
|
||||
) -> tauri::Result<WebviewWindow<R>> {
|
||||
let mut counter = 0;
|
||||
let label = loop {
|
||||
let label = format!("{MAIN_WINDOW_PREFIX}{counter}");
|
||||
@@ -152,14 +152,14 @@ pub fn create_main_window(
|
||||
create_window(handle, config)
|
||||
}
|
||||
|
||||
pub fn create_child_window(
|
||||
parent_window: &WebviewWindow,
|
||||
pub fn create_child_window<R: Runtime>(
|
||||
parent_window: &WebviewWindow<R>,
|
||||
url: &str,
|
||||
label: &str,
|
||||
title: &str,
|
||||
inner_size: (f64, f64),
|
||||
use_native_titlebar: bool,
|
||||
) -> tauri::Result<WebviewWindow> {
|
||||
) -> tauri::Result<WebviewWindow<R>> {
|
||||
let app_handle = parent_window.app_handle();
|
||||
let label = format!("{OTHER_WINDOW_PREFIX}_{label}");
|
||||
let scale_factor = parent_window.scale_factor()?;
|
||||
|
||||
Reference in New Issue
Block a user