Skip to content

Commit cc0cc96

Browse files
committed
Fix blank screen on window initialization
1 parent 541fa06 commit cc0cc96

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

desktop/src/app.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,12 @@ impl ApplicationHandler for App {
395395

396396
self.window_scale = window.scale_factor();
397397
let _ = self.cef_view_info_sender.send(cef::ViewInfoUpdate::Scale(self.window_scale));
398+
399+
// Ensures the CEF texture does not remain at 1x1 pixels until the window is resized by the user
400+
// Affects only some Mac devices (issue found on 2023 M2 Mac Mini).
401+
let PhysicalSize { width, height } = window.surface_size();
402+
let _ = self.cef_view_info_sender.send(cef::ViewInfoUpdate::Size { width, height });
403+
398404
self.cef_context.notify_view_info_changed();
399405

400406
self.window = Some(window);

desktop/src/render/state.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ impl RenderState {
286286
viewport_offset: self.viewport_offset,
287287
ui_scale: ui_scale.unwrap_or([1., 1.]),
288288
_pad: [0., 0.],
289-
background_color: [33. / 255., 33. / 255., 33. / 255., 1.], // #212121
289+
background_color: [0x22 as f32 / 0xff as f32, 0x22 as f32 / 0xff as f32, 0x22 as f32 / 0xff as f32, 1.], // #222222
290290
}),
291291
);
292292
if let Some(bind_group) = &self.bind_group {

0 commit comments

Comments
 (0)