diff --git a/build/wire.rs b/build/wire.rs index 71b267cc..e6f81b1f 100644 --- a/build/wire.rs +++ b/build/wire.rs @@ -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(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(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(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", diff --git a/src/cli/screenshot.rs b/src/cli/screenshot.rs index c9dd0e9a..cddaf540 100644 --- a/src/cli/screenshot.rs +++ b/src/cli/screenshot.rs @@ -67,7 +67,7 @@ async fn run(screenshot: Rc) { 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)))); diff --git a/src/ifs/ext_image_copy/ext_image_copy_capture_frame_v1.rs b/src/ifs/ext_image_copy/ext_image_copy_capture_frame_v1.rs index 126e50ab..0320e708 100644 --- a/src/ifs/ext_image_copy/ext_image_copy_capture_frame_v1.rs +++ b/src/ifs/ext_image_copy/ext_image_copy_capture_frame_v1.rs @@ -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 }); diff --git a/src/ifs/jay_screenshot.rs b/src/ifs/jay_screenshot.rs index d388fdd9..bcc1c536 100644 --- a/src/ifs/jay_screenshot.rs +++ b/src/ifs/jay_screenshot.rs @@ -35,8 +35,7 @@ impl JayScreenshot { height: height as _, offset, stride, - modifier_lo: modifier as u32, - modifier_hi: (modifier >> 32) as u32, + modifier, }); } diff --git a/src/ifs/wl_seat/tablet/zwp_tablet_tool_v2.rs b/src/ifs/wl_seat/tablet/zwp_tablet_tool_v2.rs index 28aec218..a39a4905 100644 --- a/src/ifs/wl_seat/tablet/zwp_tablet_tool_v2.rs +++ b/src/ifs/wl_seat/tablet/zwp_tablet_tool_v2.rs @@ -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, }); } diff --git a/src/ifs/wl_seat/zwp_relative_pointer_v1.rs b/src/ifs/wl_seat/zwp_relative_pointer_v1.rs index 92234bad..4c34667e 100644 --- a/src/ifs/wl_seat/zwp_relative_pointer_v1.rs +++ b/src/ifs/wl_seat/zwp_relative_pointer_v1.rs @@ -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, diff --git a/src/ifs/wl_surface/wp_commit_timer_v1.rs b/src/ifs/wl_surface/wp_commit_timer_v1.rs index 064284ac..abc465cf 100644 --- a/src/ifs/wl_surface/wp_commit_timer_v1.rs +++ b/src/ifs/wl_surface/wp_commit_timer_v1.rs @@ -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 { diff --git a/src/ifs/wl_surface/wp_linux_drm_syncobj_surface_v1.rs b/src/ifs/wl_surface/wp_linux_drm_syncobj_surface_v1.rs index fea9caab..ffe9759b 100644 --- a/src/ifs/wl_surface/wp_linux_drm_syncobj_surface_v1.rs +++ b/src/ifs/wl_surface/wp_linux_drm_syncobj_surface_v1.rs @@ -57,24 +57,20 @@ impl WpLinuxDrmSyncobjSurfaceV1RequestHandler for WpLinuxDrmSyncobjSurfaceV1 { } fn set_acquire_point(&self, req: SetAcquirePoint, _slf: &Rc) -> 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) -> 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; diff --git a/src/ifs/wl_surface/x_surface/xwayland_surface_v1.rs b/src/ifs/wl_surface/x_surface/xwayland_surface_v1.rs index 71a87d23..e690f9df 100644 --- a/src/ifs/wl_surface/x_surface/xwayland_surface_v1.rs +++ b/src/ifs/wl_surface/x_surface/xwayland_surface_v1.rs @@ -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); } diff --git a/src/ifs/wp_presentation_feedback.rs b/src/ifs/wp_presentation_feedback.rs index 109ed7a3..245ae8e6 100644 --- a/src/ifs/wp_presentation_feedback.rs +++ b/src/ifs/wp_presentation_feedback.rs @@ -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, }); } diff --git a/src/ifs/zwlr_screencopy_frame_v1.rs b/src/ifs/zwlr_screencopy_frame_v1.rs index 982e88ed..99165861 100644 --- a/src/ifs/zwlr_screencopy_frame_v1.rs +++ b/src/ifs/zwlr_screencopy_frame_v1.rs @@ -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, }); } diff --git a/src/ifs/zwp_linux_buffer_params_v1.rs b/src/ifs/zwp_linux_buffer_params_v1.rs index cfff2d97..e91794d3 100644 --- a/src/ifs/zwp_linux_buffer_params_v1.rs +++ b/src/ifs/zwp_linux_buffer_params_v1.rs @@ -133,7 +133,7 @@ impl ZwpLinuxBufferParamsV1RequestHandler for ZwpLinuxBufferParamsV1 { } fn add(&self, req: Add, _slf: &Rc) -> 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)); diff --git a/src/ifs/zwp_linux_dmabuf_v1.rs b/src/ifs/zwp_linux_dmabuf_v1.rs index 5812022d..4282ed25 100644 --- a/src/ifs/zwp_linux_dmabuf_v1.rs +++ b/src/ifs/zwp_linux_dmabuf_v1.rs @@ -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, }) } diff --git a/src/it/test_ifs/test_screenshot.rs b/src/it/test_ifs/test_screenshot.rs index f4c70a4d..580d616a 100644 --- a/src/it/test_ifs/test_screenshot.rs +++ b/src/it/test_ifs/test_screenshot.rs @@ -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(()) diff --git a/src/it/test_ifs/test_syncobj_surface.rs b/src/it/test_ifs/test_syncobj_surface.rs index b0b27a15..ca2c3105 100644 --- a/src/it/test_ifs/test_syncobj_surface.rs +++ b/src/it/test_ifs/test_syncobj_surface.rs @@ -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(()) } diff --git a/src/utils/buffd/formatter.rs b/src/utils/buffd/formatter.rs index 35f07e7f..9e56dc06 100644 --- a/src/utils/buffd/formatter.rs +++ b/src/utils/buffd/formatter.rs @@ -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 diff --git a/src/utils/buffd/parser.rs b/src/utils/buffd/parser.rs index 4c638e75..a8e92c67 100644 --- a/src/utils/buffd/parser.rs +++ b/src/utils/buffd/parser.rs @@ -52,6 +52,18 @@ impl<'a, 'b> MsgParser<'a, 'b> { self.int().map(|i| i as u32) } + pub fn u64(&mut self) -> Result { + let hi = self.uint()?; + let lo = self.uint()?; + Ok(((hi as u64) << 32) | lo as u64) + } + + pub fn u64_rev(&mut self) -> Result { + let lo = self.uint()?; + let hi = self.uint()?; + Ok(((hi as u64) << 32) | lo as u64) + } + pub fn object(&mut self) -> Result where ObjectId: Into, diff --git a/src/wl_usr/usr_ifs/usr_linux_buffer_params.rs b/src/wl_usr/usr_ifs/usr_linux_buffer_params.rs index a9e9551f..8b9f8a1d 100644 --- a/src/wl_usr/usr_ifs/usr_linux_buffer_params.rs +++ b/src/wl_usr/usr_ifs/usr_linux_buffer_params.rs @@ -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 { diff --git a/src/wl_usr/usr_ifs/usr_linux_dmabuf.rs b/src/wl_usr/usr_ifs/usr_linux_dmabuf.rs index e3e0a0e5..436a4fda 100644 --- a/src/wl_usr/usr_ifs/usr_linux_dmabuf.rs +++ b/src/wl_usr/usr_ifs/usr_linux_dmabuf.rs @@ -55,10 +55,7 @@ impl ZwpLinuxDmabufV1EventHandler for UsrLinuxDmabuf { fn modifier(&self, ev: Modifier, _slf: &Rc) -> 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(()) diff --git a/wire/ext_image_copy_capture_frame_v1.txt b/wire/ext_image_copy_capture_frame_v1.txt index 6703e54b..4490e1d6 100644 --- a/wire/ext_image_copy_capture_frame_v1.txt +++ b/wire/ext_image_copy_capture_frame_v1.txt @@ -29,8 +29,7 @@ event damage { } event presentation_time { - tv_sec_hi: u32, - tv_sec_lo: u32, + tv_sec: u64, tv_nsec: u32, } diff --git a/wire/jay_screenshot.txt b/wire/jay_screenshot.txt index ba6432e1..85cc0899 100644 --- a/wire/jay_screenshot.txt +++ b/wire/jay_screenshot.txt @@ -7,8 +7,7 @@ event dmabuf { height: u32, offset: u32, stride: u32, - modifier_lo: u32, - modifier_hi: u32, + modifier: u64_rev, } event error { diff --git a/wire/wp_commit_timer_v1.txt b/wire/wp_commit_timer_v1.txt index 3a98bee6..4b6a2305 100644 --- a/wire/wp_commit_timer_v1.txt +++ b/wire/wp_commit_timer_v1.txt @@ -1,6 +1,5 @@ request set_timestamp { - tv_sec_hi: u32, - tv_sec_lo: u32, + tv_sec: u64, tv_nsec: u32, } diff --git a/wire/wp_linux_drm_syncobj_surface_v1.txt b/wire/wp_linux_drm_syncobj_surface_v1.txt index da7bb68b..a4dac48f 100644 --- a/wire/wp_linux_drm_syncobj_surface_v1.txt +++ b/wire/wp_linux_drm_syncobj_surface_v1.txt @@ -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, } diff --git a/wire/wp_presentation_feedback.txt b/wire/wp_presentation_feedback.txt index b6635dee..5cc70855 100644 --- a/wire/wp_presentation_feedback.txt +++ b/wire/wp_presentation_feedback.txt @@ -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, } diff --git a/wire/xwayland_surface_v1.txt b/wire/xwayland_surface_v1.txt index 1cc40cc9..42c19019 100644 --- a/wire/xwayland_surface_v1.txt +++ b/wire/xwayland_surface_v1.txt @@ -1,8 +1,7 @@ # requests request set_serial { - serial_lo: u32, - serial_hi: u32, + serial: u64_rev, } request destroy { } diff --git a/wire/zwlr_screencopy_frame_v1.txt b/wire/zwlr_screencopy_frame_v1.txt index b1336c31..7467a2cc 100644 --- a/wire/zwlr_screencopy_frame_v1.txt +++ b/wire/zwlr_screencopy_frame_v1.txt @@ -25,8 +25,7 @@ event flags { } event ready { - tv_sec_hi: u32, - tv_sec_lo: u32, + tv_sec: u64, tv_nsec: u32, } diff --git a/wire/zwp_linux_buffer_params_v1.txt b/wire/zwp_linux_buffer_params_v1.txt index a231c9e0..947362b3 100644 --- a/wire/zwp_linux_buffer_params_v1.txt +++ b/wire/zwp_linux_buffer_params_v1.txt @@ -7,8 +7,7 @@ request add { plane_idx: u32, offset: u32, stride: u32, - modifier_hi: u32, - modifier_lo: u32, + modifier: u64, } request create { diff --git a/wire/zwp_linux_dmabuf_v1.txt b/wire/zwp_linux_dmabuf_v1.txt index 9b6e9052..794ff334 100644 --- a/wire/zwp_linux_dmabuf_v1.txt +++ b/wire/zwp_linux_dmabuf_v1.txt @@ -23,6 +23,5 @@ event format { event modifier (since = 3) { format: u32, - modifier_hi: u32, - modifier_lo: u32, + modifier: u64, } diff --git a/wire/zwp_relative_pointer_v1.txt b/wire/zwp_relative_pointer_v1.txt index 8df681e2..71fd8bf7 100644 --- a/wire/zwp_relative_pointer_v1.txt +++ b/wire/zwp_relative_pointer_v1.txt @@ -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, diff --git a/wire/zwp_tablet_tool_v2.txt b/wire/zwp_tablet_tool_v2.txt index 9351dc80..ea611667 100644 --- a/wire/zwp_tablet_tool_v2.txt +++ b/wire/zwp_tablet_tool_v2.txt @@ -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 {