wayland: add u64 type macro
This commit is contained in:
parent
7373509274
commit
d6b3973979
30 changed files with 69 additions and 67 deletions
|
|
@ -211,6 +211,8 @@ enum Type {
|
|||
Id(String),
|
||||
U32,
|
||||
I32,
|
||||
U64,
|
||||
U64Rev,
|
||||
Str,
|
||||
OptStr,
|
||||
BStr,
|
||||
|
|
@ -475,6 +477,8 @@ impl<'a> Parser<'a> {
|
|||
})?;
|
||||
Type::Pod(ty.val)
|
||||
}
|
||||
b"u64" => Type::U64,
|
||||
b"u64_rev" => Type::U64Rev,
|
||||
b"u32" => Type::U32,
|
||||
b"i32" => Type::I32,
|
||||
b"str" => Type::Str,
|
||||
|
|
@ -495,6 +499,8 @@ impl<'a> Parser<'a> {
|
|||
Type::Id(_) => {}
|
||||
Type::U32 => {}
|
||||
Type::I32 => {}
|
||||
Type::U64 => {}
|
||||
Type::U64Rev => {}
|
||||
Type::Fixed => {}
|
||||
Type::Pod(..) => {}
|
||||
_ => {
|
||||
|
|
@ -561,6 +567,8 @@ fn write_type<W: Write>(f: &mut W, ty: &Type) -> Result<()> {
|
|||
Type::Id(id) => write!(f, "{}Id", id)?,
|
||||
Type::U32 => write!(f, "u32")?,
|
||||
Type::I32 => write!(f, "i32")?,
|
||||
Type::U64 => write!(f, "u64")?,
|
||||
Type::U64Rev => write!(f, "u64")?,
|
||||
Type::Str => write!(f, "&'a str")?,
|
||||
Type::OptStr => write!(f, "Option<&'a str>")?,
|
||||
Type::BStr => write!(f, "&'a BStr")?,
|
||||
|
|
@ -662,6 +670,8 @@ fn write_message<W: Write>(f: &mut W, obj: &str, message: &Message) -> Result<()
|
|||
Type::Id(_) => "object",
|
||||
Type::U32 => "uint",
|
||||
Type::I32 => "int",
|
||||
Type::U64 => "u64",
|
||||
Type::U64Rev => "u64_rev",
|
||||
Type::OptStr => "optstr",
|
||||
Type::Str => "str",
|
||||
Type::Fixed => "fixed",
|
||||
|
|
@ -687,6 +697,8 @@ fn write_message<W: Write>(f: &mut W, obj: &str, message: &Message) -> Result<()
|
|||
Type::Id(_) => "object",
|
||||
Type::U32 => "uint",
|
||||
Type::I32 => "int",
|
||||
Type::U64 => "u64",
|
||||
Type::U64Rev => "u64_rev",
|
||||
Type::OptStr => "optstr",
|
||||
Type::Str | Type::BStr => "string",
|
||||
Type::Fixed => "fixed",
|
||||
|
|
|
|||
|
|
@ -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(())
|
||||
|
|
|
|||
|
|
@ -29,8 +29,7 @@ event damage {
|
|||
}
|
||||
|
||||
event presentation_time {
|
||||
tv_sec_hi: u32,
|
||||
tv_sec_lo: u32,
|
||||
tv_sec: u64,
|
||||
tv_nsec: u32,
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -7,8 +7,7 @@ event dmabuf {
|
|||
height: u32,
|
||||
offset: u32,
|
||||
stride: u32,
|
||||
modifier_lo: u32,
|
||||
modifier_hi: u32,
|
||||
modifier: u64_rev,
|
||||
}
|
||||
|
||||
event error {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
request set_timestamp {
|
||||
tv_sec_hi: u32,
|
||||
tv_sec_lo: u32,
|
||||
tv_sec: u64,
|
||||
tv_nsec: u32,
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,12 +6,10 @@ request destroy {
|
|||
|
||||
request set_acquire_point {
|
||||
timeline: id(wp_linux_drm_syncobj_timeline_v1),
|
||||
point_hi: u32,
|
||||
point_lo: u32,
|
||||
point: u64,
|
||||
}
|
||||
|
||||
request set_release_point {
|
||||
timeline: id(wp_linux_drm_syncobj_timeline_v1),
|
||||
point_hi: u32,
|
||||
point_lo: u32,
|
||||
point: u64,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,12 +5,10 @@ event sync_output {
|
|||
}
|
||||
|
||||
event presented {
|
||||
tv_sec_hi : u32,
|
||||
tv_sec_lo : u32,
|
||||
tv_sec : u64,
|
||||
tv_nsec : u32,
|
||||
refresh : u32,
|
||||
seq_hi : u32,
|
||||
seq_lo : u32,
|
||||
seq : u64,
|
||||
flags : u32,
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,7 @@
|
|||
# requests
|
||||
|
||||
request set_serial {
|
||||
serial_lo: u32,
|
||||
serial_hi: u32,
|
||||
serial: u64_rev,
|
||||
}
|
||||
|
||||
request destroy { }
|
||||
|
|
|
|||
|
|
@ -25,8 +25,7 @@ event flags {
|
|||
}
|
||||
|
||||
event ready {
|
||||
tv_sec_hi: u32,
|
||||
tv_sec_lo: u32,
|
||||
tv_sec: u64,
|
||||
tv_nsec: u32,
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -7,8 +7,7 @@ request add {
|
|||
plane_idx: u32,
|
||||
offset: u32,
|
||||
stride: u32,
|
||||
modifier_hi: u32,
|
||||
modifier_lo: u32,
|
||||
modifier: u64,
|
||||
}
|
||||
|
||||
request create {
|
||||
|
|
|
|||
|
|
@ -23,6 +23,5 @@ event format {
|
|||
|
||||
event modifier (since = 3) {
|
||||
format: u32,
|
||||
modifier_hi: u32,
|
||||
modifier_lo: u32,
|
||||
modifier: u64,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,8 +7,7 @@ request destroy {
|
|||
# events
|
||||
|
||||
event relative_motion {
|
||||
utime_hi: u32,
|
||||
utime_lo: u32,
|
||||
utime: u64,
|
||||
dx: fixed,
|
||||
dy: fixed,
|
||||
dx_unaccelerated: fixed,
|
||||
|
|
|
|||
|
|
@ -13,13 +13,11 @@ event type {
|
|||
}
|
||||
|
||||
event hardware_serial {
|
||||
hardware_serial_hi: u32,
|
||||
hardware_serial_lo: u32,
|
||||
hardware_serial: u64,
|
||||
}
|
||||
|
||||
event hardware_id_wacom {
|
||||
hardware_id_hi: u32,
|
||||
hardware_id_lo: u32,
|
||||
hardware_id: u64,
|
||||
}
|
||||
|
||||
event capability {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue