mirror of
https://github.com/wez/wezterm.git
synced 2024-11-23 15:04:36 +03:00
window: implicitly enable_opengl at new_window creation
This commit is contained in:
parent
4c22de9f6d
commit
ec7d511750
@ -749,7 +749,6 @@ impl WindowCallbacks for TermWindow {
|
||||
Self::start_periodic_maintenance(window.clone());
|
||||
Self::setup_clipboard(&window, mux_window_id, clipboard_contents);
|
||||
|
||||
window.enable_opengl();
|
||||
drop(activity); // Keep the activity outstanding until we get here
|
||||
Ok::<(), anyhow::Error>(())
|
||||
})
|
||||
@ -1012,8 +1011,6 @@ impl TermWindow {
|
||||
Self::start_periodic_maintenance(window.clone());
|
||||
Self::setup_clipboard(&window, mux_window_id, clipboard_contents);
|
||||
|
||||
window.enable_opengl();
|
||||
|
||||
crate::update::start_update_checker();
|
||||
Ok(())
|
||||
}
|
||||
|
@ -51,7 +51,6 @@ fn spawn_window() -> anyhow::Result<()> {
|
||||
}),
|
||||
)?;
|
||||
|
||||
win.enable_opengl();
|
||||
win.show();
|
||||
win.apply(|myself, _win| {
|
||||
if let Some(myself) = myself.downcast_ref::<MyWindow>() {
|
||||
|
@ -229,11 +229,6 @@ pub trait WindowOps {
|
||||
Self: Sized,
|
||||
R: Send + 'static;
|
||||
|
||||
/// Attempt to set up opengl based painting.
|
||||
/// Will call opengl_initialize() in your WindowCallbacks impl to
|
||||
/// inform it of the gl context.
|
||||
fn enable_opengl(&self) -> promise::Future<()>;
|
||||
|
||||
/// Initiate textual transfer from the clipboard
|
||||
fn get_clipboard(&self, clipboard: Clipboard) -> Future<String>;
|
||||
|
||||
|
@ -469,6 +469,7 @@ impl Window {
|
||||
|
||||
let window = Window(window_id);
|
||||
|
||||
inner.borrow_mut().enable_opengl()?;
|
||||
inner.borrow_mut().callbacks.created(&window);
|
||||
// Synthesize a resize event immediately; this allows
|
||||
// the embedding application an opportunity to discover
|
||||
@ -568,16 +569,6 @@ impl WindowOps for Window {
|
||||
})
|
||||
}
|
||||
|
||||
fn enable_opengl(&self) -> promise::Future<()> {
|
||||
Connection::with_window_inner(self.0, move |inner| {
|
||||
if let Some(window_view) = WindowView::get_this(unsafe { &**inner.view }) {
|
||||
window_view.inner.borrow_mut().enable_opengl()
|
||||
} else {
|
||||
bail!("apply: window is invalid");
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
fn get_clipboard(&self, _clipboard: Clipboard) -> Future<String> {
|
||||
use clipboard::ClipboardProvider;
|
||||
Future::result(
|
||||
|
@ -251,6 +251,7 @@ impl WaylandWindow {
|
||||
conn.windows.borrow_mut().insert(window_id, inner.clone());
|
||||
|
||||
inner.borrow_mut().callbacks.created(&window_handle);
|
||||
inner.borrow_mut().enable_opengl()?;
|
||||
|
||||
Ok(window_handle)
|
||||
}
|
||||
@ -765,10 +766,6 @@ impl WindowOps for WaylandWindow {
|
||||
})
|
||||
}
|
||||
|
||||
fn enable_opengl(&self) -> promise::Future<()> {
|
||||
WaylandConnection::with_window_inner(self.0, move |inner| inner.enable_opengl())
|
||||
}
|
||||
|
||||
fn get_clipboard(&self, _clipboard: Clipboard) -> Future<String> {
|
||||
let mut promise = Promise::new();
|
||||
let future = promise.get_future().unwrap();
|
||||
|
@ -328,6 +328,7 @@ impl Window {
|
||||
|
||||
let window = Window(hwnd);
|
||||
inner.borrow_mut().callbacks.borrow_mut().created(&window);
|
||||
inner.borrow_mut().enable_opengl()?;
|
||||
|
||||
Ok(window)
|
||||
}
|
||||
@ -508,10 +509,6 @@ impl WindowOps for Window {
|
||||
})
|
||||
}
|
||||
|
||||
fn enable_opengl(&self) -> promise::Future<()> {
|
||||
Connection::with_window_inner(self.0, move |inner| inner.enable_opengl())
|
||||
}
|
||||
|
||||
fn get_clipboard(&self, _clipboard: Clipboard) -> Future<String> {
|
||||
Future::result(
|
||||
clipboard_win::get_clipboard_string()
|
||||
|
@ -867,6 +867,7 @@ impl XWindow {
|
||||
let window_handle = Window::X11(XWindow::from_id(window_id));
|
||||
|
||||
window.lock().unwrap().callbacks.created(&window_handle);
|
||||
window.lock().unwrap().enable_opengl()?;
|
||||
|
||||
conn.windows.borrow_mut().insert(window_id, window);
|
||||
|
||||
@ -1055,10 +1056,6 @@ impl WindowOps for XWindow {
|
||||
})
|
||||
}
|
||||
|
||||
fn enable_opengl(&self) -> promise::Future<()> {
|
||||
XConnection::with_window_inner(self.0, move |inner| inner.enable_opengl())
|
||||
}
|
||||
|
||||
/// Initiate textual transfer from the clipboard
|
||||
fn get_clipboard(&self, clipboard: Clipboard) -> Future<String> {
|
||||
let mut promise = Promise::new();
|
||||
|
@ -213,14 +213,6 @@ impl WindowOps for Window {
|
||||
}
|
||||
}
|
||||
|
||||
fn enable_opengl(&self) -> promise::Future<()> {
|
||||
match self {
|
||||
Self::X11(x) => x.enable_opengl(),
|
||||
#[cfg(feature = "wayland")]
|
||||
Self::Wayland(w) => w.enable_opengl(),
|
||||
}
|
||||
}
|
||||
|
||||
fn get_clipboard(&self, clipboard: Clipboard) -> Future<String> {
|
||||
match self {
|
||||
Self::X11(x) => x.get_clipboard(clipboard),
|
||||
|
Loading…
Reference in New Issue
Block a user