fix(wayland/pointer): don't send axis_discrete events when using version 8 or above, as required per spec

Signed-off-by: Schmarni <marnistromer@gmail.com>
This commit is contained in:
Schmarni
2025-10-01 00:00:12 +02:00
parent 0ebfc1153e
commit 3edaaf2dfc

View File

@@ -3,12 +3,12 @@ use crate::nodes::items::panel::Geometry;
use crate::wayland::core::surface::Surface; use crate::wayland::core::surface::Surface;
use crate::wayland::{Client, WaylandResult}; use crate::wayland::{Client, WaylandResult};
use mint::Vector2; use mint::Vector2;
use waynest_server::Client as _;
use std::sync::Arc; use std::sync::Arc;
use std::sync::Weak; use std::sync::Weak;
use tokio::sync::Mutex; use tokio::sync::Mutex;
use tracing; use tracing;
use waynest::ObjectId; use waynest::ObjectId;
use waynest_server::Client as _;
pub use waynest_protocols::server::core::wayland::wl_pointer::*; pub use waynest_protocols::server::core::wayland::wl_pointer::*;
@@ -150,13 +150,34 @@ impl Pointer {
) )
.await?; .await?;
} }
if self.version < 8
&& self.version >= 5
&& let Some(steps) = scroll_steps
{
self.axis_discrete(client, self.id, Axis::HorizontalScroll, steps.x as i32)
.await?;
self.axis_discrete(client, self.id, Axis::VerticalScroll, steps.y as i32)
.await?;
}
if self.version >= 8
&& let Some(steps) = scroll_steps
{
self.axis_value120(
client,
self.id,
Axis::HorizontalScroll,
(steps.x * 120.) as i32,
)
.await?;
self.axis_value120(
client,
self.id,
Axis::VerticalScroll,
(steps.y * 120.) as i32,
)
.await?;
}
if self.version >= 5 { if self.version >= 5 {
if let Some(steps) = scroll_steps {
self.axis_discrete(client, self.id, Axis::HorizontalScroll, steps.x as i32)
.await?;
self.axis_discrete(client, self.id, Axis::VerticalScroll, steps.y as i32)
.await?;
}
self.frame(client, self.id).await?; self.frame(client, self.id).await?;
} }
Ok(()) Ok(())