1
0
Fork 0
forked from wry/wry

wayland: add u64 type macro

This commit is contained in:
Julian Orth 2025-06-04 13:24:28 +02:00
parent 7373509274
commit d6b3973979
30 changed files with 69 additions and 67 deletions

View file

@ -270,8 +270,7 @@ impl ExtImageCopyCaptureFrameV1 {
}
self.client.event(PresentationTime {
self_id: self.id,
tv_sec_hi: (tv_sec >> 32) as u32,
tv_sec_lo: tv_sec as u32,
tv_sec,
tv_nsec,
});
self.client.event(Ready { self_id: self.id });

View file

@ -35,8 +35,7 @@ impl JayScreenshot {
height: height as _,
offset,
stride,
modifier_lo: modifier as u32,
modifier_hi: (modifier >> 32) as u32,
modifier,
});
}

View file

@ -63,16 +63,14 @@ impl ZwpTabletToolV2 {
pub fn send_hardware_serial(&self, serial: u64) {
self.client.event(HardwareSerial {
self_id: self.id,
hardware_serial_hi: (serial >> 32) as _,
hardware_serial_lo: serial as _,
hardware_serial: serial,
});
}
pub fn send_hardware_id_wacom(&self, id: u64) {
self.client.event(HardwareIdWacom {
self_id: self.id,
hardware_id_hi: (id >> 32) as _,
hardware_id_lo: id as _,
hardware_id: id,
});
}

View file

@ -31,8 +31,7 @@ impl ZwpRelativePointerV1 {
logical_to_client_wire_scale!(self.client, dx, dy);
self.client.event(RelativeMotion {
self_id: self.id,
utime_hi: (time_usec >> 32) as u32,
utime_lo: time_usec as u32,
utime: time_usec,
dx,
dy,
dx_unaccelerated,

View file

@ -48,7 +48,8 @@ impl WpCommitTimerV1RequestHandler for WpCommitTimerV1 {
if req.tv_nsec >= 1_000_000_000 {
return Err(WpCommitTimerV1Error::InvalidNsec);
}
let nsec = (((req.tv_sec_hi as u64) << 32) | (req.tv_sec_lo as u64))
let nsec = req
.tv_sec
.checked_mul(1_000_000_000)
.and_then(|n| n.checked_add(req.tv_nsec as u64));
let Some(nsec) = nsec else {

View file

@ -57,24 +57,20 @@ impl WpLinuxDrmSyncobjSurfaceV1RequestHandler for WpLinuxDrmSyncobjSurfaceV1 {
}
fn set_acquire_point(&self, req: SetAcquirePoint, _slf: &Rc<Self>) -> Result<(), Self::Error> {
let point = point(req.point_hi, req.point_lo);
let point = SyncObjPoint(req.point);
let timeline = self.client.lookup(req.timeline)?;
self.surface.pending.borrow_mut().acquire_point = Some((timeline.sync_obj.clone(), point));
Ok(())
}
fn set_release_point(&self, req: SetReleasePoint, _slf: &Rc<Self>) -> Result<(), Self::Error> {
let point = point(req.point_hi, req.point_lo);
let point = SyncObjPoint(req.point);
let timeline = self.client.lookup(req.timeline)?;
self.surface.pending.borrow_mut().release_point = Some((timeline.sync_obj.clone(), point));
Ok(())
}
}
fn point(hi: u32, lo: u32) -> SyncObjPoint {
SyncObjPoint(((hi as u64) << 32) | (lo as u64))
}
object_base! {
self = WpLinuxDrmSyncobjSurfaceV1;
version = self.version;

View file

@ -26,7 +26,7 @@ impl XwaylandSurfaceV1RequestHandler for XwaylandSurfaceV1 {
if self.x.surface.xwayland_serial.is_some() {
return Err(XwaylandSurfaceV1Error::SerialAlreadySet);
}
let serial = req.serial_lo as u64 | ((req.serial_hi as u64) << 32);
let serial = req.serial;
if self.client.last_xwayland_serial.get() >= serial {
return Err(XwaylandSurfaceV1Error::NonMonotonicSerial);
}

View file

@ -37,12 +37,10 @@ impl WpPresentationFeedback {
pub fn send_presented(&self, tv_sec: u64, tv_nsec: u32, refresh: u32, seq: u64, flags: u32) {
self.client.event(Presented {
self_id: self.id,
tv_sec_hi: (tv_sec >> 32) as u32,
tv_sec_lo: tv_sec as u32,
tv_sec,
tv_nsec,
refresh,
seq_hi: (seq >> 32) as u32,
seq_lo: seq as u32,
seq,
flags,
});
}

View file

@ -38,8 +38,7 @@ impl ZwlrScreencopyFrameV1 {
pub fn send_ready(&self, tv_sec: u64, tv_nsec: u32) {
self.client.event(Ready {
self_id: self.id,
tv_sec_hi: (tv_sec >> 32) as u32,
tv_sec_lo: tv_sec as u32,
tv_sec,
tv_nsec,
});
}

View file

@ -133,7 +133,7 @@ impl ZwpLinuxBufferParamsV1RequestHandler for ZwpLinuxBufferParamsV1 {
}
fn add(&self, req: Add, _slf: &Rc<Self>) -> Result<(), Self::Error> {
let modifier = ((req.modifier_hi as u64) << 32) | req.modifier_lo as u64;
let modifier = req.modifier;
match self.modifier.get() {
Some(m) if m != modifier => {
return Err(ZwpLinuxBufferParamsV1Error::MixedModifiers(modifier, m));

View file

@ -94,8 +94,7 @@ impl ZwpLinuxDmabufV1 {
self.client.event(Modifier {
self_id: self.id,
format,
modifier_hi: (modifier >> 32) as _,
modifier_lo: modifier as _,
modifier,
})
}