mirror of
https://github.com/feschber/lan-mouse.git
synced 2026-04-02 02:11:28 +03:00
fix a stackoverflow
This commit is contained in:
@@ -5,7 +5,7 @@ use memmap::Mmap;
|
|||||||
use std::{
|
use std::{
|
||||||
fs::File,
|
fs::File,
|
||||||
io::{BufWriter, Write},
|
io::{BufWriter, Write},
|
||||||
os::unix::prelude::{AsRawFd, FromRawFd}, sync::mpsc::SyncSender, rc::Rc,
|
os::unix::prelude::{AsRawFd, FromRawFd}, sync::mpsc::SyncSender, rc::Rc, thread, time::Duration,
|
||||||
};
|
};
|
||||||
|
|
||||||
use wayland_protocols::wp::{
|
use wayland_protocols::wp::{
|
||||||
@@ -35,7 +35,7 @@ use wayland_client::{
|
|||||||
wl_buffer, wl_compositor, wl_keyboard, wl_pointer, wl_region, wl_registry, wl_seat, wl_shm,
|
wl_buffer, wl_compositor, wl_keyboard, wl_pointer, wl_region, wl_registry, wl_seat, wl_shm,
|
||||||
wl_shm_pool, wl_surface,
|
wl_shm_pool, wl_surface,
|
||||||
},
|
},
|
||||||
Connection, Dispatch, QueueHandle, WEnum,
|
Connection, Dispatch, QueueHandle, WEnum, DispatchError, backend::WaylandError,
|
||||||
};
|
};
|
||||||
|
|
||||||
use tempfile;
|
use tempfile;
|
||||||
@@ -179,8 +179,23 @@ pub fn run(
|
|||||||
app.add_client(client.handle, client.pos);
|
app.add_client(client.handle, client.pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let mut i = 0;
|
||||||
while app.running {
|
while app.running {
|
||||||
queue.blocking_dispatch(&mut app).unwrap();
|
match queue.blocking_dispatch(&mut app) {
|
||||||
|
Ok(_) => {
|
||||||
|
eprint!("{}\r", {i+=1; i});
|
||||||
|
},
|
||||||
|
Err(DispatchError::Backend(WaylandError::Io(e))) => {
|
||||||
|
eprintln!("Wayland Error: {}", e);
|
||||||
|
thread::sleep(Duration::from_millis(500));
|
||||||
|
},
|
||||||
|
Err(DispatchError::Backend(e)) => {
|
||||||
|
panic!("{}", e);
|
||||||
|
}
|
||||||
|
Err(DispatchError::BadMessage{ sender_id, interface, opcode }) => {
|
||||||
|
panic!("bad message {}, {} , {}", sender_id, interface, opcode);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -452,7 +467,17 @@ impl Dispatch<ZwlrLayerSurfaceV1, ()> for App {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// delegate wl_registry events to App itself
|
// delegate wl_registry events to App itself
|
||||||
delegate_dispatch!(App: [wl_registry::WlRegistry: GlobalListContents] => App);
|
// delegate_dispatch!(App: [wl_registry::WlRegistry: GlobalListContents] => App);
|
||||||
|
impl Dispatch<wl_registry::WlRegistry, GlobalListContents> for App {
|
||||||
|
fn event(
|
||||||
|
_state: &mut Self,
|
||||||
|
_proxy: &wl_registry::WlRegistry,
|
||||||
|
_event: <wl_registry::WlRegistry as wayland_client::Proxy>::Event,
|
||||||
|
_data: &GlobalListContents,
|
||||||
|
_conn: &Connection,
|
||||||
|
_qhandle: &QueueHandle<Self>,
|
||||||
|
) {}
|
||||||
|
}
|
||||||
|
|
||||||
// don't emit any events
|
// don't emit any events
|
||||||
delegate_noop!(App: wl_region::WlRegion);
|
delegate_noop!(App: wl_region::WlRegion);
|
||||||
|
|||||||
Reference in New Issue
Block a user