mirror of
https://github.com/tauri-apps/global-hotkey.git
synced 2026-01-31 00:45:22 +01:00
5
.changes/no-op.md
Normal file
5
.changes/no-op.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"global-hotkey": "patch"
|
||||
---
|
||||
|
||||
Add no-op implementations for unsupported targets.
|
||||
@@ -63,9 +63,9 @@ use hotkey::HotKey;
|
||||
/// Describes the state of the [`HotKey`].
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
|
||||
pub enum HotKeyState {
|
||||
/// The [`HotKey`] is pressed (the key is down).
|
||||
/// The [`HotKey`] is pressed (the key is down).
|
||||
Pressed,
|
||||
/// The [`HotKey`] is released (the key is up).
|
||||
/// The [`HotKey`] is released (the key is up).
|
||||
Released,
|
||||
}
|
||||
|
||||
|
||||
@@ -5,11 +5,29 @@
|
||||
#[cfg(target_os = "windows")]
|
||||
#[path = "windows/mod.rs"]
|
||||
mod platform;
|
||||
#[cfg(target_os = "linux")]
|
||||
#[cfg(any(
|
||||
target_os = "linux",
|
||||
target_os = "dragonfly",
|
||||
target_os = "freebsd",
|
||||
target_os = "openbsd",
|
||||
target_os = "netbsd"
|
||||
))]
|
||||
#[path = "x11/mod.rs"]
|
||||
mod platform;
|
||||
#[cfg(target_os = "macos")]
|
||||
#[path = "macos/mod.rs"]
|
||||
mod platform;
|
||||
|
||||
#[cfg(not(any(
|
||||
target_os = "windows",
|
||||
target_os = "linux",
|
||||
target_os = "dragonfly",
|
||||
target_os = "freebsd",
|
||||
target_os = "openbsd",
|
||||
target_os = "netbsd",
|
||||
target_os = "macos"
|
||||
)))]
|
||||
#[path = "no-op.rs"]
|
||||
mod platform;
|
||||
|
||||
pub(crate) use self::platform::*;
|
||||
|
||||
38
src/platform_impl/no-op.rs
Normal file
38
src/platform_impl/no-op.rs
Normal file
@@ -0,0 +1,38 @@
|
||||
// Copyright 2022-2022 Tauri Programme within The Commons Conservancy
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// SPDX-License-Identifier: MIT
|
||||
// Copyright 2022-2022 Tauri Programme within The Commons Conservancy
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
use crate::hotkey::HotKey;
|
||||
|
||||
pub struct GlobalHotKeyManager {}
|
||||
|
||||
impl GlobalHotKeyManager {
|
||||
pub fn new() -> crate::Result<Self> {
|
||||
Ok(Self {})
|
||||
}
|
||||
|
||||
pub fn register(&self, hotkey: HotKey) -> crate::Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn unregister(&self, hotkey: HotKey) -> crate::Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn register_all(&self, hotkeys: &[HotKey]) -> crate::Result<()> {
|
||||
for hotkey in hotkeys {
|
||||
self.register(*hotkey)?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn unregister_all(&self, hotkeys: &[HotKey]) -> crate::Result<()> {
|
||||
for hotkey in hotkeys {
|
||||
self.unregister(*hotkey)?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user