Skip to content

Commit fc7a7cf

Browse files
committed
linux: Use the input_event_X macros to access input_event members
This means the same members are available in the struct no matter whether it is a 32 or 64 bit platform or the linux_time_bits64 config is set.
1 parent 0bc998f commit fc7a7cf

File tree

1 file changed

+7
-8
lines changed
  • src/unix/linux_like/linux

1 file changed

+7
-8
lines changed

src/unix/linux_like/linux/mod.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -225,18 +225,17 @@ s! {
225225
}
226226

227227
pub struct input_event {
228-
// FIXME(1.0): Change to the commented variant, see https://github.com/rust-lang/libc/pull/4148#discussion_r1857511742
228+
// input_event_sec and input_event_usec are preprocessor macros in C.
229+
// On all variants _except_ 32-bit long and 64-bit time_t they actually
230+
// refer to members of input_event.time, a timeval struct.
231+
// The timeval struct has two members of type time_t and suseconds_t.
229232
#[cfg(any(target_pointer_width = "64", not(linux_time_bits64)))]
230-
pub time: crate::timeval,
231-
// #[cfg(any(target_pointer_width = "64", not(linux_time_bits64)))]
232-
// pub input_event_sec: time_t,
233-
// #[cfg(any(target_pointer_width = "64", not(linux_time_bits64)))]
234-
// pub input_event_usec: suseconds_t,
235-
// #[cfg(target_arch = "sparc64")]
236-
// _pad1: c_int,
233+
pub input_event_sec: crate::time_t,
237234
#[cfg(all(target_pointer_width = "32", linux_time_bits64))]
238235
pub input_event_sec: c_ulong,
239236

237+
#[cfg(any(target_pointer_width = "64", not(linux_time_bits64)))]
238+
pub input_event_usec: crate::suseconds_t,
240239
#[cfg(all(target_pointer_width = "32", linux_time_bits64))]
241240
pub input_event_usec: c_ulong,
242241

0 commit comments

Comments
 (0)