1
1
mirror of https://github.com/wez/wezterm.git synced 2024-11-23 15:04:36 +03:00

fixup build on linux

refs: https://github.com/wez/wezterm/issues/695
This commit is contained in:
Wez Furlong 2021-05-03 21:09:08 -07:00
parent 0df755b8f0
commit b2b0b8b011
3 changed files with 25 additions and 25 deletions

View File

@ -881,8 +881,8 @@ impl WaylandWindowInner {
let factor = get_surface_scale_factor(&self.surface);
Dimensions {
pixel_width,
pixel_height,
pixel_width: pixel_width as _,
pixel_height: pixel_height as _,
dpi: factor as usize * crate::DEFAULT_DPI as usize,
}
}

View File

@ -61,7 +61,7 @@ pub(crate) struct XWindowInner {
copy_and_paste: CopyAndPaste,
config: ConfigHandle,
gl_state: Option<Rc<glium::backend::Context>>,
resize_promises: Vec<Promise<Dimension>>,
resize_promises: Vec<Promise<Dimensions>>,
}
fn enclosing_boundary_with(a: &Rect, b: &Rect) -> Rect {
@ -816,9 +816,6 @@ impl XWindowInner {
fn show(&mut self) {
xcb::map_window(self.conn().conn(), self.window_id);
}
fn set_cursor(&mut self, cursor: Option<MouseCursor>) {
XWindowInner::set_cursor(self, cursor).unwrap();
}
fn invalidate(&mut self) {
self.paint_all = true;
}
@ -839,23 +836,6 @@ impl XWindowInner {
let _ = self.adjust_decorations(config.window_decorations);
}
fn set_inner_size(&mut self, width: usize, height: usize) -> Future<Dimensions> {
let _ = xcb::configure_window_checked(
self.conn().conn(),
self.window_id,
&[
(xcb::CONFIG_WINDOW_WIDTH as u16, width as u32),
(xcb::CONFIG_WINDOW_HEIGHT as u16, height as u32),
],
)
.request_check();
let promise = Promise::new();
let future = promise.get_future();
self.resize_promises.push(promise);
promise
}
fn set_window_position(&self, coords: ScreenPoint) {
// We ask the window manager to move the window for us so that
// we don't have to deal with adjusting for the frame size.
@ -980,7 +960,27 @@ impl WindowOps for XWindow {
}
fn set_inner_size(&self, width: usize, height: usize) -> Future<Dimensions> {
XConnection::with_window_inner(self.0, move |inner| Ok(inner.set_inner_size(width, height)))
let mut promise = Promise::new();
let future = promise.get_future().unwrap();
let mut promise = Some(promise);
XConnection::with_window_inner(self.0, move |inner| {
if let Some(promise) = promise.take() {
inner.resize_promises.push(promise);
}
xcb::configure_window(
inner.conn().conn(),
inner.window_id,
&[
(xcb::CONFIG_WINDOW_WIDTH as u16, width as u32),
(xcb::CONFIG_WINDOW_HEIGHT as u16, height as u32),
],
);
Ok(())
});
future
}
fn set_window_position(&self, coords: ScreenPoint) -> Future<()> {

View File

@ -7,7 +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::{Clipboard, MouseCursor, ScreenPoint, WindowCallbacks, WindowOps};
use crate::{Clipboard, Dimensions, MouseCursor, ScreenPoint, WindowCallbacks, WindowOps};
use config::ConfigHandle;
use promise::*;
use std::any::Any;