Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WayVR: IPC & Dashboard integration support #129

Merged
merged 10 commits into from
Jan 10, 2025
118 changes: 115 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 13 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ image_dds = { version = "0.6.0", default-features = false, features = [
] }
mint = "0.5.9"

# WayVR-only deps
################################
#WayVR-only deps
################################
khronos-egl = { version = "6.0.0", features = ["static"], optional = true }
smithay = { git = "https://github.com/Smithay/smithay.git", default-features = false, features = [
"renderer_gl",
Expand All @@ -81,12 +83,17 @@ smithay = { git = "https://github.com/Smithay/smithay.git", default-features = f
uuid = { version = "1.10.0", features = ["v4", "fast-rng"], optional = true }
wayland-client = { version = "0.31.6", optional = true }
wayland-egl = { version = "0.32.4", optional = true }
interprocess = { version = "2.2.2", optional = true }
postcard = { version = "1.1.1", optional = true }
bytes = { version = "1.9.0", optional = true }
wayvr_ipc = { git = "https://github.com/olekolek1000/wayvr-ipc.git", rev = "c2a6438ffdcc78ff9c0637d914df1bc673723824", default-features = false, optional = true }
################################

[build-dependencies]
regex = { version = "*" }

[features]
default = ["openxr", "openvr", "osc", "x11", "wayland", "wayvr"]
default = ["openvr", "openxr", "osc", "x11", "wayland", "wayvr"]
openvr = ["dep:ovr_overlay", "dep:json"]
openxr = ["dep:openxr", "dep:libmonado-rs"]
osc = ["dep:rosc"]
Expand All @@ -101,5 +108,9 @@ wayvr = [
"dep:uuid",
"dep:wayland-client",
"dep:wayland-egl",
"dep:interprocess",
"dep:postcard",
"dep:bytes",
"dep:wayvr_ipc",
]
as-raw-xcb-connection = []
8 changes: 8 additions & 0 deletions src/backend/input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,13 @@ impl InputState {
if hand.now.show_hide != hand.before.show_hide {
log::debug!("Hand {}: show_hide {}", hand.idx, hand.now.show_hide);
}
if hand.now.toggle_dashboard != hand.before.toggle_dashboard {
log::debug!(
"Hand {}: toggle_dashboard {}",
hand.idx,
hand.now.toggle_dashboard
);
}
if hand.now.space_drag != hand.before.space_drag {
log::debug!("Hand {}: space_drag {}", hand.idx, hand.now.space_drag);
}
Expand Down Expand Up @@ -215,6 +222,7 @@ pub struct PointerState {
pub grab: bool,
pub alt_click: bool,
pub show_hide: bool,
pub toggle_dashboard: bool,
pub space_drag: bool,
pub space_rotate: bool,
pub space_reset: bool,
Expand Down
17 changes: 13 additions & 4 deletions src/backend/openvr/input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,17 @@ const PATH_HAPTICS: [&str; 2] = [
"/actions/default/out/HapticsRight",
];

const PATH_ALT_CLICK: &str = "/actions/default/in/AltClick";
const PATH_CLICK_MODIFIER_MIDDLE: &str = "/actions/default/in/ClickModifierMiddle";
const PATH_CLICK_MODIFIER_RIGHT: &str = "/actions/default/in/ClickModifierRight";
const PATH_CLICK: &str = "/actions/default/in/Click";
const PATH_GRAB: &str = "/actions/default/in/Grab";
const PATH_MOVE_MOUSE: &str = "/actions/default/in/MoveMouse";
const PATH_SCROLL: &str = "/actions/default/in/Scroll";
const PATH_ALT_CLICK: &str = "/actions/default/in/AltClick";
const PATH_SHOW_HIDE: &str = "/actions/default/in/ShowHide";
const PATH_SPACE_DRAG: &str = "/actions/default/in/SpaceDrag";
const PATH_SPACE_ROTATE: &str = "/actions/default/in/SpaceRotate";
const PATH_CLICK_MODIFIER_RIGHT: &str = "/actions/default/in/ClickModifierRight";
const PATH_CLICK_MODIFIER_MIDDLE: &str = "/actions/default/in/ClickModifierMiddle";
const PATH_MOVE_MOUSE: &str = "/actions/default/in/MoveMouse";
const PATH_TOGGLE_DASHBOARD: &str = "/actions/default/in/ToggleDashboard";

const INPUT_ANY: InputValueHandle = InputValueHandle(ovr_overlay::sys::k_ulInvalidInputValueHandle);

Expand All @@ -51,6 +52,7 @@ pub(super) struct OpenVrInputSource {
scroll_hnd: ActionHandle,
alt_click_hnd: ActionHandle,
show_hide_hnd: ActionHandle,
toggle_dashboard_hnd: ActionHandle,
space_drag_hnd: ActionHandle,
space_rotate_hnd: ActionHandle,
click_modifier_right_hnd: ActionHandle,
Expand All @@ -75,6 +77,7 @@ impl OpenVrInputSource {
let scroll_hnd = input.get_action_handle(PATH_SCROLL)?;
let alt_click_hnd = input.get_action_handle(PATH_ALT_CLICK)?;
let show_hide_hnd = input.get_action_handle(PATH_SHOW_HIDE)?;
let toggle_dashboard_hnd = input.get_action_handle(PATH_TOGGLE_DASHBOARD)?;
let space_drag_hnd = input.get_action_handle(PATH_SPACE_DRAG)?;
let space_rotate_hnd = input.get_action_handle(PATH_SPACE_ROTATE)?;
let click_modifier_right_hnd = input.get_action_handle(PATH_CLICK_MODIFIER_RIGHT)?;
Expand Down Expand Up @@ -111,6 +114,7 @@ impl OpenVrInputSource {
scroll_hnd,
alt_click_hnd,
show_hide_hnd,
toggle_dashboard_hnd,
space_drag_hnd,
space_rotate_hnd,
click_modifier_right_hnd,
Expand Down Expand Up @@ -196,6 +200,11 @@ impl OpenVrInputSource {
.map(|x| x.0.bState)
.unwrap_or(false);

app_hand.now.toggle_dashboard = input
.get_digital_action_data(self.toggle_dashboard_hnd, hand.input_hnd)
.map(|x| x.0.bState)
.unwrap_or(false);

app_hand.now.space_drag = input
.get_digital_action_data(self.space_drag_hnd, hand.input_hnd)
.map(|x| x.0.bState)
Expand Down
4 changes: 2 additions & 2 deletions src/backend/openvr/lines.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use vulkano::image::view::ImageView;
use vulkano::image::ImageLayout;

use crate::backend::overlay::{
FrameTransform, OverlayData, OverlayRenderer, OverlayState, SplitOverlayBackend,
FrameTransform, OverlayData, OverlayRenderer, OverlayState, SplitOverlayBackend, Z_ORDER_LINES,
};
use crate::graphics::WlxGraphics;
use crate::state::AppState;
Expand Down Expand Up @@ -82,7 +82,7 @@ impl LinePool {
},
..Default::default()
};
data.state.z_order = 69;
data.state.z_order = Z_ORDER_LINES;
data.state.dirty = true;

self.lines.insert(id, data);
Expand Down
Loading