mirror of
https://github.com/wez/wezterm.git
synced 2024-12-25 06:12:16 +03:00
macos: cleanup
This commit is contained in:
parent
86e42e1c58
commit
a1f0dca655
@ -2024,7 +2024,6 @@ fn compute_default_actions() -> Vec<KeyAssignment> {
|
|||||||
ScrollToBottom,
|
ScrollToBottom,
|
||||||
// ----------------- Window
|
// ----------------- Window
|
||||||
ToggleFullScreen,
|
ToggleFullScreen,
|
||||||
#[cfg(target_os = "macos")]
|
|
||||||
ToggleFloatingWindow,
|
ToggleFloatingWindow,
|
||||||
Hide,
|
Hide,
|
||||||
Search(Pattern::CurrentSelectionOrEmptyString),
|
Search(Pattern::CurrentSelectionOrEmptyString),
|
||||||
|
@ -2514,8 +2514,8 @@ impl TermWindow {
|
|||||||
match window.level().await {
|
match window.level().await {
|
||||||
Ok(level) => {
|
Ok(level) => {
|
||||||
match level {
|
match level {
|
||||||
WindowLevel::Floating => window.set_level(WindowLevel::Normal),
|
WindowLevel::AlwaysOnTop => window.set_level(WindowLevel::Normal),
|
||||||
_ => window.set_level(WindowLevel::Floating),
|
_ => window.set_level(WindowLevel::AlwaysOnTop),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
|
@ -295,8 +295,10 @@ pub trait WindowOps {
|
|||||||
fn set_clipboard(&self, clipboard: Clipboard, text: String);
|
fn set_clipboard(&self, clipboard: Clipboard, text: String);
|
||||||
|
|
||||||
/// Set window level. Depending on the environment and user preferences
|
/// Set window level. Depending on the environment and user preferences
|
||||||
fn set_window_level(&self, level: WindowLevel) {
|
fn set_window_level(&self, _level: WindowLevel) {}
|
||||||
// default implementation does nothing
|
|
||||||
|
fn get_window_level(&self) -> Future<WindowLevel> {
|
||||||
|
WindowLevel::Normal
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Set the icon for the window.
|
/// Set the icon for the window.
|
||||||
|
@ -747,11 +747,17 @@ impl WindowOps for Window {
|
|||||||
|
|
||||||
fn set_window_level(&self, level: WindowLevel) {
|
fn set_window_level(&self, level: WindowLevel) {
|
||||||
Connection::with_window_inner(self.id, move |inner| {
|
Connection::with_window_inner(self.id, move |inner| {
|
||||||
inner.set_level(level as i64);
|
inner.set_window_level(level);
|
||||||
Ok(())
|
Ok(())
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn level(&self) -> Future<WindowLevel> {
|
||||||
|
Connection::with_window_inner(self.id, move |inner| {
|
||||||
|
Ok(inner.level())
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
fn set_inner_size(&self, width: usize, height: usize) {
|
fn set_inner_size(&self, width: usize, height: usize) {
|
||||||
Connection::with_window_inner(self.id, move |inner| {
|
Connection::with_window_inner(self.id, move |inner| {
|
||||||
@ -1167,7 +1173,13 @@ impl WindowInner {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn set_level(&mut self, level: WindowLevel) {
|
fn level(&self) -> WindowLevel {
|
||||||
|
unsafe {
|
||||||
|
NSWindow::level(*self.window).into()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn set_window_level(&mut self, level: WindowLevel) {
|
||||||
unsafe {
|
unsafe {
|
||||||
NSWindow::setLevel_(*self.window, match level {
|
NSWindow::setLevel_(*self.window, match level {
|
||||||
WindowLevel::AlwaysOnBottom => -1,
|
WindowLevel::AlwaysOnBottom => -1,
|
||||||
|
Loading…
Reference in New Issue
Block a user