mirror of https://github.com/wayvr-org/wayvr.git
fmt
This commit is contained in:
parent
db1675d399
commit
bec00c6f48
|
|
@ -1,23 +1,23 @@
|
|||
use std::{io::Read, os::unix::net::UnixStream, path::PathBuf, sync::Arc};
|
||||
|
||||
use anyhow::Context;
|
||||
use smithay::input::Seat;
|
||||
use smithay::wayland::selection::data_device::set_data_device_selection;
|
||||
use smithay::{
|
||||
backend::input::Keycode,
|
||||
input::{keyboard::KeyboardHandle, pointer::PointerHandle},
|
||||
reexports::wayland_server,
|
||||
utils::SerialCounter,
|
||||
};
|
||||
use smithay::input::Seat;
|
||||
use smithay::wayland::selection::data_device::set_data_device_selection;
|
||||
use xkbcommon::xkb;
|
||||
|
||||
use crate::backend::wayvr::{ExternalProcessRequest, WayVRTask};
|
||||
use crate::backend::wayvr::comp::Application;
|
||||
use super::{
|
||||
ProcessWayVREnv,
|
||||
comp::{self, ClientState},
|
||||
process,
|
||||
};
|
||||
use crate::backend::wayvr::comp::Application;
|
||||
use crate::backend::wayvr::{ExternalProcessRequest, WayVRTask};
|
||||
|
||||
pub struct WayVRClient {
|
||||
pub client: wayland_server::Client,
|
||||
|
|
@ -209,7 +209,10 @@ impl WayVRCompositor {
|
|||
set_data_device_selection::<Application>(
|
||||
&self.state.display_handle,
|
||||
&self.seat,
|
||||
vec!["text/plain;charset=utf-8".to_string(), "text/plain".to_string()],
|
||||
vec![
|
||||
"text/plain;charset=utf-8".to_string(),
|
||||
"text/plain".to_string(),
|
||||
],
|
||||
text.as_bytes().into(),
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -241,7 +241,13 @@ impl WvrServerState {
|
|||
};
|
||||
|
||||
Ok(Self {
|
||||
manager: client::WayVRCompositor::new(state, display, seat_keyboard, seat_pointer, seat)?,
|
||||
manager: client::WayVRCompositor::new(
|
||||
state,
|
||||
display,
|
||||
seat_keyboard,
|
||||
seat_pointer,
|
||||
seat,
|
||||
)?,
|
||||
processes: ProcessVec::new(),
|
||||
wm: window::WindowManager::new(),
|
||||
ticks: 0,
|
||||
|
|
|
|||
|
|
@ -1,4 +1,8 @@
|
|||
use std::{collections::HashMap, rc::Rc, time::Duration};
|
||||
use super::{
|
||||
KeyButtonData, KeyState, KeyboardState, handle_mouse_motion, handle_press, handle_release,
|
||||
init_swipe_type_manager,
|
||||
layout::{self, KeyCapType},
|
||||
};
|
||||
use crate::{
|
||||
app_misc,
|
||||
gui::{
|
||||
|
|
@ -10,9 +14,13 @@ use crate::{
|
|||
subsystem::hid::XkbKeymap,
|
||||
windowing::backend::OverlayEventData,
|
||||
};
|
||||
use anyhow::{bail, Context};
|
||||
use anyhow::{Context, bail};
|
||||
use glam::{FloatExt, Mat4, Vec2, vec2, vec3};
|
||||
use slotmap::Key;
|
||||
use std::{collections::HashMap, rc::Rc, time::Duration};
|
||||
use wgui::event::StyleSetRequest;
|
||||
use wgui::layout::LayoutTask;
|
||||
use wgui::taffy::Display;
|
||||
use wgui::{
|
||||
animation::{Animation, AnimationEasing},
|
||||
assets::AssetPath,
|
||||
|
|
@ -25,10 +33,6 @@ use wgui::{
|
|||
taffy::{self, prelude::length},
|
||||
widget::{EventResult, div::WidgetDiv, rectangle::WidgetRectangle},
|
||||
};
|
||||
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.;
|
||||
|
||||
|
|
@ -42,7 +46,7 @@ fn new_doc_params(panel: &mut GuiPanel<KeyboardState>) -> ParseDocumentParams<'s
|
|||
|
||||
pub(super) fn update_swipe_prediction_bar(
|
||||
panel: &mut GuiPanel<KeyboardState>,
|
||||
app: &mut AppState
|
||||
app: &mut AppState,
|
||||
) -> anyhow::Result<bool> {
|
||||
let mut elements_changed = false;
|
||||
|
||||
|
|
@ -52,21 +56,22 @@ pub(super) fn update_swipe_prediction_bar(
|
|||
};
|
||||
|
||||
if let Some(recv) = panel.state.swipe_candidate_receiver.as_mut()
|
||||
&& let Ok(candidates) = recv.try_recv() {
|
||||
|
||||
let predictions_root = panel.parser_state
|
||||
&& let Ok(candidates) = recv.try_recv()
|
||||
{
|
||||
let predictions_root = panel
|
||||
.parser_state
|
||||
.get_widget_id("swipe_predictions_root")
|
||||
.unwrap_or_default();
|
||||
|
||||
if predictions_root.is_null() {
|
||||
return Ok(elements_changed)
|
||||
return Ok(elements_changed);
|
||||
}
|
||||
let doc_params = new_doc_params(panel);
|
||||
|
||||
panel.layout.remove_children(predictions_root);
|
||||
|
||||
let Some(new_suggestions) = candidates else {
|
||||
return Ok(elements_changed)
|
||||
return Ok(elements_changed);
|
||||
};
|
||||
|
||||
let mut iter = new_suggestions.iter();
|
||||
|
|
@ -87,7 +92,7 @@ pub(super) fn update_swipe_prediction_bar(
|
|||
"KeyPrediction",
|
||||
&mut panel.layout,
|
||||
predictions_root,
|
||||
params
|
||||
params,
|
||||
)?;
|
||||
|
||||
if let Ok(widget_id) = panel.parser_state.get_widget_id(&id) {
|
||||
|
|
@ -126,7 +131,7 @@ pub(super) fn update_swipe_prediction_bar(
|
|||
}
|
||||
Ok(EventResult::Pass)
|
||||
}
|
||||
})
|
||||
}),
|
||||
);
|
||||
panel.add_event_listener(
|
||||
widget_id,
|
||||
|
|
@ -134,35 +139,21 @@ pub(super) fn update_swipe_prediction_bar(
|
|||
Box::new({
|
||||
let k = key_state.clone();
|
||||
move |common, data, _app, _state| {
|
||||
on_enter_anim(
|
||||
k.clone(),
|
||||
common,
|
||||
data,
|
||||
accent_color,
|
||||
anim_mult,
|
||||
0.0,
|
||||
);
|
||||
on_enter_anim(k.clone(), common, data, accent_color, anim_mult, 0.0);
|
||||
Ok(EventResult::Pass)
|
||||
}
|
||||
})
|
||||
}),
|
||||
);
|
||||
panel.add_event_listener(
|
||||
widget_id,
|
||||
EventListenerKind::MouseLeave,
|
||||
Box::new({
|
||||
let k = key_state.clone();
|
||||
move |common, data, _app, _state | {
|
||||
on_leave_anim(
|
||||
k.clone(),
|
||||
common,
|
||||
data,
|
||||
accent_color,
|
||||
anim_mult,
|
||||
0.0,
|
||||
);
|
||||
move |common, data, _app, _state| {
|
||||
on_leave_anim(k.clone(), common, data, accent_color, anim_mult, 0.0);
|
||||
Ok(EventResult::Pass)
|
||||
}
|
||||
})
|
||||
}),
|
||||
);
|
||||
panel.add_event_listener(
|
||||
widget_id,
|
||||
|
|
@ -173,7 +164,7 @@ pub(super) fn update_swipe_prediction_bar(
|
|||
on_release_anim(k.clone(), common, data);
|
||||
Ok(EventResult::Pass)
|
||||
}
|
||||
})
|
||||
}),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -330,7 +321,6 @@ pub(super) fn create_keyboard_panel(
|
|||
width_mul,
|
||||
);
|
||||
|
||||
|
||||
Ok(EventResult::Pass)
|
||||
}
|
||||
}),
|
||||
|
|
@ -366,9 +356,20 @@ pub(super) fn create_keyboard_panel(
|
|||
let CallbackMetadata::MouseButton(button) = data.metadata else {
|
||||
panic!("CallbackMetadata should contain MouseButton!");
|
||||
};
|
||||
let within_key_pos = data.metadata.get_mouse_pos_normalized(&common.alterables.transform_stack);
|
||||
let within_key_pos = data
|
||||
.metadata
|
||||
.get_mouse_pos_normalized(&common.alterables.transform_stack);
|
||||
|
||||
handle_press(app, &k, &k_label, &k_cap_type, &within_key_pos, state, button, button.device);
|
||||
handle_press(
|
||||
app,
|
||||
&k,
|
||||
&k_label,
|
||||
&k_cap_type,
|
||||
&within_key_pos,
|
||||
state,
|
||||
button,
|
||||
button.device,
|
||||
);
|
||||
on_press_anim(k.clone(), common, data);
|
||||
Ok(EventResult::Pass)
|
||||
}
|
||||
|
|
@ -382,12 +383,21 @@ pub(super) fn create_keyboard_panel(
|
|||
let k_label = key_label.clone();
|
||||
let k_cap_type = key_cap_type.clone();
|
||||
move |common, data, _app, state| {
|
||||
let within_key_pos = data.metadata.get_mouse_pos_normalized(&common.alterables.transform_stack);
|
||||
let within_key_pos = data
|
||||
.metadata
|
||||
.get_mouse_pos_normalized(&common.alterables.transform_stack);
|
||||
let CallbackMetadata::MousePosition(position) = data.metadata else {
|
||||
panic!("CallbackMetadata should contain MousePosition!");
|
||||
};
|
||||
|
||||
handle_mouse_motion(&k, &k_label, &k_cap_type, state, &within_key_pos, position.device);
|
||||
handle_mouse_motion(
|
||||
&k,
|
||||
&k_label,
|
||||
&k_cap_type,
|
||||
state,
|
||||
&within_key_pos,
|
||||
position.device,
|
||||
);
|
||||
Ok(EventResult::Pass)
|
||||
}
|
||||
}),
|
||||
|
|
@ -480,7 +490,8 @@ pub(super) fn create_keyboard_panel(
|
|||
panel.state.swipe_typing_manager = None;
|
||||
panel.state.swipe_candidate_receiver = None;
|
||||
|
||||
let predictions_root = panel.parser_state
|
||||
let predictions_root = panel
|
||||
.parser_state
|
||||
.get_widget_id("swipe_predictions_root")
|
||||
.unwrap_or_default();
|
||||
|
||||
|
|
@ -491,13 +502,15 @@ pub(super) fn create_keyboard_panel(
|
|||
predictions_root,
|
||||
StyleSetRequest::Display(Display::None),
|
||||
));
|
||||
|
||||
}
|
||||
}
|
||||
if app.session.config.keyboard_swipe_to_type_enabled && panel.state.swipe_typing_manager.is_none() {
|
||||
if app.session.config.keyboard_swipe_to_type_enabled
|
||||
&& panel.state.swipe_typing_manager.is_none()
|
||||
{
|
||||
init_swipe_type_manager(&mut panel.state);
|
||||
|
||||
let predictions_root = panel.parser_state
|
||||
let predictions_root = panel
|
||||
.parser_state
|
||||
.get_widget_id("swipe_predictions_root")
|
||||
.unwrap_or_default();
|
||||
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
use std::{collections::HashMap, str::FromStr, sync::LazyLock};
|
||||
|
||||
use regex::Regex;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use crate::{
|
||||
config::{ConfigType, load_known_yaml},
|
||||
subsystem::hid::{
|
||||
KEYS_TO_MODS, KeyType, META, NUM_LOCK, SHIFT, VirtualKey, XkbKeymap, get_key_type,
|
||||
},
|
||||
};
|
||||
use regex::Regex;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use super::KeyButtonData;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,6 @@
|
|||
use std::{
|
||||
cell::Cell,
|
||||
collections::HashMap,
|
||||
process::{Child, Command},
|
||||
sync::atomic::Ordering,
|
||||
};
|
||||
use std::sync::mpsc::Receiver;
|
||||
use crate::overlays::keyboard::builder::update_swipe_prediction_bar;
|
||||
use crate::overlays::keyboard::layout::KeyCapType;
|
||||
use crate::overlays::keyboard::swipe_type::SwipeTypingManager;
|
||||
use crate::{
|
||||
KEYMAP_CHANGE,
|
||||
backend::{
|
||||
|
|
@ -27,25 +23,29 @@ use crate::{
|
|||
},
|
||||
};
|
||||
use anyhow::Context;
|
||||
use glam::{Affine3A, Quat, Vec3, vec3, Vec2};
|
||||
use glam::{Affine3A, Quat, Vec2, Vec3, vec3};
|
||||
use regex::Regex;
|
||||
use slotmap::{SlotMap, new_key_type, Key};
|
||||
use slotmap::{Key, SlotMap, new_key_type};
|
||||
use std::sync::mpsc::Receiver;
|
||||
use std::{
|
||||
cell::Cell,
|
||||
collections::HashMap,
|
||||
process::{Child, Command},
|
||||
sync::atomic::Ordering,
|
||||
};
|
||||
use wgui::event::StyleSetRequest;
|
||||
use wgui::layout::LayoutTask;
|
||||
use wgui::parser::Fetchable;
|
||||
use wgui::taffy::Display;
|
||||
use wgui::{
|
||||
drawing,
|
||||
event::{InternalStateChangeEvent, MouseButtonEvent, MouseButtonIndex},
|
||||
};
|
||||
use wgui::event::StyleSetRequest;
|
||||
use wgui::layout::{LayoutTask};
|
||||
use wgui::parser::Fetchable;
|
||||
use wgui::taffy::Display;
|
||||
use wlx_common::windowing::{OverlayWindowState, Positioning};
|
||||
use wlx_common::{
|
||||
config::AltModifier,
|
||||
overlays::{BackendAttrib, BackendAttribValue},
|
||||
};
|
||||
use crate::overlays::keyboard::builder::update_swipe_prediction_bar;
|
||||
use crate::overlays::keyboard::layout::KeyCapType;
|
||||
use crate::overlays::keyboard::swipe_type::SwipeTypingManager;
|
||||
|
||||
pub mod builder;
|
||||
mod layout;
|
||||
|
|
@ -133,14 +133,15 @@ pub(self) fn init_swipe_type_manager(state: &mut KeyboardState) {
|
|||
Ok((engine, receiver)) => {
|
||||
state.swipe_typing_manager = Some(engine);
|
||||
state.swipe_candidate_receiver = Some(receiver);
|
||||
},
|
||||
}
|
||||
Err(e) => {
|
||||
log::error!("Error occurred while trying to load swipe engine: {}", e);
|
||||
}
|
||||
};
|
||||
}
|
||||
pub(self) fn hide_swipe_type_manager(panel: &mut GuiPanel<KeyboardState>) {
|
||||
let predictions_root = panel.parser_state
|
||||
let predictions_root = panel
|
||||
.parser_state
|
||||
.get_widget_id("swipe_predictions_root")
|
||||
.unwrap_or_default();
|
||||
if !predictions_root.is_null() {
|
||||
|
|
@ -188,8 +189,7 @@ impl KeyboardBackend {
|
|||
}
|
||||
|
||||
log::info!("swipe engine created");
|
||||
let mut panel =
|
||||
create_keyboard_panel(app, keymap, state, &self.wlx_layout)?;
|
||||
let mut panel = create_keyboard_panel(app, keymap, state, &self.wlx_layout)?;
|
||||
|
||||
if !app.session.config.keyboard_swipe_to_type_enabled {
|
||||
hide_swipe_type_manager(&mut panel);
|
||||
|
|
@ -204,7 +204,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);
|
||||
|
|
@ -249,10 +248,7 @@ impl KeyboardBackend {
|
|||
.state = state_from;
|
||||
|
||||
if !app.session.config.keyboard_swipe_to_type_enabled {
|
||||
hide_swipe_type_manager(self.layout_panels
|
||||
.get_mut(self.active_layout)
|
||||
.unwrap()
|
||||
)
|
||||
hide_swipe_type_manager(self.layout_panels.get_mut(self.active_layout).unwrap())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -390,7 +386,7 @@ struct KeyboardState {
|
|||
set_list: SetList,
|
||||
clock_12h: bool,
|
||||
swipe_typing_manager: Option<SwipeTypingManager>,
|
||||
swipe_candidate_receiver: Option<Receiver<Option<Vec<String>>>>
|
||||
swipe_candidate_receiver: Option<Receiver<Option<Vec<String>>>>,
|
||||
}
|
||||
|
||||
macro_rules! take_and_leave_default {
|
||||
|
|
@ -458,7 +454,7 @@ fn handle_mouse_motion(
|
|||
key_cap_type: &KeyCapType,
|
||||
keyboard: &mut KeyboardState,
|
||||
within_key_pos: &Option<Vec2>,
|
||||
device: usize
|
||||
device: usize,
|
||||
) {
|
||||
if let Some(swipe_manager) = keyboard.swipe_typing_manager.as_mut()
|
||||
&& matches!(*key_cap_type, KeyCapType::Letter | KeyCapType::LetterAltGr)
|
||||
|
|
@ -469,9 +465,12 @@ fn handle_mouse_motion(
|
|||
if let Some(pos) = within_key_pos {
|
||||
// check because mouse motion can trigger despite hover being false
|
||||
if pos.x >= 0.0 && pos.x <= 1.0 && pos.y >= 0.0 && pos.y <= 1.0 {
|
||||
|
||||
if let Some(label) = key_label.first() {
|
||||
swipe_manager.add_swipe(pos, label.chars().next().unwrap_or_default(), device);
|
||||
swipe_manager.add_swipe(
|
||||
pos,
|
||||
label.chars().next().unwrap_or_default(),
|
||||
device,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -480,7 +479,6 @@ fn handle_mouse_motion(
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
fn handle_press(
|
||||
app: &mut AppState,
|
||||
|
|
@ -490,7 +488,7 @@ fn handle_press(
|
|||
within_key_pos: &Option<Vec2>,
|
||||
keyboard: &mut KeyboardState,
|
||||
button: MouseButtonEvent,
|
||||
device: usize
|
||||
device: usize,
|
||||
) {
|
||||
match &key.button_state {
|
||||
KeyButtonData::Key { vk, pressed } => {
|
||||
|
|
@ -499,11 +497,14 @@ fn handle_press(
|
|||
{
|
||||
if let Some(pos) = within_key_pos {
|
||||
if let Some(label) = key_label.first() {
|
||||
swipe_manager.add_swipe(pos, label.chars().next().unwrap_or_default(), device);
|
||||
swipe_manager.add_swipe(
|
||||
pos,
|
||||
label.chars().next().unwrap_or_default(),
|
||||
device,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
keyboard.modifiers |= match button.index {
|
||||
MouseButtonIndex::Right => SHIFT,
|
||||
MouseButtonIndex::Middle => keyboard.alt_modifier,
|
||||
|
|
@ -545,7 +546,12 @@ fn handle_press(
|
|||
}
|
||||
}
|
||||
|
||||
fn handle_release(app: &mut AppState, key: &KeyState, k_cap_type: &KeyCapType, keyboard: &mut KeyboardState) -> bool {
|
||||
fn handle_release(
|
||||
app: &mut AppState,
|
||||
key: &KeyState,
|
||||
k_cap_type: &KeyCapType,
|
||||
keyboard: &mut KeyboardState,
|
||||
) -> bool {
|
||||
match &key.button_state {
|
||||
KeyButtonData::Key { vk, pressed } => {
|
||||
if let Some(swipe_manager) = keyboard.swipe_typing_manager.as_mut()
|
||||
|
|
@ -553,13 +559,13 @@ fn handle_release(app: &mut AppState, key: &KeyState, k_cap_type: &KeyCapType, k
|
|||
{
|
||||
if swipe_manager.did_swipe_leave_first_key() {
|
||||
match swipe_manager.predict() {
|
||||
Ok(()) => {},
|
||||
Ok(()) => {}
|
||||
Err(e) => {
|
||||
log::error!("{}", e)
|
||||
}
|
||||
}
|
||||
}
|
||||
else { // pointer must have been released on the same key it was pressed on
|
||||
} else {
|
||||
// pointer must have been released on the same key it was pressed on
|
||||
swipe_manager.reset(); // drop swipe tracking that was started on press
|
||||
|
||||
app.hid_provider
|
||||
|
|
@ -569,8 +575,7 @@ fn handle_release(app: &mut AppState, key: &KeyState, k_cap_type: &KeyCapType, k
|
|||
.send_key_routed(app.wvr_server.as_mut(), *vk, false);
|
||||
play_key_click(app);
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
if let Some(swipe_manager) = keyboard.swipe_typing_manager.as_mut() {
|
||||
swipe_manager.reset();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,16 +1,16 @@
|
|||
use crate::state::AppState;
|
||||
use crate::subsystem::hid::{KeyModifier, VirtualKey, CTRL};
|
||||
use anyhow::{bail};
|
||||
use crate::subsystem::hid::{CTRL, KeyModifier, VirtualKey};
|
||||
use crate::subsystem::input::KeyboardFocus;
|
||||
use anyhow::bail;
|
||||
use arboard::Clipboard;
|
||||
use glam::Vec2;
|
||||
use std::mem;
|
||||
use std::sync::mpsc::{sync_channel, Receiver, SyncSender, channel, Sender};
|
||||
use std::sync::mpsc::{Receiver, Sender, SyncSender, channel, sync_channel};
|
||||
use std::thread::{self, JoinHandle};
|
||||
use std::time::Instant;
|
||||
use super_swipe_type::SwipePoint;
|
||||
use super_swipe_type::keyboard_manager::QwertyKeyboardGrid;
|
||||
use super_swipe_type::swipe_orchestrator::SwipeOrchestrator;
|
||||
use super_swipe_type::{SwipePoint};
|
||||
use crate::subsystem::input::KeyboardFocus;
|
||||
|
||||
const PREDICTION_SUGGESTION_COUNT: usize = 5;
|
||||
|
||||
|
|
@ -37,12 +37,22 @@ pub struct SwipeTypingManager {
|
|||
}
|
||||
|
||||
impl SwipeTypingManager {
|
||||
pub fn select_alternate_prediction(&mut self, word: &String, app: &mut AppState, original_keyboard_mods: KeyModifier) {
|
||||
pub fn select_alternate_prediction(
|
||||
&mut self,
|
||||
word: &String,
|
||||
app: &mut AppState,
|
||||
original_keyboard_mods: KeyModifier,
|
||||
) {
|
||||
Self::undo(app, original_keyboard_mods);
|
||||
self.select_word(word, app, original_keyboard_mods);
|
||||
}
|
||||
|
||||
pub fn select_word(&mut self, word: &String, app: &mut AppState, original_keyboard_mods: KeyModifier) {
|
||||
pub fn select_word(
|
||||
&mut self,
|
||||
word: &String,
|
||||
app: &mut AppState,
|
||||
original_keyboard_mods: KeyModifier,
|
||||
) {
|
||||
self.last_swiped_word = Some(word.clone());
|
||||
let text_to_paste = format!("{word} ");
|
||||
|
||||
|
|
@ -51,15 +61,14 @@ impl SwipeTypingManager {
|
|||
if let Ok(_) = self.clipboard.set_text(text_to_paste) {
|
||||
Self::paste(app, original_keyboard_mods);
|
||||
}
|
||||
},
|
||||
}
|
||||
KeyboardFocus::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);
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fn undo(app: &mut AppState, original_keyboard_mods: KeyModifier) {
|
||||
|
|
@ -148,11 +157,10 @@ impl SwipeTypingManager {
|
|||
let last_word = self.last_swiped_word.clone();
|
||||
self.reset_swipe();
|
||||
|
||||
self.prediction_task_sender
|
||||
.send(PredictionTask::Predict {
|
||||
swipe: current_swipe,
|
||||
last_word,
|
||||
})?;
|
||||
self.prediction_task_sender.send(PredictionTask::Predict {
|
||||
swipe: current_swipe,
|
||||
last_word,
|
||||
})?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
|
@ -188,7 +196,11 @@ impl SwipeTypingManager {
|
|||
}
|
||||
|
||||
pub fn add_swipe(&mut self, within_key_pos_normalized: &Vec2, key_label: char, device: usize) {
|
||||
if let Some(pos) = self.keyboard_gird.key_positions.get(&key_label.to_ascii_lowercase()) {
|
||||
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 {
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -337,8 +337,7 @@ pub const META: KeyModifier = 0x80;
|
|||
|
||||
#[allow(non_camel_case_types)]
|
||||
#[repr(u16)]
|
||||
#[derive(Debug, Deserialize, PartialEq, Eq, Clone, Copy, IntegerId, EnumString, EnumIter)]
|
||||
#[derive(Hash)]
|
||||
#[derive(Debug, Deserialize, PartialEq, Eq, Clone, Copy, IntegerId, EnumString, EnumIter, Hash)]
|
||||
pub enum VirtualKey {
|
||||
Escape = 9,
|
||||
N1, // number row
|
||||
|
|
|
|||
|
|
@ -217,7 +217,7 @@ impl CallbackMetadata {
|
|||
}
|
||||
pub fn get_mouse_pos_normalized(&self, transform_stack: &TransformStack) -> Option<Vec2> {
|
||||
let pos_relative = self.get_mouse_pos_relative(transform_stack)?;
|
||||
Some(pos_relative/transform_stack.parent().raw_dim)
|
||||
Some(pos_relative / transform_stack.parent().raw_dim)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,10 @@ use strum::{AsRefStr, EnumProperty, EnumString, VariantArray};
|
|||
use wayvr_ipc::packet_client::WvrProcessLaunchParams;
|
||||
|
||||
use crate::{
|
||||
astr_containers::{AStrMap, AStrSet}, locale::{self}, overlays::{BackendAttribValue, ToastDisplayMethod, ToastTopic}, windowing::OverlayWindowState
|
||||
astr_containers::{AStrMap, AStrSet},
|
||||
locale::{self},
|
||||
overlays::{BackendAttribValue, ToastDisplayMethod, ToastTopic},
|
||||
windowing::OverlayWindowState,
|
||||
};
|
||||
|
||||
pub type PwTokenMap = AStrMap<String>;
|
||||
|
|
@ -138,8 +141,6 @@ const fn def_max_height() -> u16 {
|
|||
1440
|
||||
}
|
||||
|
||||
|
||||
|
||||
#[derive(Deserialize, Serialize)]
|
||||
pub struct GeneralConfig {
|
||||
#[serde(default = "def_theme_path")]
|
||||
|
|
|
|||
Loading…
Reference in New Issue