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