diff --git a/config.toml b/config.toml index 4862d2f..18f7f28 100644 --- a/config.toml +++ b/config.toml @@ -1,6 +1,6 @@ [client.left] -host_name = "iridium" -ip = "192.168.178.141" +host_name = "rubinium" +ip = "192.168.2.182" port = 42069 [client.right] diff --git a/src/bin/client.rs b/src/bin/client.rs index ed4ee91..7ce3fe6 100644 --- a/src/bin/client.rs +++ b/src/bin/client.rs @@ -114,10 +114,10 @@ fn udp_loop(connection: &protocol::Connection, pointer: &Vp, keyboard: &Vk, q: E loop { if let Some(event) = connection.receive_event() { match event { - protocol::Event::Mouse { t, x, y } => { pointer.motion(t, x, y); } - protocol::Event::Button { t, b, s } => { pointer.button(t, b, s); } - protocol::Event::Axis { t, a, v } => { pointer.axis(t, a, v); } - protocol::Event::Key { t, k, s } => { keyboard.key(t, k, u32::from(s)); }, + protocol::Event::Mouse { t, x, y } => { pointer.motion(t, x, y); pointer.frame(); } + protocol::Event::Button { t, b, s } => { pointer.button(t, b, s); pointer.frame(); } + protocol::Event::Axis { t, a, v } => { pointer.axis(t, a, v); pointer.frame(); } + protocol::Event::Key { t, k, s } => { keyboard.key(t, k, u32::from(s)); pointer.frame(); }, protocol::Event::KeyModifier { mods_depressed, mods_latched, mods_locked, group } => { keyboard.modifiers(mods_depressed, mods_latched, mods_locked, group); }, diff --git a/src/bin/server.rs b/src/bin/server.rs index eda4b85..5deefb4 100644 --- a/src/bin/server.rs +++ b/src/bin/server.rs @@ -105,24 +105,6 @@ fn draw(f: &mut File, (width, height): (u32, u32)) { } } -impl App { - - - fn send_motion_event(&self, time: u32, x: f64, y: f64) { - let e = protocol::Event::Mouse { t: (time), x: (x), y: (y) }; - self.connection.send_event(&e); - } - - fn send_button_event(&self, t: u32, b: u32, s: ButtonState) { - let e = protocol::Event::Button { t, b, s }; - self.connection.send_event(&e); - } - fn send_axis_event(&self, t: u32, a: Axis, v: f64) { - let e = protocol::Event::Axis { t, a, v }; - self.connection.send_event(&e); - } -} - impl Dispatch for App { fn event( app: &mut Self, @@ -375,10 +357,12 @@ impl Dispatch for App { } } wl_pointer::Event::Button { serial:_, time, button, state } => { - app.send_button_event(time, button, state.into_result().unwrap()); + let e = protocol::Event::Button { t: (time), b: button, s: (state.into_result().unwrap()) }; + app.connection.send_event(&e); } wl_pointer::Event::Axis { time, axis, value } => { - app.send_axis_event(time, axis.into_result().unwrap(), value); + let e = protocol::Event::Axis { t: time, a: (axis.into_result().unwrap()), v: value }; + app.connection.send_event(&e); } _ => (), } @@ -482,7 +466,8 @@ impl Dispatch for App { dy_unaccel, } = event { let time = ((utime_hi as u64) << 32 | utime_lo as u64) / 1000; - app.send_motion_event(time as u32, dx_unaccel, dy_unaccel); + let e = protocol::Event::Mouse { t: (time as u32), x: (dx_unaccel), y: (dy_unaccel) }; + app.connection.send_event(&e); } } }