mirror of
https://github.com/wez/wezterm.git
synced 2024-12-24 05:42:03 +03:00
parent
ba5d50ba9e
commit
fae9b35368
@ -379,6 +379,7 @@ impl Window {
|
|||||||
let inner = Rc::new(RefCell::new(Inner {
|
let inner = Rc::new(RefCell::new(Inner {
|
||||||
callbacks,
|
callbacks,
|
||||||
view_id: None,
|
view_id: None,
|
||||||
|
window: None,
|
||||||
window_id,
|
window_id,
|
||||||
screen_changed: false,
|
screen_changed: false,
|
||||||
gl_context_pair: None,
|
gl_context_pair: None,
|
||||||
@ -447,12 +448,14 @@ impl Window {
|
|||||||
let width = backing_frame.size.width;
|
let width = backing_frame.size.width;
|
||||||
let height = backing_frame.size.height;
|
let height = backing_frame.size.height;
|
||||||
|
|
||||||
|
let weak_window = window.weak();
|
||||||
let window_inner = Rc::new(RefCell::new(WindowInner {
|
let window_inner = Rc::new(RefCell::new(WindowInner {
|
||||||
window_id,
|
window_id,
|
||||||
window,
|
window,
|
||||||
view,
|
view,
|
||||||
config: Arc::clone(&config),
|
config: Arc::clone(&config),
|
||||||
}));
|
}));
|
||||||
|
inner.borrow_mut().window.replace(weak_window);
|
||||||
conn.windows
|
conn.windows
|
||||||
.borrow_mut()
|
.borrow_mut()
|
||||||
.insert(window_id, Rc::clone(&window_inner));
|
.insert(window_id, Rc::clone(&window_inner));
|
||||||
@ -902,6 +905,7 @@ fn decoration_to_mask(decorations: WindowDecorations) -> NSWindowStyleMask {
|
|||||||
struct Inner {
|
struct Inner {
|
||||||
callbacks: Box<dyn WindowCallbacks>,
|
callbacks: Box<dyn WindowCallbacks>,
|
||||||
view_id: Option<WeakPtr>,
|
view_id: Option<WeakPtr>,
|
||||||
|
window: Option<WeakPtr>,
|
||||||
window_id: usize,
|
window_id: usize,
|
||||||
screen_changed: bool,
|
screen_changed: bool,
|
||||||
gl_context_pair: Option<GlContextPair>,
|
gl_context_pair: Option<GlContextPair>,
|
||||||
@ -1751,14 +1755,29 @@ impl WindowView {
|
|||||||
let width = backing_frame.size.width;
|
let width = backing_frame.size.width;
|
||||||
let height = backing_frame.size.height;
|
let height = backing_frame.size.height;
|
||||||
if let Some(this) = Self::get_this(this) {
|
if let Some(this) = Self::get_this(this) {
|
||||||
this.inner.borrow_mut().callbacks.resize(
|
let mut inner = this.inner.borrow_mut();
|
||||||
|
|
||||||
|
// This is a little gross; ideally we'd call
|
||||||
|
// WindowInner:is_fullscreen to determine this, but
|
||||||
|
// we can't get a mutable reference to it from here
|
||||||
|
// as we can be called in a context where something
|
||||||
|
// higher up the callstack already has a mutable
|
||||||
|
// reference and we'd panic.
|
||||||
|
let is_fullscreen = inner.fullscreen.is_some()
|
||||||
|
|| inner.window.as_ref().map_or(false, |window| {
|
||||||
|
let window = window.load();
|
||||||
|
let style_mask = unsafe { NSWindow::styleMask(*window) };
|
||||||
|
style_mask.contains(NSWindowStyleMask::NSFullScreenWindowMask)
|
||||||
|
});
|
||||||
|
|
||||||
|
inner.callbacks.resize(
|
||||||
Dimensions {
|
Dimensions {
|
||||||
pixel_width: width as usize,
|
pixel_width: width as usize,
|
||||||
pixel_height: height as usize,
|
pixel_height: height as usize,
|
||||||
dpi: (crate::DEFAULT_DPI * (backing_frame.size.width / frame.size.width))
|
dpi: (crate::DEFAULT_DPI * (backing_frame.size.width / frame.size.width))
|
||||||
as usize,
|
as usize,
|
||||||
},
|
},
|
||||||
this.inner.is_fullscreen,
|
is_fullscreen,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user