plugin_framework, manager, install plugin

Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
fufesou
2023-05-09 19:47:26 +08:00
parent 6f5ff0ac0e
commit db71dd039d
21 changed files with 1078 additions and 372 deletions

View File

@@ -19,7 +19,7 @@ use hbb_common::compress::decompress;
use hbb_common::{
allow_err,
compress::compress as compress_func,
config::{self, Config, COMPRESS_LEVEL, RENDEZVOUS_TIMEOUT},
config::{self, Config, RENDEZVOUS_TIMEOUT},
get_version_number, log,
message_proto::*,
protobuf::Enum,
@@ -68,6 +68,19 @@ lazy_static::lazy_static! {
static ref ARBOARD_MTX: Arc<Mutex<()>> = Arc::new(Mutex::new(()));
}
pub struct SimpleCallOnReturn {
pub b: bool,
pub f: Box<dyn Fn() + 'static>,
}
impl Drop for SimpleCallOnReturn {
fn drop(&mut self) {
if self.b {
(self.f)();
}
}
}
pub fn global_init() -> bool {
#[cfg(target_os = "linux")]
{
@@ -98,7 +111,7 @@ pub fn valid_for_numlock(evt: &KeyEvent) -> bool {
pub fn create_clipboard_msg(content: String) -> Message {
let bytes = content.into_bytes();
let compressed = compress_func(&bytes, COMPRESS_LEVEL);
let compressed = compress_func(&bytes);
let compress = compressed.len() < bytes.len();
let content = if compress { compressed } else { bytes };
let mut msg = Message::new();