wayland: add u64 type macro
This commit is contained in:
parent
7373509274
commit
d6b3973979
30 changed files with 69 additions and 67 deletions
|
|
@ -67,7 +67,7 @@ async fn run(screenshot: Rc<Screenshot>) {
|
|||
width: ev.width as _,
|
||||
height: ev.height as _,
|
||||
format: XRGB8888,
|
||||
modifier: ((ev.modifier_hi as u64) << 32) | (ev.modifier_lo as u64),
|
||||
modifier: ev.modifier,
|
||||
planes,
|
||||
};
|
||||
res.push(Ok((buf, Some(ev.drm_dev))));
|
||||
|
|
|
|||
|
|
@ -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 });
|
||||
|
|
|
|||
|
|
@ -35,8 +35,7 @@ impl JayScreenshot {
|
|||
height: height as _,
|
||||
offset,
|
||||
stride,
|
||||
modifier_lo: modifier as u32,
|
||||
modifier_hi: (modifier >> 32) as u32,
|
||||
modifier,
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ impl TestJayScreenshot {
|
|||
width: ev.width as _,
|
||||
height: ev.height as _,
|
||||
format: XRGB8888,
|
||||
modifier: ((ev.modifier_hi as u64) << 32) | (ev.modifier_lo as u64),
|
||||
modifier: ev.modifier,
|
||||
planes,
|
||||
})));
|
||||
Ok(())
|
||||
|
|
|
|||
|
|
@ -27,8 +27,7 @@ impl TestSyncobjSurface {
|
|||
self.tran.send(SetAcquirePoint {
|
||||
self_id: self.id,
|
||||
timeline: tl.id,
|
||||
point_hi: (point >> 32) as _,
|
||||
point_lo: point as _,
|
||||
point,
|
||||
})?;
|
||||
Ok(())
|
||||
}
|
||||
|
|
@ -37,8 +36,7 @@ impl TestSyncobjSurface {
|
|||
self.tran.send(SetReleasePoint {
|
||||
self_id: self.id,
|
||||
timeline: tl.id,
|
||||
point_hi: (point >> 32) as _,
|
||||
point_lo: point as _,
|
||||
point,
|
||||
})?;
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,6 +43,16 @@ impl<'a> MsgFormatter<'a> {
|
|||
self
|
||||
}
|
||||
|
||||
pub fn u64(&mut self, int: u64) -> &mut Self {
|
||||
self.uint((int >> 32) as u32);
|
||||
self.uint(int as u32)
|
||||
}
|
||||
|
||||
pub fn u64_rev(&mut self, int: u64) -> &mut Self {
|
||||
self.uint(int as u32);
|
||||
self.uint((int >> 32) as u32)
|
||||
}
|
||||
|
||||
pub fn fixed(&mut self, fixed: Fixed) -> &mut Self {
|
||||
self.write(uapi::as_bytes(&fixed.0));
|
||||
self
|
||||
|
|
|
|||
|
|
@ -52,6 +52,18 @@ impl<'a, 'b> MsgParser<'a, 'b> {
|
|||
self.int().map(|i| i as u32)
|
||||
}
|
||||
|
||||
pub fn u64(&mut self) -> Result<u64, MsgParserError> {
|
||||
let hi = self.uint()?;
|
||||
let lo = self.uint()?;
|
||||
Ok(((hi as u64) << 32) | lo as u64)
|
||||
}
|
||||
|
||||
pub fn u64_rev(&mut self) -> Result<u64, MsgParserError> {
|
||||
let lo = self.uint()?;
|
||||
let hi = self.uint()?;
|
||||
Ok(((hi as u64) << 32) | lo as u64)
|
||||
}
|
||||
|
||||
pub fn object<T>(&mut self) -> Result<T, MsgParserError>
|
||||
where
|
||||
ObjectId: Into<T>,
|
||||
|
|
|
|||
|
|
@ -33,8 +33,7 @@ impl UsrLinuxBufferParams {
|
|||
plane_idx: idx as _,
|
||||
offset: plane.offset,
|
||||
stride: plane.stride,
|
||||
modifier_hi: (buf.modifier >> 32) as _,
|
||||
modifier_lo: buf.modifier as _,
|
||||
modifier: buf.modifier,
|
||||
});
|
||||
}
|
||||
self.con.request(Create {
|
||||
|
|
|
|||
|
|
@ -55,10 +55,7 @@ impl ZwpLinuxDmabufV1EventHandler for UsrLinuxDmabuf {
|
|||
fn modifier(&self, ev: Modifier, _slf: &Rc<Self>) -> Result<(), Self::Error> {
|
||||
if let Some(owner) = self.owner.get() {
|
||||
if let Some(format) = formats().get(&ev.format) {
|
||||
owner.modifier(
|
||||
format,
|
||||
((ev.modifier_hi as u64) << 32) | (ev.modifier_lo as u64),
|
||||
);
|
||||
owner.modifier(format, ev.modifier);
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue