Skip to content

Commit 1193560

Browse files
committed
Update window.rs
1 parent c75dec1 commit 1193560

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

extension/src/window.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
use arma_rs::Group;
22

3+
#[allow(unused_imports)]
34
use std::sync::Mutex;
5+
#[cfg(target_os = "windows")]
46
use windows::Win32::{
57
Foundation::HWND,
68
System::Threading::GetCurrentProcessId,
@@ -10,10 +12,16 @@ use windows::Win32::{
1012
},
1113
};
1214

15+
#[cfg(not(target_os = "windows"))]
16+
pub fn group() -> Group {
17+
Group::new()
18+
}
19+
#[cfg(target_os = "windows")]
1320
pub fn group() -> Group {
1421
Group::new().command("focus", focus).command("flash", flash)
1522
}
1623

24+
#[cfg(target_os = "windows")]
1725
fn get_window() -> Option<HWND> {
1826
let window_handle: Mutex<Option<HWND>> = Mutex::new(None);
1927

@@ -30,6 +38,7 @@ fn get_window() -> Option<HWND> {
3038
*window_handle.lock().unwrap()
3139
}
3240

41+
#[cfg(target_os = "windows")]
3342
unsafe extern "system" fn enum_window_callback(
3443
hwnd: HWND,
3544
lparam: windows::Win32::Foundation::LPARAM,
@@ -52,6 +61,7 @@ unsafe extern "system" fn enum_window_callback(
5261
1
5362
}
5463

64+
#[cfg(target_os = "windows")]
5565
fn focus() -> Result<(), String> {
5666
if let Some(hwnd) = get_window() {
5767
unsafe {
@@ -65,6 +75,7 @@ fn focus() -> Result<(), String> {
6575
}
6676
}
6777

78+
#[cfg(target_os = "windows")]
6879
fn flash() -> Result<(), String> {
6980
if let Some(hwnd) = get_window() {
7081
let flash_info = FLASHWINFO {

0 commit comments

Comments
 (0)