1
1
mirror of https://github.com/wez/wezterm.git synced 2024-12-23 21:32:13 +03:00

window: remove WindowOpsMut trait

It doesn't serve any purpose and makes it awkward to make
a change in a later commit.

refs: https://github.com/wez/wezterm/issues/695
This commit is contained in:
Wez Furlong 2021-05-03 20:26:33 -07:00
parent 494fa999bb
commit 772991a1f0
5 changed files with 9 additions and 52 deletions

View File

@ -189,46 +189,3 @@ pub trait WindowOps {
Future::ok(())
}
}
pub trait WindowOpsMut {
/// Show a hidden window
fn show(&mut self);
/// Hide a visible window
fn hide(&mut self);
/// Schedule the window to be closed
fn close(&mut self);
/// Change the cursor
fn set_cursor(&mut self, cursor: Option<MouseCursor>);
/// Invalidate the window so that the entire client area will
/// be repainted shortly
fn invalidate(&mut self);
/// Change the titlebar text for the window
fn set_title(&mut self, title: &str);
/// Resize the inner or client area of the window
fn set_inner_size(&mut self, width: usize, height: usize);
/// inform the windowing system of the current textual
/// cursor input location. This is used primarily for
/// the platform specific input method editor
fn set_text_cursor_position(&mut self, _cursor: Rect) {}
/// Changes the location of the window on the screen.
/// The coordinates are of the top left pixel of the
/// client area.
fn set_window_position(&self, _coords: ScreenPoint) {}
/// Set the icon for the window.
/// Depending on the system this may be shown in its titlebar
/// and/or in the task manager/task switcher
fn set_icon(&mut self, _image: &dyn BitmapImage) {}
fn toggle_fullscreen(&mut self) {}
fn config_did_change(&mut self, _config: &config::ConfigHandle) {}
}

View File

@ -6,7 +6,7 @@ use crate::connection::ConnectionOps;
use crate::{
Clipboard, Connection, Dimensions, KeyCode, KeyEvent, Modifiers, MouseButtons, MouseCursor,
MouseEvent, MouseEventKind, MousePress, Point, Rect, ScreenPoint, Size, WindowCallbacks,
WindowDecorations, WindowOps, WindowOpsMut,
WindowDecorations, WindowOps,
};
use anyhow::{anyhow, bail, ensure};
use cocoa::appkit::{
@ -762,7 +762,7 @@ impl WindowInner {
}
}
impl WindowOpsMut for WindowInner {
impl WindowInner {
fn show(&mut self) {
unsafe {
let current_app = NSRunningApplication::currentApplication(nil);

View File

@ -6,7 +6,7 @@ use crate::os::wayland::connection::WaylandConnection;
use crate::os::xkeysyms::keysym_to_keycode;
use crate::{
Clipboard, Connection, Dimensions, MouseCursor, Point, ScreenPoint, Window, WindowCallbacks,
WindowOps, WindowOpsMut,
WindowOps,
};
use anyhow::{anyhow, bail, Context};
use config::ConfigHandle;
@ -796,7 +796,7 @@ fn read_pipe_with_timeout(mut file: FileDescriptor) -> anyhow::Result<String> {
Ok(String::from_utf8(result)?)
}
impl WindowOpsMut for WaylandWindowInner {
impl WaylandWindowInner {
fn close(&mut self) {
self.callbacks.destroy();
self.window.take();

View File

@ -3,7 +3,7 @@ use crate::connection::ConnectionOps;
use crate::{
Clipboard, Dimensions, KeyCode, KeyEvent, Modifiers, MouseButtons, MouseCursor, MouseEvent,
MouseEventKind, MousePress, Point, Rect, ScreenPoint, WindowCallbacks, WindowDecorations,
WindowOps, WindowOpsMut,
WindowOps,
};
use anyhow::{bail, Context};
use config::ConfigHandle;
@ -432,7 +432,7 @@ fn schedule_show_window(hwnd: HWindow, show: bool) {
.detach();
}
impl WindowOpsMut for WindowInner {
impl WindowInner {
fn close(&mut self) {
let hwnd = self.hwnd;
promise::spawn::spawn(async move {
@ -456,7 +456,7 @@ impl WindowOpsMut for WindowInner {
}
fn invalidate(&mut self) {
log::trace!("WindowOpsMut::invalidate");
log::trace!("WindowInner::invalidate");
unsafe {
InvalidateRect(self.hwnd.0, null(), 0);
}

View File

@ -5,7 +5,7 @@ use crate::os::xkeysyms;
use crate::os::{Connection, Window};
use crate::{
Clipboard, Dimensions, MouseButtons, MouseCursor, MouseEvent, MouseEventKind, MousePress,
Point, Rect, ScreenPoint, Size, WindowCallbacks, WindowDecorations, WindowOps, WindowOpsMut,
Point, Rect, ScreenPoint, Size, WindowCallbacks, WindowDecorations, WindowOps,
};
use anyhow::{anyhow, Context as _};
use config::ConfigHandle;
@ -803,7 +803,7 @@ impl XWindow {
}
}
impl WindowOpsMut for XWindowInner {
impl XWindowInner {
fn close(&mut self) {
xcb::destroy_window(self.conn().conn(), self.window_id);
}