mirror of
https://github.com/wez/wezterm.git
synced 2024-12-24 13:52:55 +03:00
fixup build on x11/wayland
This commit is contained in:
parent
cfed798e79
commit
a736492497
@ -4,6 +4,7 @@ use super::pointer::*;
|
||||
use crate::connection::ConnectionOps;
|
||||
use crate::os::wayland::connection::WaylandConnection;
|
||||
use crate::os::xkeysyms::keysym_to_keycode;
|
||||
use crate::WindowConfigHandle;
|
||||
use crate::{
|
||||
Clipboard, Connection, Dimensions, MouseCursor, Point, ScreenPoint, Window, WindowCallbacks,
|
||||
WindowOps, WindowOpsMut,
|
||||
@ -166,6 +167,7 @@ impl WaylandWindow {
|
||||
width: usize,
|
||||
height: usize,
|
||||
callbacks: Box<dyn WindowCallbacks>,
|
||||
_config: Option<&WindowConfigHandle>,
|
||||
) -> anyhow::Result<Window> {
|
||||
let conn = WaylandConnection::get()
|
||||
.ok_or_else(|| {
|
||||
|
@ -1,5 +1,6 @@
|
||||
use super::*;
|
||||
use crate::connection::ConnectionOps;
|
||||
use crate::WindowConfigHandle;
|
||||
use crate::{
|
||||
config, Clipboard, Dimensions, KeyCode, KeyEvent, Modifiers, MouseButtons, MouseCursor,
|
||||
MouseEvent, MouseEventKind, MousePress, Point, Rect, ScreenPoint, WindowCallbacks,
|
||||
@ -367,7 +368,12 @@ impl Window {
|
||||
width: usize,
|
||||
height: usize,
|
||||
callbacks: Box<dyn WindowCallbacks>,
|
||||
config: Option<&WindowConfigHandle>,
|
||||
) -> anyhow::Result<Window> {
|
||||
let config = match config {
|
||||
Some(c) => Arc::clone(c),
|
||||
None => crate::config(),
|
||||
};
|
||||
let inner = Rc::new(RefCell::new(WindowInner {
|
||||
hwnd: HWindow(null_mut()),
|
||||
callbacks: RefCell::new(callbacks),
|
||||
|
@ -1,9 +1,9 @@
|
||||
use super::*;
|
||||
use crate::bitmaps::*;
|
||||
use crate::configuration::config;
|
||||
use crate::connection::ConnectionOps;
|
||||
use crate::os::xkeysyms;
|
||||
use crate::os::{Connection, Window};
|
||||
use crate::WindowConfigHandle;
|
||||
use crate::{
|
||||
Clipboard, Dimensions, MouseButtons, MouseCursor, MouseEvent, MouseEventKind, MousePress,
|
||||
Point, Rect, ScreenPoint, Size, WindowCallbacks, WindowDecorations, WindowOps, WindowOpsMut,
|
||||
@ -73,6 +73,7 @@ pub(crate) struct XWindowInner {
|
||||
cursor: Option<MouseCursor>,
|
||||
cursors: HashMap<Option<MouseCursor>, XcbCursor>,
|
||||
copy_and_paste: CopyAndPaste,
|
||||
config: WindowConfigHandle,
|
||||
gl_state: Option<Rc<glium::backend::Context>>,
|
||||
}
|
||||
|
||||
@ -611,7 +612,7 @@ impl XWindowInner {
|
||||
xcb::ClientMessageData::from_data32(data),
|
||||
),
|
||||
);
|
||||
self.adjust_decorations(config().decorations())?;
|
||||
self.adjust_decorations(self.config.decorations())?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
@ -700,7 +701,12 @@ impl XWindow {
|
||||
width: usize,
|
||||
height: usize,
|
||||
callbacks: Box<dyn WindowCallbacks>,
|
||||
config: Option<&WindowConfigHandle>,
|
||||
) -> anyhow::Result<Window> {
|
||||
let config = match config {
|
||||
Some(c) => Arc::clone(c),
|
||||
None => crate::config(),
|
||||
};
|
||||
let conn = Connection::get()
|
||||
.ok_or_else(|| {
|
||||
anyhow!(
|
||||
@ -781,6 +787,7 @@ impl XWindow {
|
||||
cursor: None,
|
||||
cursors: HashMap::new(),
|
||||
gl_state: None,
|
||||
config: Arc::clone(&config),
|
||||
}))
|
||||
};
|
||||
|
||||
@ -802,7 +809,7 @@ impl XWindow {
|
||||
window
|
||||
.lock()
|
||||
.unwrap()
|
||||
.adjust_decorations(config().decorations())?;
|
||||
.adjust_decorations(config.decorations())?;
|
||||
|
||||
let window_handle = Window::X11(XWindow::from_id(window_id));
|
||||
|
||||
@ -849,8 +856,9 @@ impl WindowOpsMut for XWindowInner {
|
||||
self.set_fullscreen_hint(!fullscreen).ok();
|
||||
}
|
||||
|
||||
fn config_did_change(&mut self, _config: &WindowConfigHandle) {
|
||||
let _ = self.adjust_decorations(config().decorations());
|
||||
fn config_did_change(&mut self, config: &WindowConfigHandle) {
|
||||
self.config = Arc::clone(config);
|
||||
let _ = self.adjust_decorations(config.decorations());
|
||||
}
|
||||
|
||||
fn set_inner_size(&mut self, width: usize, height: usize) {
|
||||
@ -937,7 +945,7 @@ impl WindowOps for XWindow {
|
||||
|
||||
fn config_did_change(&self, config: &WindowConfigHandle) -> Future<()> {
|
||||
let config = Arc::clone(config);
|
||||
XConnection::with_window_inner(self.0, |inner| {
|
||||
XConnection::with_window_inner(self.0, move |inner| {
|
||||
inner.config_did_change(&config);
|
||||
Ok(())
|
||||
})
|
||||
|
@ -7,6 +7,7 @@ use crate::os::wayland::connection::WaylandConnection;
|
||||
use crate::os::wayland::window::WaylandWindow;
|
||||
use crate::os::x11::connection::XConnection;
|
||||
use crate::os::x11::window::XWindow;
|
||||
use crate::WindowConfigHandle;
|
||||
use crate::{config, Clipboard, MouseCursor, ScreenPoint, WindowCallbacks, WindowOps};
|
||||
use promise::*;
|
||||
use std::any::Any;
|
||||
@ -51,12 +52,13 @@ impl Connection {
|
||||
width: usize,
|
||||
height: usize,
|
||||
callbacks: Box<dyn WindowCallbacks>,
|
||||
config: Option<&WindowConfigHandle>,
|
||||
) -> anyhow::Result<Window> {
|
||||
match self {
|
||||
Self::X11(_) => XWindow::new_window(class_name, name, width, height, callbacks),
|
||||
Self::X11(_) => XWindow::new_window(class_name, name, width, height, callbacks, config),
|
||||
#[cfg(feature = "wayland")]
|
||||
Self::Wayland(_) => {
|
||||
WaylandWindow::new_window(class_name, name, width, height, callbacks)
|
||||
WaylandWindow::new_window(class_name, name, width, height, callbacks, config)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -110,10 +112,11 @@ impl Window {
|
||||
width: usize,
|
||||
height: usize,
|
||||
callbacks: Box<dyn WindowCallbacks>,
|
||||
config: Option<&WindowConfigHandle>,
|
||||
) -> anyhow::Result<Window> {
|
||||
Connection::get()
|
||||
.unwrap()
|
||||
.new_window(class_name, name, width, height, callbacks)
|
||||
.new_window(class_name, name, width, height, callbacks, config)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user