comment out unnecessary windows handling
This commit is contained in:
@@ -1,9 +1,9 @@
|
|||||||
use tauri::{AppHandle, Manager, WebviewWindow, WebviewWindowBuilder};
|
use tauri::{AppHandle, Manager, WebviewWindow, WebviewWindowBuilder};
|
||||||
use tauri_plugin_global_shortcut::{GlobalShortcutExt, Shortcut, ShortcutState};
|
use tauri_plugin_global_shortcut::{GlobalShortcutExt, Shortcut, ShortcutState};
|
||||||
|
|
||||||
|
use super::window::make_transparent;
|
||||||
#[cfg(target_os = "linux")]
|
#[cfg(target_os = "linux")]
|
||||||
use super::window::focus_window_linux;
|
use super::window::focus_window_linux;
|
||||||
use super::window::make_transparent;
|
|
||||||
|
|
||||||
pub const DEFAULT_TOOLBAR_SHORTCUT: &str = "CmdOrCtrl+Shift+/";
|
pub const DEFAULT_TOOLBAR_SHORTCUT: &str = "CmdOrCtrl+Shift+/";
|
||||||
const TOOLBAR_WINDOW_LABEL: &str = "Toolbar";
|
const TOOLBAR_WINDOW_LABEL: &str = "Toolbar";
|
||||||
@@ -13,15 +13,15 @@ const TOOLBAR_WIDTH: f64 = 702.0;
|
|||||||
#[cfg(target_os = "windows")]
|
#[cfg(target_os = "windows")]
|
||||||
const TOOLBAR_HEIGHT: f64 = 460.0;
|
const TOOLBAR_HEIGHT: f64 = 460.0;
|
||||||
|
|
||||||
#[cfg(target_os = "windows")]
|
// #[cfg(target_os = "windows")]
|
||||||
fn refresh_toolbar_bounds(window: &WebviewWindow) -> Result<(), tauri::Error> {
|
// fn refresh_toolbar_bounds(window: &WebviewWindow) -> Result<(), tauri::Error> {
|
||||||
// WebView2 can retain stale bounds when this initially-hidden window is shown.
|
// // WebView2 can retain stale bounds when this initially-hidden window is shown.
|
||||||
// A real resize (for example maximizing the window) fixes the clipped viewport,
|
// // A real resize (for example maximizing the window) fixes the clipped viewport,
|
||||||
// so force the same bounds refresh without leaving the toolbar enlarged.
|
// // so force the same bounds refresh without leaving the toolbar enlarged.
|
||||||
window.set_size(tauri::LogicalSize::new(TOOLBAR_WIDTH + 1.0, TOOLBAR_HEIGHT))?;
|
// window.set_size(tauri::LogicalSize::new(TOOLBAR_WIDTH + 1.0, TOOLBAR_HEIGHT))?;
|
||||||
window.set_size(tauri::LogicalSize::new(TOOLBAR_WIDTH, TOOLBAR_HEIGHT))?;
|
// window.set_size(tauri::LogicalSize::new(TOOLBAR_WIDTH, TOOLBAR_HEIGHT))?;
|
||||||
Ok(())
|
// Ok(())
|
||||||
}
|
// }
|
||||||
|
|
||||||
fn create_toolbar_window(app_handle: &AppHandle) -> Result<WebviewWindow, tauri::Error> {
|
fn create_toolbar_window(app_handle: &AppHandle) -> Result<WebviewWindow, tauri::Error> {
|
||||||
let monitor = match app_handle.primary_monitor()? {
|
let monitor = match app_handle.primary_monitor()? {
|
||||||
@@ -129,8 +129,8 @@ pub fn show_toolbar_window(app_handle: &AppHandle) -> Result<(), tauri::Error> {
|
|||||||
if let Some(window) = app_handle.get_webview_window(TOOLBAR_WINDOW_LABEL) {
|
if let Some(window) = app_handle.get_webview_window(TOOLBAR_WINDOW_LABEL) {
|
||||||
window.show()?;
|
window.show()?;
|
||||||
window.unminimize()?;
|
window.unminimize()?;
|
||||||
#[cfg(target_os = "windows")]
|
// #[cfg(target_os = "windows")]
|
||||||
refresh_toolbar_bounds(&window)?;
|
// refresh_toolbar_bounds(&window)?;
|
||||||
window.set_focus()?;
|
window.set_focus()?;
|
||||||
#[cfg(target_os = "linux")]
|
#[cfg(target_os = "linux")]
|
||||||
focus_window_linux(app_handle, &window);
|
focus_window_linux(app_handle, &window);
|
||||||
@@ -148,8 +148,8 @@ fn open_toolbar(app_handle: &AppHandle) -> Result<(), tauri::Error> {
|
|||||||
} else {
|
} else {
|
||||||
window.show()?;
|
window.show()?;
|
||||||
window.unminimize()?;
|
window.unminimize()?;
|
||||||
#[cfg(target_os = "windows")]
|
// #[cfg(target_os = "windows")]
|
||||||
refresh_toolbar_bounds(&window)?;
|
// refresh_toolbar_bounds(&window)?;
|
||||||
window.set_focus()?;
|
window.set_focus()?;
|
||||||
#[cfg(target_os = "linux")]
|
#[cfg(target_os = "linux")]
|
||||||
focus_window_linux(app_handle, &window);
|
focus_window_linux(app_handle, &window);
|
||||||
|
|||||||
Reference in New Issue
Block a user