# HG changeset patch # User Emmanuel Gil Peyrot # Date 1629999930 -7200 # Node ID 478cf2a7d577c3d91f818c9e4f44e92d4594df0a # Parent d103f7cca0bde8464befd560a6c49d1c886f2cbc Reformat with rustfmt. diff --git a/src/gtk.rs b/src/gtk.rs --- a/src/gtk.rs +++ b/src/gtk.rs @@ -14,18 +14,13 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . +use crate::{state::State, DEFAULT_HEIGHT, DEFAULT_WIDTH}; use gio::prelude::*; use glib::clone; use gtk::prelude::*; - +use input_linux::Key; use std::io::ErrorKind; use std::sync::{Arc, Mutex}; -use input_linux::Key; - -use crate::{ - state::State, - DEFAULT_WIDTH, DEFAULT_HEIGHT, -}; fn build_main_menu(app: >k::Application) { let quit = gio::SimpleAction::new("quit", None); @@ -121,10 +116,8 @@ fn build_ui(app: >k::Application) { .content_height(DEFAULT_HEIGHT) .hexpand(true) .build(); - let gesture_click = gtk::GestureClick::builder() - .build(); - let event_controller = gtk::EventControllerMotion::builder() - .build(); + let gesture_click = gtk::GestureClick::new(); + let event_controller = gtk::EventControllerMotion::new(); let state_weak = Arc::downgrade(&state); drawing_area.connect_resize(move |_, width, height| { let state = state_weak.upgrade().unwrap(); diff --git a/src/main.rs b/src/main.rs --- a/src/main.rs +++ b/src/main.rs @@ -17,8 +17,8 @@ #[cfg(feature = "gui")] mod gtk; mod server; +mod state; mod uinput; -mod state; use std::env::args; @@ -40,7 +40,9 @@ fn main() { args.remove(1) } else { String::from("gui") - }.as_str() { + } + .as_str() + { "gui" => Ui::Gtk, "server" => Ui::Server, name => { diff --git a/src/server.rs b/src/server.rs --- a/src/server.rs +++ b/src/server.rs @@ -14,11 +14,11 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . -use std::net::UdpSocket; -use std::io::{self, ErrorKind}; use crate::state::State; use bitflags::bitflags; use input_linux::Key; +use std::io::{self, ErrorKind}; +use std::net::UdpSocket; bitflags! { /// This is the memory layout of the buttons on the 3DS. diff --git a/src/state.rs b/src/state.rs --- a/src/state.rs +++ b/src/state.rs @@ -14,11 +14,12 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . -use std::fs::File; - +use crate::uinput::{ + create_uinput_device, input_axis_new, input_key_new, input_misc_new, input_synchronize_new, +}; +use crate::{DEFAULT_HEIGHT, DEFAULT_WIDTH, MAX_X, MAX_Y}; use input_linux::{AbsoluteAxis, Key, MiscKind, SynchronizeKind, UInputHandle}; -use crate::{DEFAULT_WIDTH, DEFAULT_HEIGHT, MAX_X, MAX_Y}; -use crate::uinput::{create_uinput_device, input_axis_new, input_misc_new, input_key_new, input_synchronize_new}; +use std::fs::File; pub struct State { dev: UInputHandle, diff --git a/src/uinput.rs b/src/uinput.rs --- a/src/uinput.rs +++ b/src/uinput.rs @@ -14,12 +14,12 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . -use std::fs::{File, OpenOptions}; use crate::{MAX_X, MAX_Y}; use input_linux::{ sys::input_event, sys::timeval, AbsoluteAxis, AbsoluteInfo, AbsoluteInfoSetup, EventKind, InputId, InputProperty, Key, MiscKind, SynchronizeKind, UInputHandle, }; +use std::fs::{File, OpenOptions}; pub fn create_uinput_device() -> std::io::Result> { let file = OpenOptions::new().write(true).open("/dev/uinput")?;