mirror of
https://github.com/feschber/lan-mouse.git
synced 2026-03-07 11:59:59 +03:00
add ui mockup
This commit is contained in:
@@ -213,6 +213,58 @@
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="AdwPreferencesGroup">
|
||||
<property name="title" translatable="yes">Incoming Connections</property>
|
||||
<child>
|
||||
<object class="GtkListBox" id="connection_list">
|
||||
<property name="selection-mode">none</property>
|
||||
<child type="placeholder">
|
||||
<object class="AdwActionRow">
|
||||
<property name="title">no incoming connections!</property>
|
||||
<property name="subtitle">devices that control this pc will show up here</property>
|
||||
</object>
|
||||
</child>
|
||||
<style>
|
||||
<class name="boxed-list" />
|
||||
</style>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="AdwPreferencesGroup">
|
||||
<property name="title" translatable="yes">Authorized Keys</property>
|
||||
<property name="header-suffix">
|
||||
<object class="GtkButton">
|
||||
<signal name="clicked" handler="handle_add_cert_fingerprint" swapped="true"/>
|
||||
<property name="child">
|
||||
<object class="AdwButtonContent">
|
||||
<property name="icon-name">list-add-symbolic</property>
|
||||
<property name="label" translatable="yes">Add</property>
|
||||
</object>
|
||||
</property>
|
||||
<style>
|
||||
<class name="flat"/>
|
||||
</style>
|
||||
</object>
|
||||
</property>
|
||||
<child>
|
||||
<object class="GtkListBox" id="fingerprint_list">
|
||||
<property name="selection-mode">none</property>
|
||||
<child type="placeholder">
|
||||
<object class="AdwActionRow">
|
||||
<property name="title">no fingerprints!</property>
|
||||
<property name="subtitle">add a public key fingerprint via the + button</property>
|
||||
</object>
|
||||
</child>
|
||||
<style>
|
||||
<class name="boxed-list" />
|
||||
</style>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
|
||||
@@ -118,6 +118,11 @@ impl Window {
|
||||
self.obj().request_capture();
|
||||
}
|
||||
|
||||
#[template_callback]
|
||||
fn handle_add_cert_fingerprint(&self, _button: &Button) {
|
||||
log::info!("TODO: impl add certificate fingerprint");
|
||||
}
|
||||
|
||||
pub fn set_port(&self, port: u16) {
|
||||
self.port.set(port);
|
||||
if port == DEFAULT_PORT {
|
||||
|
||||
@@ -3,7 +3,7 @@ use futures::StreamExt;
|
||||
use input_emulation::{EmulationHandle, InputEmulation, InputEmulationError};
|
||||
use input_event::Event;
|
||||
use lan_mouse_ipc::Status;
|
||||
use lan_mouse_proto::ProtoEvent;
|
||||
use lan_mouse_proto::{Position, ProtoEvent};
|
||||
use local_channel::mpsc::{channel, Receiver, Sender};
|
||||
use std::{
|
||||
collections::HashMap,
|
||||
@@ -44,10 +44,11 @@ impl Emulation {
|
||||
log::trace!("{event} <-<-<-<-<- {addr}");
|
||||
last_response.insert(addr, Instant::now());
|
||||
match event {
|
||||
ProtoEvent::Enter(_) => {
|
||||
ProtoEvent::Enter(pos) => {
|
||||
log::info!("{addr} entered this device");
|
||||
server.release_capture();
|
||||
listener.reply(addr, ProtoEvent::Ack(0)).await;
|
||||
server.register_incoming(addr, to_ipc_pos(pos));
|
||||
}
|
||||
ProtoEvent::Leave(_) => {
|
||||
emulation_proxy.release_keys(addr);
|
||||
@@ -196,3 +197,12 @@ impl EmulationProxy {
|
||||
let _ = (&mut self.task).await;
|
||||
}
|
||||
}
|
||||
|
||||
fn to_ipc_pos(pos: Position) -> lan_mouse_ipc::Position {
|
||||
match pos {
|
||||
Position::Left => lan_mouse_ipc::Position::Left,
|
||||
Position::Right => lan_mouse_ipc::Position::Right,
|
||||
Position::Top => lan_mouse_ipc::Position::Top,
|
||||
Position::Bottom => lan_mouse_ipc::Position::Bottom,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,6 +51,7 @@ pub struct Server {
|
||||
capture_status: Rc<Cell<Status>>,
|
||||
pub(crate) emulation_status: Rc<Cell<Status>>,
|
||||
pub(crate) should_release: Rc<RefCell<Option<ReleaseToken>>>,
|
||||
incoming_conns: Rc<RefCell<Vec<(SocketAddr, Position)>>>,
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
@@ -101,6 +102,7 @@ impl Server {
|
||||
pending_frontend_events: Rc::new(RefCell::new(VecDeque::new())),
|
||||
capture_status: Default::default(),
|
||||
emulation_status: Default::default(),
|
||||
incoming_conns: Rc::new(RefCell::new(Vec::new())),
|
||||
should_release: Default::default(),
|
||||
}
|
||||
}
|
||||
@@ -503,6 +505,10 @@ impl Server {
|
||||
pub(crate) fn get_active(&self) -> Option<ClientHandle> {
|
||||
self.active.get()
|
||||
}
|
||||
|
||||
pub(crate) fn register_incoming(&self, addr: SocketAddr, pos: Position) {
|
||||
self.incoming_conns.borrow_mut().push((addr, pos));
|
||||
}
|
||||
}
|
||||
|
||||
fn to_capture_pos(pos: Position) -> input_capture::Position {
|
||||
|
||||
Reference in New Issue
Block a user