diff --git a/wayvr/src/backend/openvr/lines.rs b/wayvr/src/backend/openvr/lines.rs index 0a5a397..749e41e 100644 --- a/wayvr/src/backend/openvr/lines.rs +++ b/wayvr/src/backend/openvr/lines.rs @@ -123,14 +123,13 @@ impl LinePool { let center = (start + end) * 0.5; let dir_norm = dir / len; - let xform = Affine3A::from_scale_rotation_translation( - Vec3::new(1., len / 0.002, 1.), + let xform = Affine3A::from_rotation_translation( Quat::from_rotation_arc(Vec3::Z, dir_norm.into()), center.into(), ); - let rotation = Affine3A::from_axis_angle(Vec3::X, PI * 1.5); - let mut transform = xform * rotation; + let rotation = Affine3A::from_axis_angle(Vec3::X, -PI * 0.5); + let mut transform = xform * rotation * Affine3A::from_scale(Vec3::new(1., len / 0.002, 1.)); let to_hmd = hmd.translation - center; let sides = [Vec3A::Z, Vec3A::X, Vec3A::NEG_Z, Vec3A::NEG_X]; diff --git a/wayvr/src/subsystem/dbus/kde_keyboard_layouts.rs b/wayvr/src/subsystem/dbus/kde_keyboard_layouts.rs new file mode 100644 index 0000000..43c778b --- /dev/null +++ b/wayvr/src/subsystem/dbus/kde_keyboard_layouts.rs @@ -0,0 +1,195 @@ +// This code was autogenerated with `dbus-codegen-rust -g -m None -d org.kde.keyboard -p /Layouts`, see https://github.com/diwic/dbus-rs +use dbus; +#[allow(unused_imports)] +use dbus::arg; +use dbus::blocking; + +pub trait OrgKdeKeyboardLayouts { + fn switch_to_next_layout(&self) -> Result<(), dbus::Error>; + fn switch_to_previous_layout(&self) -> Result<(), dbus::Error>; + fn set_layout(&self, index: u32) -> Result; + fn get_layout(&self) -> Result; + fn get_layouts_list(&self) -> Result, dbus::Error>; +} + +#[derive(Debug)] +pub struct OrgKdeKeyboardLayoutsLayoutChanged { + pub index: u32, +} + +impl arg::AppendAll for OrgKdeKeyboardLayoutsLayoutChanged { + fn append(&self, i: &mut arg::IterAppend) { + arg::RefArg::append(&self.index, i); + } +} + +impl arg::ReadAll for OrgKdeKeyboardLayoutsLayoutChanged { + fn read(i: &mut arg::Iter) -> Result { + Ok(OrgKdeKeyboardLayoutsLayoutChanged { index: i.read()? }) + } +} + +impl dbus::message::SignalArgs for OrgKdeKeyboardLayoutsLayoutChanged { + const NAME: &'static str = "layoutChanged"; + const INTERFACE: &'static str = "org.kde.KeyboardLayouts"; +} + +#[derive(Debug)] +pub struct OrgKdeKeyboardLayoutsLayoutListChanged {} + +impl arg::AppendAll for OrgKdeKeyboardLayoutsLayoutListChanged { + fn append(&self, _: &mut arg::IterAppend) {} +} + +impl arg::ReadAll for OrgKdeKeyboardLayoutsLayoutListChanged { + fn read(_: &mut arg::Iter) -> Result { + Ok(OrgKdeKeyboardLayoutsLayoutListChanged {}) + } +} + +impl dbus::message::SignalArgs for OrgKdeKeyboardLayoutsLayoutListChanged { + const NAME: &'static str = "layoutListChanged"; + const INTERFACE: &'static str = "org.kde.KeyboardLayouts"; +} + +impl<'a, T: blocking::BlockingSender, C: ::std::ops::Deref> OrgKdeKeyboardLayouts + for blocking::Proxy<'a, C> +{ + fn switch_to_next_layout(&self) -> Result<(), dbus::Error> { + self.method_call("org.kde.KeyboardLayouts", "switchToNextLayout", ()) + } + + fn switch_to_previous_layout(&self) -> Result<(), dbus::Error> { + self.method_call("org.kde.KeyboardLayouts", "switchToPreviousLayout", ()) + } + + fn set_layout(&self, index: u32) -> Result { + self.method_call("org.kde.KeyboardLayouts", "setLayout", (index,)) + .and_then(|r: (bool,)| Ok(r.0)) + } + + fn get_layout(&self) -> Result { + self.method_call("org.kde.KeyboardLayouts", "getLayout", ()) + .and_then(|r: (u32,)| Ok(r.0)) + } + + fn get_layouts_list(&self) -> Result, dbus::Error> { + self.method_call("org.kde.KeyboardLayouts", "getLayoutsList", ()) + .and_then(|r: (Vec<(String, String, String)>,)| Ok(r.0)) + } +} + +pub trait OrgFreedesktopDBusProperties { + fn get arg::Get<'b> + 'static>( + &self, + interface_name: &str, + property_name: &str, + ) -> Result; + fn set( + &self, + interface_name: &str, + property_name: &str, + value: I2, + ) -> Result<(), dbus::Error>; + fn get_all(&self, interface_name: &str) -> Result; +} + +#[derive(Debug)] +pub struct OrgFreedesktopDBusPropertiesPropertiesChanged { + pub interface_name: String, + pub changed_properties: arg::PropMap, + pub invalidated_properties: Vec, +} + +impl arg::AppendAll for OrgFreedesktopDBusPropertiesPropertiesChanged { + fn append(&self, i: &mut arg::IterAppend) { + arg::RefArg::append(&self.interface_name, i); + arg::RefArg::append(&self.changed_properties, i); + arg::RefArg::append(&self.invalidated_properties, i); + } +} + +impl arg::ReadAll for OrgFreedesktopDBusPropertiesPropertiesChanged { + fn read(i: &mut arg::Iter) -> Result { + Ok(OrgFreedesktopDBusPropertiesPropertiesChanged { + interface_name: i.read()?, + changed_properties: i.read()?, + invalidated_properties: i.read()?, + }) + } +} + +impl dbus::message::SignalArgs for OrgFreedesktopDBusPropertiesPropertiesChanged { + const NAME: &'static str = "PropertiesChanged"; + const INTERFACE: &'static str = "org.freedesktop.DBus.Properties"; +} + +impl<'a, T: blocking::BlockingSender, C: ::std::ops::Deref> OrgFreedesktopDBusProperties + for blocking::Proxy<'a, C> +{ + fn get arg::Get<'b> + 'static>( + &self, + interface_name: &str, + property_name: &str, + ) -> Result { + self.method_call( + "org.freedesktop.DBus.Properties", + "Get", + (interface_name, property_name), + ) + .and_then(|r: (arg::Variant,)| Ok((r.0).0)) + } + + fn set( + &self, + interface_name: &str, + property_name: &str, + value: I2, + ) -> Result<(), dbus::Error> { + self.method_call( + "org.freedesktop.DBus.Properties", + "Set", + (interface_name, property_name, arg::Variant(value)), + ) + } + + fn get_all(&self, interface_name: &str) -> Result { + self.method_call( + "org.freedesktop.DBus.Properties", + "GetAll", + (interface_name,), + ) + .and_then(|r: (arg::PropMap,)| Ok(r.0)) + } +} + +pub trait OrgFreedesktopDBusIntrospectable { + fn introspect(&self) -> Result; +} + +impl<'a, T: blocking::BlockingSender, C: ::std::ops::Deref> + OrgFreedesktopDBusIntrospectable for blocking::Proxy<'a, C> +{ + fn introspect(&self) -> Result { + self.method_call("org.freedesktop.DBus.Introspectable", "Introspect", ()) + .and_then(|r: (String,)| Ok(r.0)) + } +} + +pub trait OrgFreedesktopDBusPeer { + fn ping(&self) -> Result<(), dbus::Error>; + fn get_machine_id(&self) -> Result; +} + +impl<'a, T: blocking::BlockingSender, C: ::std::ops::Deref> OrgFreedesktopDBusPeer + for blocking::Proxy<'a, C> +{ + fn ping(&self) -> Result<(), dbus::Error> { + self.method_call("org.freedesktop.DBus.Peer", "Ping", ()) + } + + fn get_machine_id(&self) -> Result { + self.method_call("org.freedesktop.DBus.Peer", "GetMachineId", ()) + .and_then(|r: (String,)| Ok(r.0)) + } +}