Skip to content

Commit 50187a0

Browse files
okayish solution
should be improved at some point but for now it works well enough.
1 parent 39b5229 commit 50187a0

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

desktop/src/app.rs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,8 +341,10 @@ impl App {
341341
NodeGraphExecutionResult::NotRun => {}
342342
},
343343
AppEvent::UiUpdate(texture) => {
344+
let width = texture.width();
345+
let height = texture.height();
344346
if let Some(graphics_state) = self.graphics_state.as_mut() {
345-
graphics_state.resize(texture.width(), texture.height());
347+
graphics_state.resize(width, height);
346348
graphics_state.bind_ui_texture(texture);
347349
let elapsed = self.last_ui_update.elapsed().as_secs_f32();
348350
self.last_ui_update = Instant::now();
@@ -351,6 +353,20 @@ impl App {
351353
}
352354
}
353355
if let Some(window) = &self.window {
356+
// Workaround for missing resize events on mac
357+
// TODO: Find a cleaner solution
358+
#[cfg(target_os = "macos")]
359+
{
360+
let surface_size = window.surface_size();
361+
if width != surface_size.width || height != surface_size.height {
362+
let _ = self.cef_view_info_sender.send(cef::ViewInfoUpdate::Size {
363+
width: surface_size.width as usize,
364+
height: surface_size.height as usize,
365+
});
366+
self.cef_context.notify_view_info_changed();
367+
}
368+
}
369+
354370
window.request_redraw();
355371
}
356372
}

0 commit comments

Comments
 (0)