mirror of
https://github.com/feschber/lan-mouse.git
synced 2026-03-07 11:59:59 +03:00
update dependencies (#302)
* update dependencies * update windows * clippy: inline format args * update flake * update core-graphics * fix poll after completion error * fix ashpd?!
This commit is contained in:
committed by
GitHub
parent
9f10ebcbd2
commit
eb1dcbddb0
@@ -40,21 +40,21 @@ wayland-protocols-wlr = { version = "0.3.1", features = [
|
||||
"client",
|
||||
], optional = true }
|
||||
x11 = { version = "2.21.0", features = ["xlib", "xtest"], optional = true }
|
||||
ashpd = { version = "0.10", default-features = false, features = [
|
||||
ashpd = { version = "0.11.0", default-features = false, features = [
|
||||
"tokio",
|
||||
], optional = true }
|
||||
reis = { version = "0.4", features = ["tokio"], optional = true }
|
||||
reis = { version = "0.5.0", features = ["tokio"], optional = true }
|
||||
|
||||
[target.'cfg(target_os="macos")'.dependencies]
|
||||
core-graphics = { version = "0.24.0", features = ["highsierra"] }
|
||||
core-graphics = { version = "0.25.0", features = ["highsierra"] }
|
||||
core-foundation = "0.10.0"
|
||||
core-foundation-sys = "0.8.6"
|
||||
libc = "0.2.155"
|
||||
keycode = "0.4.0"
|
||||
keycode = "1.0.0"
|
||||
bitflags = "2.6.0"
|
||||
|
||||
[target.'cfg(windows)'.dependencies]
|
||||
windows = { version = "0.58.0", features = [
|
||||
windows = { version = "0.61.2", features = [
|
||||
"Win32_System_LibraryLoader",
|
||||
"Win32_System_Threading",
|
||||
"Win32_Foundation",
|
||||
|
||||
@@ -535,7 +535,7 @@ impl State {
|
||||
fn update_windows(&mut self) {
|
||||
log::info!("active outputs: ");
|
||||
for output in self.outputs.iter().filter(|o| o.info.is_some()) {
|
||||
log::info!(" * {}", output);
|
||||
log::info!(" * {output}");
|
||||
}
|
||||
|
||||
self.active_windows.clear();
|
||||
@@ -582,17 +582,17 @@ impl Inner {
|
||||
match self.queue.dispatch_pending(&mut self.state) {
|
||||
Ok(_) => {}
|
||||
Err(DispatchError::Backend(WaylandError::Io(e))) => {
|
||||
log::error!("Wayland Error: {}", e);
|
||||
log::error!("Wayland Error: {e}");
|
||||
}
|
||||
Err(DispatchError::Backend(e)) => {
|
||||
panic!("backend error: {}", e);
|
||||
panic!("backend error: {e}");
|
||||
}
|
||||
Err(DispatchError::BadMessage {
|
||||
sender_id,
|
||||
interface,
|
||||
opcode,
|
||||
}) => {
|
||||
panic!("bad message {}, {} , {}", sender_id, interface, opcode);
|
||||
panic!("bad message {sender_id}, {interface} , {opcode}");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -974,7 +974,7 @@ impl Dispatch<ZxdgOutputV1, u32> for State {
|
||||
.find(|o| o.global.name == *name)
|
||||
.expect("output");
|
||||
|
||||
log::debug!("xdg_output {name} - {:?}", event);
|
||||
log::debug!("xdg_output {name} - {event:?}");
|
||||
match event {
|
||||
zxdg_output_v1::Event::LogicalPosition { x, y } => {
|
||||
output.pending_info.position = (x, y);
|
||||
@@ -1010,7 +1010,7 @@ impl Dispatch<WlOutput, u32> for State {
|
||||
_conn: &Connection,
|
||||
_qhandle: &QueueHandle<Self>,
|
||||
) {
|
||||
log::debug!("wl_output {name} - {:?}", event);
|
||||
log::debug!("wl_output {name} - {event:?}");
|
||||
if let wl_output::Event::Done = event {
|
||||
state.update_output_info(*name);
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ impl Display for Position {
|
||||
Position::Top => "top",
|
||||
Position::Bottom => "bottom",
|
||||
};
|
||||
write!(f, "{}", pos)
|
||||
write!(f, "{pos}")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -587,9 +587,13 @@ impl LanMouseInputCapture for LibeiInputCapture<'_> {
|
||||
self.cancellation_token.cancel();
|
||||
let task = &mut self.capture_task;
|
||||
log::debug!("waiting for capture to terminate...");
|
||||
let res = task.await.expect("libei task panic");
|
||||
log::debug!("done!");
|
||||
let res = if !task.is_finished() {
|
||||
task.await.expect("libei task panic")
|
||||
} else {
|
||||
Ok(())
|
||||
};
|
||||
self.terminated = true;
|
||||
log::debug!("done!");
|
||||
res
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ use core_graphics::base::{kCGErrorSuccess, CGError};
|
||||
use core_graphics::display::{CGDisplay, CGPoint};
|
||||
use core_graphics::event::{
|
||||
CGEvent, CGEventFlags, CGEventTap, CGEventTapLocation, CGEventTapOptions, CGEventTapPlacement,
|
||||
CGEventTapProxy, CGEventType, EventField,
|
||||
CGEventTapProxy, CGEventType, CallbackResult, EventField,
|
||||
};
|
||||
use core_graphics::event_source::{CGEventSource, CGEventSourceStateID};
|
||||
use futures_core::Stream;
|
||||
@@ -394,11 +394,11 @@ fn create_event_tap<'a>(
|
||||
// may already be closed when the InputCapture instance is dropped.
|
||||
let _ = event_tx.blocking_send((pos, *e));
|
||||
});
|
||||
// Returning None should stop the event from being processed
|
||||
// Returning Drop should stop the event from being processed
|
||||
// but core fundation still returns the event
|
||||
cg_ev.set_type(CGEventType::Null);
|
||||
}
|
||||
Some(cg_ev.to_owned())
|
||||
CallbackResult::Replace(cg_ev.to_owned())
|
||||
};
|
||||
|
||||
let tap = CGEventTap::new(
|
||||
@@ -411,7 +411,7 @@ fn create_event_tap<'a>(
|
||||
.map_err(|_| MacosCaptureCreationError::EventTapCreation)?;
|
||||
|
||||
let tap_source: CFRunLoopSource = tap
|
||||
.mach_port
|
||||
.mach_port()
|
||||
.create_runloop_source(0)
|
||||
.expect("Failed creating loop source");
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ use std::thread;
|
||||
use tokio::sync::mpsc::error::TrySendError;
|
||||
use tokio::sync::mpsc::Sender;
|
||||
use windows::core::{w, PCWSTR};
|
||||
use windows::Win32::Foundation::{FALSE, HINSTANCE, HWND, LPARAM, LRESULT, RECT, WPARAM};
|
||||
use windows::Win32::Foundation::{FALSE, HWND, LPARAM, LRESULT, RECT, WPARAM};
|
||||
use windows::Win32::Graphics::Gdi::{
|
||||
EnumDisplayDevicesW, EnumDisplaySettingsW, DEVMODEW, DISPLAY_DEVICEW,
|
||||
DISPLAY_DEVICE_ATTACHED_TO_DESKTOP, ENUM_CURRENT_SETTINGS,
|
||||
@@ -19,12 +19,12 @@ use windows::Win32::System::Threading::GetCurrentThreadId;
|
||||
|
||||
use windows::Win32::UI::WindowsAndMessaging::{
|
||||
CallNextHookEx, CreateWindowExW, DispatchMessageW, GetMessageW, PostThreadMessageW,
|
||||
RegisterClassW, SetWindowsHookExW, TranslateMessage, EDD_GET_DEVICE_INTERFACE_NAME, HHOOK,
|
||||
HMENU, HOOKPROC, KBDLLHOOKSTRUCT, LLKHF_EXTENDED, MSG, MSLLHOOKSTRUCT, WH_KEYBOARD_LL,
|
||||
WH_MOUSE_LL, WINDOW_STYLE, WM_DISPLAYCHANGE, WM_KEYDOWN, WM_KEYUP, WM_LBUTTONDOWN,
|
||||
WM_LBUTTONUP, WM_MBUTTONDOWN, WM_MBUTTONUP, WM_MOUSEHWHEEL, WM_MOUSEMOVE, WM_MOUSEWHEEL,
|
||||
WM_RBUTTONDOWN, WM_RBUTTONUP, WM_SYSKEYDOWN, WM_SYSKEYUP, WM_USER, WM_XBUTTONDOWN,
|
||||
WM_XBUTTONUP, WNDCLASSW, WNDPROC,
|
||||
RegisterClassW, SetWindowsHookExW, TranslateMessage, EDD_GET_DEVICE_INTERFACE_NAME, HOOKPROC,
|
||||
KBDLLHOOKSTRUCT, LLKHF_EXTENDED, MSG, MSLLHOOKSTRUCT, WH_KEYBOARD_LL, WH_MOUSE_LL,
|
||||
WINDOW_STYLE, WM_DISPLAYCHANGE, WM_KEYDOWN, WM_KEYUP, WM_LBUTTONDOWN, WM_LBUTTONUP,
|
||||
WM_MBUTTONDOWN, WM_MBUTTONUP, WM_MOUSEHWHEEL, WM_MOUSEMOVE, WM_MOUSEWHEEL, WM_RBUTTONDOWN,
|
||||
WM_RBUTTONUP, WM_SYSKEYDOWN, WM_SYSKEYUP, WM_USER, WM_XBUTTONDOWN, WM_XBUTTONUP, WNDCLASSW,
|
||||
WNDPROC,
|
||||
};
|
||||
|
||||
use input_event::{
|
||||
@@ -128,7 +128,7 @@ thread_local! {
|
||||
fn get_msg() -> Option<MSG> {
|
||||
unsafe {
|
||||
let mut msg = std::mem::zeroed();
|
||||
let ret = GetMessageW(addr_of_mut!(msg), HWND::default(), 0, 0);
|
||||
let ret = GetMessageW(addr_of_mut!(msg), None, 0, 0);
|
||||
match ret.0 {
|
||||
0 => None,
|
||||
x if x > 0 => Some(msg),
|
||||
@@ -176,14 +176,15 @@ fn start_routine(
|
||||
|
||||
/* register hooks */
|
||||
unsafe {
|
||||
let _ = SetWindowsHookExW(WH_MOUSE_LL, mouse_proc, HINSTANCE::default(), 0).unwrap();
|
||||
let _ = SetWindowsHookExW(WH_KEYBOARD_LL, kybrd_proc, HINSTANCE::default(), 0).unwrap();
|
||||
let _ = SetWindowsHookExW(WH_MOUSE_LL, mouse_proc, None, 0).unwrap();
|
||||
let _ = SetWindowsHookExW(WH_KEYBOARD_LL, kybrd_proc, None, 0).unwrap();
|
||||
}
|
||||
|
||||
let instance = unsafe { GetModuleHandleW(None).unwrap() };
|
||||
let instance = instance.into();
|
||||
let window_class: WNDCLASSW = WNDCLASSW {
|
||||
lpfnWndProc: window_proc,
|
||||
hInstance: instance.into(),
|
||||
hInstance: instance,
|
||||
lpszClassName: w!("lan-mouse-message-window-class"),
|
||||
..Default::default()
|
||||
};
|
||||
@@ -213,9 +214,9 @@ fn start_routine(
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
HWND::default(),
|
||||
HMENU::default(),
|
||||
instance,
|
||||
None,
|
||||
None,
|
||||
Some(instance),
|
||||
None,
|
||||
)
|
||||
.expect("CreateWindowExW");
|
||||
@@ -312,7 +313,7 @@ unsafe extern "system" fn mouse_proc(ncode: i32, wparam: WPARAM, lparam: LPARAM)
|
||||
|
||||
/* no client was active */
|
||||
if !active {
|
||||
return CallNextHookEx(HHOOK::default(), ncode, wparam, lparam);
|
||||
return CallNextHookEx(None, ncode, wparam, lparam);
|
||||
}
|
||||
|
||||
/* get active client if any */
|
||||
@@ -337,7 +338,7 @@ unsafe extern "system" fn mouse_proc(ncode: i32, wparam: WPARAM, lparam: LPARAM)
|
||||
unsafe extern "system" fn kybrd_proc(ncode: i32, wparam: WPARAM, lparam: LPARAM) -> LRESULT {
|
||||
/* get active client if any */
|
||||
let Some(client) = ACTIVE_CLIENT.get() else {
|
||||
return CallNextHookEx(HHOOK::default(), ncode, wparam, lparam);
|
||||
return CallNextHookEx(None, ncode, wparam, lparam);
|
||||
};
|
||||
|
||||
/* convert to key event */
|
||||
@@ -388,7 +389,10 @@ fn enumerate_displays(display_rects: &mut Vec<RECT>) {
|
||||
if ret == FALSE {
|
||||
break;
|
||||
}
|
||||
if device.StateFlags & DISPLAY_DEVICE_ATTACHED_TO_DESKTOP != 0 {
|
||||
if device
|
||||
.StateFlags
|
||||
.contains(DISPLAY_DEVICE_ATTACHED_TO_DESKTOP)
|
||||
{
|
||||
devices.push(device.DeviceName);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user