fix build linux

Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
fufesou 2023-02-19 12:52:41 +08:00
parent 626fdefb18
commit 8852d97efc
4 changed files with 9 additions and 10 deletions

View File

@ -1,10 +1,9 @@
use super::{CursorData, ResultType};
use hbb_common::libc::{c_char, c_int, c_long, c_void};
pub use hbb_common::platform::linux::*;
use hbb_common::{allow_err, bail, log};
use hbb_common::libc::{c_char, c_int, c_void};
use std::{
cell::RefCell,
collections::HashMap,
path::PathBuf,
sync::{
atomic::{AtomicBool, Ordering},
@ -54,8 +53,8 @@ pub struct xcb_xfixes_get_cursor_image {
pub height: u16,
pub xhot: u16,
pub yhot: u16,
pub cursor_serial: libc::c_long,
pub pixels: *const libc::c_long,
pub cursor_serial: c_long,
pub pixels: *const c_long,
}
pub fn get_cursor_pos() -> Option<(i32, i32)> {
@ -637,7 +636,7 @@ pub fn get_double_click_time() -> u32 {
settings,
property.as_ptr(),
&mut double_click_time as *mut u32,
0 as *const libc::c_void,
0 as *const c_void,
);
double_click_time
}

View File

@ -2,7 +2,7 @@ use core::slice;
use hbb_common::{
allow_err,
anyhow::anyhow,
bail, log,
bail, libc, log,
message_proto::{KeyEvent, MouseEvent},
protobuf::Message,
tokio::{self, sync::mpsc},
@ -492,7 +492,7 @@ pub mod client {
let mut option = SHMEM.lock().unwrap();
let shmem = option.as_mut().unwrap();
unsafe {
hbb_common::libc::memset(shmem.as_ptr() as _, 0, shmem.len() as _);
libc::memset(shmem.as_ptr() as _, 0, shmem.len() as _);
}
drop(option);
match para {

View File

@ -1,4 +1,4 @@
#[cfg(any(target_os = "windows"))]
#[cfg(target_os = "windows")]
use super::ui_interface::get_option_opt;
#[cfg(target_os = "windows")]
use std::sync::{Arc, Mutex};
@ -80,7 +80,7 @@ pub fn start_tray() {
/// Check if service is stoped.
/// Return [`true`] if service is stoped, [`false`] otherwise.
#[inline]
#[cfg(any(target_os = "windows"))]
#[cfg(target_os = "windows")]
fn is_service_stopped() -> bool {
if let Some(v) = get_option_opt("stop-service") {
v == "Y"

View File

@ -128,7 +128,7 @@ pub fn get_license() -> String {
}
#[inline]
#[cfg(any(target_os = "linux", target_os = "windows"))]
#[cfg(target_os = "windows")]
pub fn get_option_opt(key: &str) -> Option<String> {
OPTIONS.lock().unwrap().get(key).map(|x| x.clone())
}