From ed47f1017d52eadb11f1e435b3433e9374a32296 Mon Sep 17 00:00:00 2001 From: Om Chillure Date: Tue, 17 Feb 2026 06:51:02 +0530 Subject: [PATCH] gpui: Fix content size scaling regression on X11 (#49174) Closes #49172 - Fixes a regression on X11 where content size was divided by the scale factor twice after the wgpu migration, causing half-sized rendering on HiDPI screens. - Aligns X11 [content_size()] behavior with Wayland by returning logical pixel bounds directly. Video : [Screencast from 2026-02-14 18-58-36.webm](https://github.com/user-attachments/assets/cf4edf3b-7b93-4ded-bf46-e900be44b22b) Release Notes: - N/A --- crates/gpui/src/platform/linux/x11/window.rs | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/crates/gpui/src/platform/linux/x11/window.rs b/crates/gpui/src/platform/linux/x11/window.rs index 93a9003be641e0f7bb44e324672c1992ec5e2d28..acfdcb068d42e6b342a8cde69e54421b972e3a4a 100644 --- a/crates/gpui/src/platform/linux/x11/window.rs +++ b/crates/gpui/src/platform/linux/x11/window.rs @@ -28,8 +28,7 @@ use x11rb::{ }; use std::{ - cell::RefCell, ffi::c_void, fmt::Display, num::NonZeroU32, ops::Div, ptr::NonNull, rc::Rc, - sync::Arc, + cell::RefCell, ffi::c_void, fmt::Display, num::NonZeroU32, ptr::NonNull, rc::Rc, sync::Arc, }; use super::{X11Display, XINPUT_ALL_DEVICE_GROUPS, XINPUT_ALL_DEVICES}; @@ -1264,12 +1263,10 @@ impl PlatformWindow for X11Window { } fn content_size(&self) -> Size { - // We divide by the scale factor here because this value is queried to determine how much to draw, - // but it will be multiplied later by the scale to adjust for scaling. - let state = self.0.state.borrow(); - state - .content_size() - .map(|size| size.div(state.scale_factor)) + // After the wgpu migration, X11WindowState::content_size() returns logical pixels + // (bounds.size is already divided by scale_factor in set_bounds), so no further + // division is needed here. This matches the Wayland implementation. + self.0.state.borrow().content_size() } fn resize(&mut self, size: Size) {