fix: full wayland version compliance

This commit is contained in:
Nova
2025-08-11 18:02:25 -07:00
parent 2719c0b00a
commit 41d6b02506
6 changed files with 69 additions and 30 deletions

View File

@@ -13,12 +13,14 @@ use waynest::{
#[derive(Dispatcher)]
pub struct Pointer {
pub id: ObjectId,
version: u32,
focused_surface: Mutex<Weak<Surface>>,
}
impl Pointer {
pub fn new(id: ObjectId) -> Self {
pub fn new(id: ObjectId, version: u32) -> Self {
Self {
id,
version,
focused_surface: Mutex::new(Weak::new()),
}
}
@@ -77,7 +79,9 @@ impl Pointer {
fixed_from_f32(position.y),
)
.await?;
self.frame(client, self.id).await?;
if self.version >= 5 {
self.frame(client, self.id).await?;
}
Ok(())
}
@@ -141,13 +145,16 @@ impl Pointer {
)
.await?;
}
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?;
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(())
}
pub async fn reset(&self, client: &mut Client) -> Result<()> {