11use arma_rs:: Group ;
22
3+ #[ allow( unused_imports) ]
34use std:: sync:: Mutex ;
5+ #[ cfg( target_os = "windows" ) ]
46use 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" ) ]
1320pub fn group ( ) -> Group {
1421 Group :: new ( ) . command ( "focus" , focus) . command ( "flash" , flash)
1522}
1623
24+ #[ cfg( target_os = "windows" ) ]
1725fn 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" ) ]
3342unsafe 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" ) ]
5565fn 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" ) ]
6879fn flash ( ) -> Result < ( ) , String > {
6980 if let Some ( hwnd) = get_window ( ) {
7081 let flash_info = FLASHWINFO {
0 commit comments