get it to build

This commit is contained in:
oneshinyboi 2026-07-26 23:29:13 -05:00
parent 1a4813e234
commit db0e6ab080
No known key found for this signature in database
GPG Key ID: A494E206A095F0C0
9 changed files with 861 additions and 46 deletions

845
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -127,6 +127,8 @@ xkbcommon = {
calloop = { version = "0.14.4", optional = true }
calloop-wayland-source = { version = "0.4.1", optional = true }
evdev = "0.13.2"
super-swipe-type = "0.3.2"
arboard = "3.6.1"
[build-dependencies]
regex.workspace = true

View File

@ -18,7 +18,6 @@ use smithay::{
reexports::wayland_server::{self, protocol::wl_surface::WlSurface},
utils::{Logical, Point, SerialCounter},
};
use smithay::input::Seat;
use smithay::wayland::selection::data_device::set_data_device_selection;
use wgui::log::LogErr;
use xkbcommon::xkb;
@ -40,7 +39,6 @@ pub struct WayVRCompositor {
pub state: comp::Application,
pub seat_keyboard: KeyboardHandle<comp::Application>,
pub seat_pointer: PointerHandle<comp::Application>,
pub seat: Seat<comp::Application>,
pub serial_counter: SerialCounter,
pub wayland_env: super::WaylandEnv,
@ -98,7 +96,6 @@ impl WayVRCompositor {
display: wayland_server::Display<comp::Application>,
seat_keyboard: KeyboardHandle<comp::Application>,
seat_pointer: PointerHandle<comp::Application>,
seat: Seat<comp::Application>,
) -> anyhow::Result<Self> {
let (wayland_env, listener) = create_wayland_listener()?;
@ -122,7 +119,6 @@ impl WayVRCompositor {
serial_counter: SerialCounter::new(),
clients: Vec::new(),
toplevel_surf_count: 0,
seat,
scroll_accumulator: [0.0, 0.0],
})
}
@ -267,7 +263,7 @@ impl WayVRCompositor {
pub fn set_clipboard_text(&mut self, text: String) {
set_data_device_selection::<Application>(
&self.state.display_handle,
&self.seat,
&self.state.seat,
vec!["text/plain;charset=utf-8".to_string(), "text/plain".to_string()],
text.as_bytes().into(),
);

View File

@ -314,7 +314,6 @@ fn logging_init(args: &mut Args) {
.from_env_lossy()
.add_directive("symphonia_core::probe=warn".parse().unwrap())
.add_directive("symphonia_bundle_mp3=warn".parse().unwrap())
.add_directive("ort=warn".parse().unwrap())
.add_directive("zbus=warn".parse().unwrap())
.add_directive("usvg=error".parse().unwrap())
.add_directive("resvg=error".parse().unwrap())

View File

@ -1,5 +1,5 @@
use std::{rc::Rc, time::Duration};
use std::collections::HashMap;
use crate::{
app_misc,
gui::{
@ -13,6 +13,7 @@ use crate::{
};
use anyhow::{bail, Context};
use glam::{FloatExt, Mat4, Vec2, vec2, vec3};
use slotmap::Key;
use smallvec::{SmallVec, smallvec};
use wgui::{
animation::{Animation, AnimationEasing},
@ -30,11 +31,10 @@ use wgui::{
sprite::WidgetSprite,
},
};
use super::{
KeyButtonData, KeyState, KeyboardState, handle_press, handle_release,
layout::{self, KeyCapType},
};
use wgui::event::StyleSetRequest;
use wgui::layout::LayoutTask;
use wgui::taffy::Display;
use super::{KeyButtonData, KeyState, KeyboardState, handle_press, handle_release, layout::{self, KeyCapType}, handle_mouse_motion, init_swipe_type_manager};
const PIXELS_PER_UNIT: f32 = 60.;
@ -52,10 +52,7 @@ pub(super) fn update_swipe_prediction_bar(
) -> anyhow::Result<bool> {
let mut elements_changed = false;
let (accent_color, anim_mult) = {
let theme = &app.wgui_theme;
(theme.accent_color, theme.animation_mult)
};
let anim_mult = app.wgui_theme.animation_mult;
if let Some(recv) = panel.state.swipe_candidate_receiver.as_mut()
&& let Ok(candidates) = recv.try_recv() {
@ -93,7 +90,7 @@ pub(super) fn update_swipe_prediction_bar(
"KeyPrediction",
&mut panel.layout,
predictions_root,
params
TemplateParams::from_hashmap(params)
)?;
if let Ok(widget_id) = panel.parser_state.get_widget_id(&id) {
@ -117,6 +114,8 @@ pub(super) fn update_swipe_prediction_bar(
cur_border_color: rect.params.border_color.into(),
border: rect.params.border,
drawn_state: false.into(),
labels: Default::default(),
sprites: Default::default(),
})
};
panel.add_event_listener(
@ -144,7 +143,6 @@ pub(super) fn update_swipe_prediction_bar(
k.clone(),
common,
data,
accent_color,
anim_mult,
0.0,
);
@ -162,7 +160,6 @@ pub(super) fn update_swipe_prediction_bar(
k.clone(),
common,
data,
accent_color,
anim_mult,
0.0,
);
@ -256,7 +253,7 @@ pub(super) fn create_keyboard_panel(
params.insert_rc("width", key_width.to_string().into());
params.insert_rc("height", key_height.to_string().into());
let mut label = key.label.into_iter();
let mut label = key.label.clone().into_iter();
label
.next()
.and_then(|s| params.insert_rc("text", s.into()));

View File

@ -2,6 +2,7 @@ use std::{collections::HashMap, str::FromStr, sync::LazyLock};
use regex::Regex;
use serde::{Deserialize, Serialize};
use crate::{
config::{ConfigType, load_known_yaml},
subsystem::hid::{

View File

@ -30,14 +30,13 @@ use anyhow::Context;
use glam::{Affine3A, Quat, Vec3, vec3, Vec2};
use regex::Regex;
use slotmap::{SlotMap, new_key_type, Key};
use slotmap::{SlotMap, new_key_type};
use smallvec::SmallVec;
use wgui::{
color::WguiColor,
event::{InternalStateChangeEvent, MouseButtonEvent, MouseButtonIndex},
layout::WidgetID,
};
use wgui::event::StyleSetRequest;
use wgui::event::{DeviceBitmask, StyleSetRequest};
use wgui::layout::{LayoutTask};
use wgui::parser::Fetchable;
use wgui::taffy::Display;
@ -124,7 +123,7 @@ pub fn create_keyboard(app: &mut AppState, wayland: bool) -> anyhow::Result<Over
transform: Affine3A::from_scale_rotation_translation(
Vec3::ONE * width,
Quat::from_rotation_x(-10f32.to_radians()),
vec3(0.0, -0.69, -0.5),
vec3(0.0, -0.65, -0.5),
),
..OverlayWindowState::default()
},
@ -207,7 +206,6 @@ impl KeyboardBackend {
Ok(id)
}
fn switch_keymap(&mut self, keymap: &XkbKeymap, app: &mut AppState) -> anyhow::Result<bool> {
if !self.wlx_layout.auto_labels.unwrap_or(true) {
return Ok(false);
@ -470,7 +468,7 @@ fn handle_mouse_motion(
key_cap_type: &KeyCapType,
keyboard: &mut KeyboardState,
within_key_pos: &Option<Vec2>,
device: usize
device: DeviceBitmask
) {
if let Some(swipe_manager) = keyboard.swipe_typing_manager.as_mut()
&& matches!(*key_cap_type, KeyCapType::Letter | KeyCapType::LetterAltGr)
@ -502,7 +500,7 @@ fn handle_press(
within_key_pos: &Option<Vec2>,
keyboard: &mut KeyboardState,
button: MouseButtonEvent,
device: usize
device: DeviceBitmask
) {
match &key.button_state {
KeyButtonData::Key { vk, pressed } => {

View File

@ -10,7 +10,8 @@ use std::time::Instant;
use super_swipe_type::keyboard_manager::QwertyKeyboardGrid;
use super_swipe_type::swipe_orchestrator::SwipeOrchestrator;
use super_swipe_type::{SwipePoint};
use crate::subsystem::input::KeyboardFocus;
use wgui::event::DeviceBitmask;
use crate::subsystem::input::InputFocus;
const PREDICTION_SUGGESTION_COUNT: usize = 5;
@ -32,7 +33,7 @@ pub struct SwipeTypingManager {
clipboard: Clipboard,
swipe_left_first_key: bool,
first_swipe_char: char,
current_swipe_device: Option<usize>,
current_swipe_device: Option<DeviceBitmask>,
last_swiped_word: Option<String>,
}
@ -46,13 +47,13 @@ impl SwipeTypingManager {
self.last_swiped_word = Some(word.clone());
let text_to_paste = format!("{word} ");
match app.hid_provider.keyboard_focus {
KeyboardFocus::PhysicalScreen => {
match app.hid_provider.get_input_focus() {
InputFocus::PhysicalScreen => {
if let Ok(_) = self.clipboard.set_text(text_to_paste) {
Self::paste(app, original_keyboard_mods);
}
},
KeyboardFocus::WayVR => {
InputFocus::WayVR => {
if let Some(wvr_server) = app.wvr_server.as_mut() {
wvr_server.set_clipboard_text(text_to_paste);
Self::paste(app, original_keyboard_mods);
@ -171,7 +172,7 @@ impl SwipeTypingManager {
self.current_swipe_device = None;
}
fn start_swipe(&mut self, key_label: char, device: usize) -> Instant {
fn start_swipe(&mut self, key_label: char, device: DeviceBitmask) -> Instant {
let now = Instant::now();
self.swipe_start_time = Some(now);
self.first_swipe_char = key_label.to_ascii_lowercase();
@ -187,7 +188,7 @@ impl SwipeTypingManager {
self.current_swipe.is_empty()
}
pub fn add_swipe(&mut self, within_key_pos_normalized: &Vec2, key_label: char, device: usize) {
pub fn add_swipe(&mut self, within_key_pos_normalized: &Vec2, key_label: char, device: DeviceBitmask) {
if let Some(pos) = self.keyboard_gird.key_positions.get(&key_label.to_ascii_lowercase()) {
if let Some(current_device) = self.current_swipe_device {
if current_device != device {

View File

@ -490,7 +490,7 @@ pub struct GeneralConfig {
#[serde(default = "def_one")]
pub grid_opacity: f32,
#[serde(default = "def_false")]
#[serde(default)]
pub keyboard_swipe_to_type_enabled: bool,
#[serde(default)]