cleanups
This commit is contained in:
parent
6d466c65a4
commit
579869f2f0
21 changed files with 168 additions and 2771 deletions
|
|
@ -3,6 +3,11 @@ name = "cursor-move-webapp"
|
|||
version = "0.1.0"
|
||||
authors = ["Mona Mayrhofer <mona.mayrhofer@proton.me>"]
|
||||
edition = "2024"
|
||||
repository = "https://github.com/mona-mayrhofer/cursor-mover-app"
|
||||
categories = ["tools"]
|
||||
keywords = ["tools", "cursor", "remote"]
|
||||
license = "EUPL-1.2"
|
||||
description = "A web application for controlling your cursor and keyboard via a smartphone browser."
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
|
|
@ -10,25 +15,25 @@ edition = "2024"
|
|||
dioxus = { version = "0.7.3", features = ["router", "fullstack", "logger"] }
|
||||
dioxus-html = { version = "0.7.3", features = ["serialize"] }
|
||||
serde = { version = "1.0.228", features = ["derive"] }
|
||||
wasmtimer = "0.4.3"
|
||||
|
||||
|
||||
wayland-client = { version = "0.31.12", optional = true }
|
||||
wayland-protocols-wlr = { version = "0.3.10", features = ["client"], optional = true }
|
||||
tokio = {version = "1.49.0", optional = true}
|
||||
rustix = { version = "1.1.4", optional = true, features = ["time"] }
|
||||
rustix = { version = "1.1.4", optional = true, features = ["time"], default-features = false }
|
||||
wayland-protocols-misc = { version = "0.3.10", features = ["client"], optional = true }
|
||||
wayland-protocols = { version = "0.32.10", features = ["client", "staging"], optional = true }
|
||||
xkb = {version = "0.3.0", optional = true}
|
||||
memfile = {version = "0.3.2", optional = true}
|
||||
wasmtimer = "0.4.3"
|
||||
|
||||
[features]
|
||||
default = ["web"]
|
||||
# The feature that are only required for the web = ["dioxus/web"] build target should be optional and only enabled in the web = ["dioxus/web"] feature
|
||||
web = ["dioxus/web"]
|
||||
# The feature that are only required for the desktop = ["dioxus/desktop"] build target should be optional and only enabled in the desktop = ["dioxus/desktop"] feature
|
||||
desktop = ["dioxus/desktop"]
|
||||
#desktop = ["dioxus/desktop"]
|
||||
# The feature that are only required for the mobile = ["dioxus/mobile"] build target should be optional and only enabled in the mobile = ["dioxus/mobile"] feature
|
||||
mobile = ["dioxus/mobile"]
|
||||
#mobile = ["dioxus/mobile"]
|
||||
# The feature that are only required for the server = ["dioxus/server"] build target should be optional and only enabled in the server = ["dioxus/server"] feature
|
||||
server = ["dioxus/server",
|
||||
"dep:wayland-client",
|
||||
|
|
@ -37,7 +42,6 @@ server = ["dioxus/server",
|
|||
"dep:wayland-protocols",
|
||||
"dep:tokio",
|
||||
"dep:rustix",
|
||||
"dep:xkb",
|
||||
"dep:memfile"
|
||||
]
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,6 @@
|
|||
use dioxus::{
|
||||
fullstack::{CborEncoding, WebSocketOptions, Websocket, extract::State, use_websocket},
|
||||
html::{
|
||||
geometry::{ElementSpace, euclid::Point2D},
|
||||
input_data::MouseButton,
|
||||
},
|
||||
html::input_data::MouseButton,
|
||||
logger::tracing,
|
||||
prelude::*,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ pub fn KeyboardArea(onevent: EventHandler<ClientEvent>) -> Element {
|
|||
let v = evt.value();
|
||||
input_state.set(v.clone());
|
||||
|
||||
onevent.call(ClientEvent::TextInputEvent { text: v })
|
||||
onevent.call(ClientEvent::TextInputEvent { text: v });
|
||||
});
|
||||
let key_press_handler = use_callback(move |evt: Event<KeyboardData>| {
|
||||
if input_state.read().is_empty() {
|
||||
|
|
|
|||
|
|
@ -1,8 +1,4 @@
|
|||
use std::{
|
||||
collections::{HashMap, VecDeque},
|
||||
ops::Sub,
|
||||
time::Duration,
|
||||
};
|
||||
use std::{collections::HashMap, ops::Sub, time::Duration};
|
||||
|
||||
use dioxus::{
|
||||
html::{
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ const BUTTON_RIGHT: u32 = 0x111;
|
|||
const BUTTON_MIDDLE: u32 = 0x112;
|
||||
|
||||
// https://wayland.app/protocols/wayland#wl_keyboard:enum:keymap_format
|
||||
#[expect(unused)]
|
||||
const NO_KEYMAP: u32 = 0;
|
||||
const XKB_V1: u32 = 1;
|
||||
|
||||
|
|
@ -233,8 +234,11 @@ enum InputProxyServiceState {
|
|||
keymap: Keymap,
|
||||
},
|
||||
Running {
|
||||
#[expect(unused)]
|
||||
seat: WlSeat,
|
||||
#[expect(unused)]
|
||||
virtual_pointer_manager: ZwlrVirtualPointerManagerV1,
|
||||
#[expect(unused)]
|
||||
virtual_keyboard_manager: ZwpVirtualKeyboardManagerV1,
|
||||
|
||||
virtual_pointer: ZwlrVirtualPointerV1,
|
||||
|
|
@ -282,7 +286,7 @@ impl InputProxyServiceState {
|
|||
}
|
||||
}
|
||||
|
||||
fn input_method_mut(&mut self) -> Option<&mut InputMethod> {
|
||||
const fn input_method_mut(&mut self) -> Option<&mut InputMethod> {
|
||||
match self {
|
||||
Self::Running { input_method, .. } => Some(input_method),
|
||||
Self::Incomplete { .. } => None,
|
||||
|
|
@ -480,7 +484,6 @@ impl Dispatch<ZwpInputMethodV2, ()> for InputProxyServiceState {
|
|||
_conn: &Connection,
|
||||
_qhandle: &QueueHandle<Self>,
|
||||
) {
|
||||
panic!();
|
||||
tracing::warn!("Unknown event received from ZwpInputMethodV2");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,12 @@
|
|||
#![expect(unused)]
|
||||
|
||||
use dioxus::logger::tracing;
|
||||
|
||||
fn is_key_string(s: &str) -> bool {
|
||||
s.chars().all(|c| !c.is_control()) && s.chars().skip(1).all(|c| !c.is_ascii())
|
||||
}
|
||||
|
||||
#[expect(clippy::too_many_lines)]
|
||||
pub fn web_key_to_linux_keycode(s: &str) -> Option<u32> {
|
||||
tracing::info!("Converting {s}");
|
||||
match s {
|
||||
|
|
|
|||
|
|
@ -57,16 +57,14 @@ impl MouseFilterBuffer {
|
|||
|
||||
let mut i = self.buffer.iter();
|
||||
|
||||
let mut last = if let Some(it) = i.find(|it| it.time >= start_time) {
|
||||
it
|
||||
} else {
|
||||
let Some(mut last) = i.find(|it| it.time >= start_time) else {
|
||||
return Vector2D::zero();
|
||||
};
|
||||
let start_time = last.time;
|
||||
let mut last_time = last.time;
|
||||
|
||||
for point in i {
|
||||
total_distance += (point.position - last.position);
|
||||
total_distance += point.position - last.position;
|
||||
last = point;
|
||||
last_time = point.time;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
use crate::components::{Controls, MouseArea};
|
||||
use crate::components::Controls;
|
||||
use dioxus::prelude::*;
|
||||
|
||||
/// The Home page component that will be rendered when the current route is `[Route::Home]`
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue