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::connection::ConnectionOps;
|
||||||
use crate::os::wayland::connection::WaylandConnection;
|
use crate::os::wayland::connection::WaylandConnection;
|
||||||
use crate::os::xkeysyms::keysym_to_keycode;
|
use crate::os::xkeysyms::keysym_to_keycode;
|
||||||
|
use crate::WindowConfigHandle;
|
||||||
use crate::{
|
use crate::{
|
||||||
Clipboard, Connection, Dimensions, MouseCursor, Point, ScreenPoint, Window, WindowCallbacks,
|
Clipboard, Connection, Dimensions, MouseCursor, Point, ScreenPoint, Window, WindowCallbacks,
|
||||||
WindowOps, WindowOpsMut,
|
WindowOps, WindowOpsMut,
|
||||||
@ -166,6 +167,7 @@ impl WaylandWindow {
|
|||||||
width: usize,
|
width: usize,
|
||||||
height: usize,
|
height: usize,
|
||||||
callbacks: Box<dyn WindowCallbacks>,
|
callbacks: Box<dyn WindowCallbacks>,
|
||||||
|
_config: Option<&WindowConfigHandle>,
|
||||||
) -> anyhow::Result<Window> {
|
) -> anyhow::Result<Window> {
|
||||||
let conn = WaylandConnection::get()
|
let conn = WaylandConnection::get()
|
||||||
.ok_or_else(|| {
|
.ok_or_else(|| {
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
use super::*;
|
use super::*;
|
||||||
use crate::connection::ConnectionOps;
|
use crate::connection::ConnectionOps;
|
||||||
|
use crate::WindowConfigHandle;
|
||||||
use crate::{
|
use crate::{
|
||||||
config, Clipboard, Dimensions, KeyCode, KeyEvent, Modifiers, MouseButtons, MouseCursor,
|
config, Clipboard, Dimensions, KeyCode, KeyEvent, Modifiers, MouseButtons, MouseCursor,
|
||||||
MouseEvent, MouseEventKind, MousePress, Point, Rect, ScreenPoint, WindowCallbacks,
|
MouseEvent, MouseEventKind, MousePress, Point, Rect, ScreenPoint, WindowCallbacks,
|
||||||
@ -367,7 +368,12 @@ impl Window {
|
|||||||
width: usize,
|
width: usize,
|
||||||
height: usize,
|
height: usize,
|
||||||
callbacks: Box<dyn WindowCallbacks>,
|
callbacks: Box<dyn WindowCallbacks>,
|
||||||
|
config: Option<&WindowConfigHandle>,
|
||||||
) -> anyhow::Result<Window> {
|
) -> anyhow::Result<Window> {
|
||||||
|
let config = match config {
|
||||||
|
Some(c) => Arc::clone(c),
|
||||||
|
None => crate::config(),
|
||||||
|
};
|
||||||
let inner = Rc::new(RefCell::new(WindowInner {
|
let inner = Rc::new(RefCell::new(WindowInner {
|
||||||
hwnd: HWindow(null_mut()),
|
hwnd: HWindow(null_mut()),
|
||||||
callbacks: RefCell::new(callbacks),
|
callbacks: RefCell::new(callbacks),
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
use super::*;
|
use super::*;
|
||||||
use crate::bitmaps::*;
|
use crate::bitmaps::*;
|
||||||
use crate::configuration::config;
|
|
||||||
use crate::connection::ConnectionOps;
|
use crate::connection::ConnectionOps;
|
||||||
use crate::os::xkeysyms;
|
use crate::os::xkeysyms;
|
||||||
use crate::os::{Connection, Window};
|
use crate::os::{Connection, Window};
|
||||||
|
use crate::WindowConfigHandle;
|
||||||
use crate::{
|
use crate::{
|
||||||
Clipboard, Dimensions, MouseButtons, MouseCursor, MouseEvent, MouseEventKind, MousePress,
|
Clipboard, Dimensions, MouseButtons, MouseCursor, MouseEvent, MouseEventKind, MousePress,
|
||||||
Point, Rect, ScreenPoint, Size, WindowCallbacks, WindowDecorations, WindowOps, WindowOpsMut,
|
Point, Rect, ScreenPoint, Size, WindowCallbacks, WindowDecorations, WindowOps, WindowOpsMut,
|
||||||
@ -73,6 +73,7 @@ pub(crate) struct XWindowInner {
|
|||||||
cursor: Option<MouseCursor>,
|
cursor: Option<MouseCursor>,
|
||||||
cursors: HashMap<Option<MouseCursor>, XcbCursor>,
|
cursors: HashMap<Option<MouseCursor>, XcbCursor>,
|
||||||
copy_and_paste: CopyAndPaste,
|
copy_and_paste: CopyAndPaste,
|
||||||
|
config: WindowConfigHandle,
|
||||||
gl_state: Option<Rc<glium::backend::Context>>,
|
gl_state: Option<Rc<glium::backend::Context>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -611,7 +612,7 @@ impl XWindowInner {
|
|||||||
xcb::ClientMessageData::from_data32(data),
|
xcb::ClientMessageData::from_data32(data),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
self.adjust_decorations(config().decorations())?;
|
self.adjust_decorations(self.config.decorations())?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
@ -700,7 +701,12 @@ impl XWindow {
|
|||||||
width: usize,
|
width: usize,
|
||||||
height: usize,
|
height: usize,
|
||||||
callbacks: Box<dyn WindowCallbacks>,
|
callbacks: Box<dyn WindowCallbacks>,
|
||||||
|
config: Option<&WindowConfigHandle>,
|
||||||
) -> anyhow::Result<Window> {
|
) -> anyhow::Result<Window> {
|
||||||
|
let config = match config {
|
||||||
|
Some(c) => Arc::clone(c),
|
||||||
|
None => crate::config(),
|
||||||
|
};
|
||||||
let conn = Connection::get()
|
let conn = Connection::get()
|
||||||
.ok_or_else(|| {
|
.ok_or_else(|| {
|
||||||
anyhow!(
|
anyhow!(
|
||||||
@ -781,6 +787,7 @@ impl XWindow {
|
|||||||
cursor: None,
|
cursor: None,
|
||||||
cursors: HashMap::new(),
|
cursors: HashMap::new(),
|
||||||
gl_state: None,
|
gl_state: None,
|
||||||
|
config: Arc::clone(&config),
|
||||||
}))
|
}))
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -802,7 +809,7 @@ impl XWindow {
|
|||||||
window
|
window
|
||||||
.lock()
|
.lock()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.adjust_decorations(config().decorations())?;
|
.adjust_decorations(config.decorations())?;
|
||||||
|
|
||||||
let window_handle = Window::X11(XWindow::from_id(window_id));
|
let window_handle = Window::X11(XWindow::from_id(window_id));
|
||||||
|
|
||||||
@ -849,8 +856,9 @@ impl WindowOpsMut for XWindowInner {
|
|||||||
self.set_fullscreen_hint(!fullscreen).ok();
|
self.set_fullscreen_hint(!fullscreen).ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
fn config_did_change(&mut self, _config: &WindowConfigHandle) {
|
fn config_did_change(&mut self, config: &WindowConfigHandle) {
|
||||||
let _ = self.adjust_decorations(config().decorations());
|
self.config = Arc::clone(config);
|
||||||
|
let _ = self.adjust_decorations(config.decorations());
|
||||||
}
|
}
|
||||||
|
|
||||||
fn set_inner_size(&mut self, width: usize, height: usize) {
|
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<()> {
|
fn config_did_change(&self, config: &WindowConfigHandle) -> Future<()> {
|
||||||
let config = Arc::clone(config);
|
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);
|
inner.config_did_change(&config);
|
||||||
Ok(())
|
Ok(())
|
||||||
})
|
})
|
||||||
|
@ -7,6 +7,7 @@ use crate::os::wayland::connection::WaylandConnection;
|
|||||||
use crate::os::wayland::window::WaylandWindow;
|
use crate::os::wayland::window::WaylandWindow;
|
||||||
use crate::os::x11::connection::XConnection;
|
use crate::os::x11::connection::XConnection;
|
||||||
use crate::os::x11::window::XWindow;
|
use crate::os::x11::window::XWindow;
|
||||||
|
use crate::WindowConfigHandle;
|
||||||
use crate::{config, Clipboard, MouseCursor, ScreenPoint, WindowCallbacks, WindowOps};
|
use crate::{config, Clipboard, MouseCursor, ScreenPoint, WindowCallbacks, WindowOps};
|
||||||
use promise::*;
|
use promise::*;
|
||||||
use std::any::Any;
|
use std::any::Any;
|
||||||
@ -51,12 +52,13 @@ impl Connection {
|
|||||||
width: usize,
|
width: usize,
|
||||||
height: usize,
|
height: usize,
|
||||||
callbacks: Box<dyn WindowCallbacks>,
|
callbacks: Box<dyn WindowCallbacks>,
|
||||||
|
config: Option<&WindowConfigHandle>,
|
||||||
) -> anyhow::Result<Window> {
|
) -> anyhow::Result<Window> {
|
||||||
match self {
|
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")]
|
#[cfg(feature = "wayland")]
|
||||||
Self::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,
|
width: usize,
|
||||||
height: usize,
|
height: usize,
|
||||||
callbacks: Box<dyn WindowCallbacks>,
|
callbacks: Box<dyn WindowCallbacks>,
|
||||||
|
config: Option<&WindowConfigHandle>,
|
||||||
) -> anyhow::Result<Window> {
|
) -> anyhow::Result<Window> {
|
||||||
Connection::get()
|
Connection::get()
|
||||||
.unwrap()
|
.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