mirror of
https://github.com/wez/wezterm.git
synced 2024-11-27 12:23:46 +03:00
parent
0df755b8f0
commit
b2b0b8b011
@ -881,8 +881,8 @@ impl WaylandWindowInner {
|
|||||||
|
|
||||||
let factor = get_surface_scale_factor(&self.surface);
|
let factor = get_surface_scale_factor(&self.surface);
|
||||||
Dimensions {
|
Dimensions {
|
||||||
pixel_width,
|
pixel_width: pixel_width as _,
|
||||||
pixel_height,
|
pixel_height: pixel_height as _,
|
||||||
dpi: factor as usize * crate::DEFAULT_DPI as usize,
|
dpi: factor as usize * crate::DEFAULT_DPI as usize,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -61,7 +61,7 @@ pub(crate) struct XWindowInner {
|
|||||||
copy_and_paste: CopyAndPaste,
|
copy_and_paste: CopyAndPaste,
|
||||||
config: ConfigHandle,
|
config: ConfigHandle,
|
||||||
gl_state: Option<Rc<glium::backend::Context>>,
|
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 {
|
fn enclosing_boundary_with(a: &Rect, b: &Rect) -> Rect {
|
||||||
@ -816,9 +816,6 @@ impl XWindowInner {
|
|||||||
fn show(&mut self) {
|
fn show(&mut self) {
|
||||||
xcb::map_window(self.conn().conn(), self.window_id);
|
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) {
|
fn invalidate(&mut self) {
|
||||||
self.paint_all = true;
|
self.paint_all = true;
|
||||||
}
|
}
|
||||||
@ -839,23 +836,6 @@ impl XWindowInner {
|
|||||||
let _ = self.adjust_decorations(config.window_decorations);
|
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) {
|
fn set_window_position(&self, coords: ScreenPoint) {
|
||||||
// We ask the window manager to move the window for us so that
|
// 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.
|
// 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> {
|
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<()> {
|
fn set_window_position(&self, coords: ScreenPoint) -> Future<()> {
|
||||||
|
@ -7,7 +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::{Clipboard, MouseCursor, ScreenPoint, WindowCallbacks, WindowOps};
|
use crate::{Clipboard, Dimensions, MouseCursor, ScreenPoint, WindowCallbacks, WindowOps};
|
||||||
use config::ConfigHandle;
|
use config::ConfigHandle;
|
||||||
use promise::*;
|
use promise::*;
|
||||||
use std::any::Any;
|
use std::any::Any;
|
||||||
|
Loading…
Reference in New Issue
Block a user