From eab018d8e17114a7963a8b231963f98194b2bb4c Mon Sep 17 00:00:00 2001 From: Pavel Benak Date: Sun, 4 Jan 2026 19:47:24 +0100 Subject: [PATCH] Fix egui window scaling on Retina displays Convert logical pixels to physical pixels when resizing the window by multiplying by pixels_per_point(). Fixes issue #245 where the egui content would shrink to 1/4 size on macOS Retina displays when dragging the resize handle. --- nih_plug_egui/src/editor.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/nih_plug_egui/src/editor.rs b/nih_plug_egui/src/editor.rs index d5339379..7d359697 100644 --- a/nih_plug_egui/src/editor.rs +++ b/nih_plug_egui/src/editor.rs @@ -112,7 +112,12 @@ where // Ask the plugin host to resize to self.size() if context.request_resize() { // Resize the content of egui window - queue.resize(PhySize::new(new_size.0, new_size.1)); + // Convert logical pixels to physical pixels using the scale factor + let scale = egui_ctx.pixels_per_point(); + queue.resize(PhySize::new( + (new_size.0 as f32 * scale) as u32, + (new_size.1 as f32 * scale) as u32, + )); egui_ctx.send_viewport_cmd(ViewportCommand::InnerSize(Vec2::new( new_size.0 as f32, new_size.1 as f32,