mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-05-17 13:17:01 +02:00
Cargo fmt
This commit is contained in:
@@ -122,9 +122,7 @@ fn setup_window_menu<R: Runtime>(win: &WebviewWindow<R>) -> Result<()> {
|
||||
}
|
||||
|
||||
// Commands for development
|
||||
"dev.reset_size" => webview_window
|
||||
.set_size(LogicalSize::new(1100.0, 600.0))
|
||||
.unwrap(),
|
||||
"dev.reset_size" => webview_window.set_size(LogicalSize::new(1100.0, 600.0)).unwrap(),
|
||||
"dev.reset_size_16x9" => {
|
||||
let width = webview_window.outer_size().unwrap().width;
|
||||
let height = width * 9 / 16;
|
||||
@@ -1507,7 +1505,6 @@ async fn cmd_reload_plugins<R: Runtime>(
|
||||
Ok(errors)
|
||||
}
|
||||
|
||||
|
||||
#[tauri::command]
|
||||
async fn cmd_plugin_info<R: Runtime>(
|
||||
id: &str,
|
||||
@@ -1580,7 +1577,14 @@ async fn cmd_new_child_window(
|
||||
inner_size: (f64, f64),
|
||||
) -> YaakResult<()> {
|
||||
let use_native_titlebar = parent_window.app_handle().db().get_settings().use_native_titlebar;
|
||||
let win = yaak_window::window::create_child_window(&parent_window, url, label, title, inner_size, use_native_titlebar)?;
|
||||
let win = yaak_window::window::create_child_window(
|
||||
&parent_window,
|
||||
url,
|
||||
label,
|
||||
title,
|
||||
inner_size,
|
||||
use_native_titlebar,
|
||||
)?;
|
||||
setup_window_menu(&win)?;
|
||||
Ok(())
|
||||
}
|
||||
@@ -1878,7 +1882,11 @@ pub fn run() {
|
||||
match event {
|
||||
RunEvent::Ready => {
|
||||
let use_native_titlebar = app_handle.db().get_settings().use_native_titlebar;
|
||||
if let Ok(win) = yaak_window::window::create_main_window(app_handle, "/", use_native_titlebar) {
|
||||
if let Ok(win) = yaak_window::window::create_main_window(
|
||||
app_handle,
|
||||
"/",
|
||||
use_native_titlebar,
|
||||
) {
|
||||
let _ = setup_window_menu(&win);
|
||||
}
|
||||
let h = app_handle.clone();
|
||||
|
||||
@@ -3,7 +3,6 @@ use crate::http_request::send_http_request_with_context;
|
||||
use crate::models_ext::BlobManagerExt;
|
||||
use crate::models_ext::QueryManagerExt;
|
||||
use crate::render::{render_grpc_request, render_http_request, render_json_value};
|
||||
use yaak_window::window::{CreateWindowConfig, create_window};
|
||||
use crate::{
|
||||
call_frontend, cookie_jar_from_window, environment_from_window, get_window_from_plugin_context,
|
||||
workspace_from_window,
|
||||
@@ -36,6 +35,7 @@ use yaak_plugins::plugin_handle::PluginHandle;
|
||||
use yaak_plugins::template_callback::PluginTemplateCallback;
|
||||
use yaak_tauri_utils::window::WorkspaceWindowTrait;
|
||||
use yaak_templates::{RenderErrorBehavior, RenderOptions};
|
||||
use yaak_window::window::{CreateWindowConfig, create_window};
|
||||
|
||||
pub(crate) async fn handle_plugin_event<R: Runtime>(
|
||||
app_handle: &AppHandle<R>,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use log::{error, info, warn};
|
||||
use tauri::{Emitter, Manager, RunEvent, State, WebviewWindow};
|
||||
use tauri::Runtime;
|
||||
use tauri::{Emitter, Manager, RunEvent, State, WebviewWindow};
|
||||
use yaak_proxy_lib::ProxyCtx;
|
||||
use yaak_rpc::{RpcEventEmitter, RpcRouter};
|
||||
use yaak_window::window::CreateWindowConfig;
|
||||
|
||||
@@ -109,19 +109,16 @@ fn position_traffic_lights(ns_window_handle: UnsafeWindowHandle, x: f64, y: f64,
|
||||
// we've modified it. This avoids the height growing on repeated calls.
|
||||
use std::sync::OnceLock;
|
||||
static DEFAULT_TITLEBAR_HEIGHT: OnceLock<f64> = OnceLock::new();
|
||||
let default_height =
|
||||
*DEFAULT_TITLEBAR_HEIGHT.get_or_init(|| NSView::frame(title_bar_container_view).size.height);
|
||||
let default_height = *DEFAULT_TITLEBAR_HEIGHT
|
||||
.get_or_init(|| NSView::frame(title_bar_container_view).size.height);
|
||||
|
||||
// On pre-Tahoe, button_height + y is larger than the default title bar
|
||||
// height, so the resize works as before. On Tahoe (26+), the default is
|
||||
// already 32px and button_height + y = 32, so nothing changes. In that
|
||||
// case, add TITLEBAR_EXTRA_HEIGHT extra pixels to push the buttons down.
|
||||
let desired = button_height + y;
|
||||
let title_bar_frame_height = if desired > default_height {
|
||||
desired
|
||||
} else {
|
||||
default_height + TITLEBAR_EXTRA_HEIGHT
|
||||
};
|
||||
let title_bar_frame_height =
|
||||
if desired > default_height { desired } else { default_height + TITLEBAR_EXTRA_HEIGHT };
|
||||
|
||||
let mut title_bar_rect = NSView::frame(title_bar_container_view);
|
||||
title_bar_rect.size.height = title_bar_frame_height;
|
||||
|
||||
Reference in New Issue
Block a user