From 6dbea8ff5e7ccb89eb8a02398c5d270f1c7191a6 Mon Sep 17 00:00:00 2001 From: rawnly Date: Sat, 2 Dec 2023 18:50:45 +0100 Subject: [PATCH] chore: run fmt --- config/src/keyassignment.rs | 2 -- config/src/lib.rs | 2 +- config/src/window.rs | 4 +--- wezterm-gui/src/commands.rs | 12 +++++------- wezterm-gui/src/termwindow/mod.rs | 4 ++-- window/src/lib.rs | 4 ++-- window/src/os/macos/window.rs | 21 ++++++++++++--------- 7 files changed, 23 insertions(+), 26 deletions(-) diff --git a/config/src/keyassignment.rs b/config/src/keyassignment.rs index ffe10db05..3479f1c8f 100644 --- a/config/src/keyassignment.rs +++ b/config/src/keyassignment.rs @@ -358,7 +358,6 @@ pub struct PaneSelectArguments { pub show_pane_ids: bool, } - #[derive(Debug, Clone, Copy, PartialEq, Eq, FromDynamic, ToDynamic)] pub enum CharSelectGroup { RecentlyUsed, @@ -502,7 +501,6 @@ fn default_fuzzy_description() -> String { "Fuzzy matching: ".to_string() } - #[derive(Debug, Clone, PartialEq, FromDynamic, ToDynamic)] pub enum KeyAssignment { SpawnTab(SpawnTabDomain), diff --git a/config/src/lib.rs b/config/src/lib.rs index 5315cf921..e4928d31c 100644 --- a/config/src/lib.rs +++ b/config/src/lib.rs @@ -19,7 +19,6 @@ use std::sync::{Arc, Mutex}; use std::time::Duration; use wezterm_dynamic::{FromDynamic, FromDynamicOptions, ToDynamic, UnknownFieldAction, Value}; -pub mod window; mod background; mod bell; mod color; @@ -40,6 +39,7 @@ mod tls; mod units; mod unix; mod version; +pub mod window; mod wsl; pub use crate::config::*; diff --git a/config/src/window.rs b/config/src/window.rs index 3f9280816..8f34e3866 100644 --- a/config/src/window.rs +++ b/config/src/window.rs @@ -1,5 +1,4 @@ -use wezterm_dynamic::{ToDynamic, FromDynamic}; - +use wezterm_dynamic::{FromDynamic, ToDynamic}; #[derive(Debug, Default, Clone, ToDynamic, PartialEq, Eq, FromDynamic)] pub enum WindowLevel { @@ -8,4 +7,3 @@ pub enum WindowLevel { Normal = 0, AlwaysOnTop = 3, } - diff --git a/wezterm-gui/src/commands.rs b/wezterm-gui/src/commands.rs index 98bd05063..e060e64ba 100644 --- a/wezterm-gui/src/commands.rs +++ b/wezterm-gui/src/commands.rs @@ -1,6 +1,7 @@ use crate::inputmap::InputMap; use config::keyassignment::*; -use config::{ConfigHandle, window::WindowLevel, DeferredKeyCode}; +use config::window::WindowLevel; +use config::{ConfigHandle, DeferredKeyCode}; use mux::domain::DomainState; use mux::Mux; use ordered_float::NotNan; @@ -2057,14 +2058,11 @@ fn compute_default_actions() -> Vec { ScrollToBottom, // ----------------- Window ToggleFullScreen, - ToggleAlwaysOnTop, ToggleAlwaysOnBottom, - - SetWindowLevel(WindowLevel::AlwaysOnBottom), - SetWindowLevel(WindowLevel::Normal), - SetWindowLevel(WindowLevel::AlwaysOnTop), - + SetWindowLevel(WindowLevel::AlwaysOnBottom), + SetWindowLevel(WindowLevel::Normal), + SetWindowLevel(WindowLevel::AlwaysOnTop), Hide, Search(Pattern::CurrentSelectionOrEmptyString), PaneSelect(PaneSelectArguments { diff --git a/wezterm-gui/src/termwindow/mod.rs b/wezterm-gui/src/termwindow/mod.rs index fa9913331..36553723b 100644 --- a/wezterm-gui/src/termwindow/mod.rs +++ b/wezterm-gui/src/termwindow/mod.rs @@ -32,10 +32,10 @@ use config::keyassignment::{ KeyAssignment, PaneDirection, Pattern, PromptInputLine, QuickSelectArguments, RotationDirection, SpawnCommand, SplitSize, }; +use config::window::WindowLevel; use config::{ configuration, AudibleBell, ConfigHandle, Dimension, DimensionContext, FrontEndSelection, GeometryOrigin, GuiPosition, TermConfig, WindowCloseConfirmation, - window::WindowLevel }; use lfucache::*; use mlua::{FromLua, UserData, UserDataFields}; @@ -2537,7 +2537,7 @@ impl TermWindow { SetWindowLevel(level) => { let window = self.window.clone().unwrap(); window.set_window_level(level.clone()); - }, + } CopyTo(dest) => { let text = self.selection_text(pane); self.copy_to_clipboard(*dest, text); diff --git a/window/src/lib.rs b/window/src/lib.rs index 0ffe87bc8..e799fb985 100644 --- a/window/src/lib.rs +++ b/window/src/lib.rs @@ -1,6 +1,7 @@ use async_trait::async_trait; use bitflags::bitflags; -use config::{ConfigHandle, window::WindowLevel, Dimension, GeometryOrigin}; +use config::window::WindowLevel; +use config::{ConfigHandle, Dimension, GeometryOrigin}; use promise::Future; use std::any::Any; use std::path::PathBuf; @@ -71,7 +72,6 @@ pub enum MouseCursor { SizeLeftRight, } - /// Represents the preferred appearance of the windowing /// environment. #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] diff --git a/window/src/os/macos/window.rs b/window/src/os/macos/window.rs index 034c438f4..a2106daa8 100644 --- a/window/src/os/macos/window.rs +++ b/window/src/os/macos/window.rs @@ -26,7 +26,8 @@ use cocoa::foundation::{ NSArray, NSAutoreleasePool, NSFastEnumeration, NSInteger, NSNotFound, NSPoint, NSRect, NSSize, NSUInteger, }; -use config::{ConfigHandle, window::WindowLevel}; +use config::window::WindowLevel; +use config::ConfigHandle; use core_foundation::base::{CFTypeID, TCFType}; use core_foundation::bundle::{CFBundleGetBundleWithIdentifier, CFBundleGetFunctionPointerForName}; use core_foundation::data::{CFData, CFDataGetBytePtr, CFDataRef}; @@ -664,7 +665,6 @@ unsafe impl HasRawWindowHandle for Window { } } - pub type NSWindowLevel = i64; pub fn nswindow_level_to_window_level(nswindow_level: NSWindowLevel) -> WindowLevel { @@ -680,7 +680,7 @@ pub fn window_level_to_nswindow_level(level: WindowLevel) -> NSWindowLevel { match level { WindowLevel::AlwaysOnBottom => -1, WindowLevel::Normal => 0, - WindowLevel::AlwaysOnTop => 3 + WindowLevel::AlwaysOnTop => 3, } } @@ -1098,7 +1098,6 @@ impl WindowInner { /// @see https://developer.apple.com/documentation/appkit/nswindow/level - impl WindowInner { fn show(&mut self) { unsafe { @@ -1182,7 +1181,7 @@ impl WindowInner { fn set_window_level(&mut self, level: WindowLevel) { unsafe { NSWindow::setLevel_(*self.window, window_level_to_nswindow_level(level)); - WindowView::did_resize(&mut** self.view, sel!(windowDidResize:), nil); + WindowView::did_resize(&mut **self.view, sel!(windowDidResize:), nil); } } @@ -2789,10 +2788,14 @@ impl WindowView { unsafe { msg_send![*window, isZoomed] } }); - let window_level = inner.window.as_ref().map(|window| { - let level = unsafe { window.load().level() }; - nswindow_level_to_window_level(level) - }).unwrap_or_default(); + let window_level = inner + .window + .as_ref() + .map(|window| { + let level = unsafe { window.load().level() }; + nswindow_level_to_window_level(level) + }) + .unwrap_or_default(); let level_state = match window_level { WindowLevel::AlwaysOnBottom => WindowState::ALWAYS_ON_BOTTOM,