fix: wayland controlled side, cursor misalignment (#13537)

Signed-off-by: fufesou <linlong1266@gmail.com>
This commit is contained in:
fufesou
2025-11-18 00:37:15 +08:00
committed by GitHub
parent a6571e71e4
commit b2dff336ce
22 changed files with 1241 additions and 187 deletions

View File

@@ -304,6 +304,12 @@ pub(super) fn get_display_info(idx: usize) -> Option<DisplayInfo> {
// Display to DisplayInfo
// The DisplayInfo is be sent to the peer.
pub(super) fn check_update_displays(all: &Vec<Display>) {
// For compatibility: if only one display, scale remains 1.0 and we use the physical size for `uinput`.
// If there are multiple displays, we use the logical size for `uinput` by setting scale to d.scale().
#[cfg(target_os = "linux")]
let use_logical_scale = !is_x11()
&& crate::is_server()
&& scrap::wayland::display::get_displays().displays.len() > 1;
let displays = all
.iter()
.map(|d| {
@@ -315,6 +321,12 @@ pub(super) fn check_update_displays(all: &Vec<Display>) {
{
scale = d.scale();
}
#[cfg(target_os = "linux")]
{
if use_logical_scale {
scale = d.scale();
}
}
let original_resolution = get_original_resolution(
&display_name,
((d.width() as f64) / scale).round() as usize,