Skip to content

Commit

Permalink
Merge branch 'rustdesk:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangbo8418 authored Jun 30, 2024
2 parents 8cc8fec + 15fa80f commit 307a630
Show file tree
Hide file tree
Showing 9 changed files with 1,299 additions and 1,217 deletions.
2,428 changes: 1,249 additions & 1,179 deletions Cargo.lock

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,10 @@ sys-locale = "0.3"
enigo = { path = "libs/enigo", features = [ "with_serde" ] }
clipboard = { path = "libs/clipboard" }
ctrlc = "3.2"
arboard = { version = "3.4.0", features = ["wayland-data-control"] }
# arboard = { version = "3.4.0", features = ["wayland-data-control"] }
arboard = { git = "https://github.com/rustdesk-org/arboard", features = ["wayland-data-control"] }
clipboard-master = { git = "https://github.com/rustdesk-org/clipboard-master"}

system_shutdown = "4.0"
qrcode-generator = "4.1"

Expand Down
2 changes: 1 addition & 1 deletion libs/hbb_common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ tokio-native-tls ="0.3"
protobuf-codegen = { version = "3.4" }

[target.'cfg(target_os = "windows")'.dependencies]
winapi = { version = "0.3", features = ["winuser", "synchapi", "pdh", "memoryapi"] }
winapi = { version = "0.3", features = ["winuser", "synchapi", "pdh", "memoryapi", "sysinfoapi"] }

[target.'cfg(target_os = "macos")'.dependencies]
osascript = "0.3"
Expand Down
3 changes: 1 addition & 2 deletions libs/hbb_common/src/platform/windows.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use std::{
collections::VecDeque,
os::windows::raw::HANDLE,
sync::{Arc, Mutex},
time::Instant,
};
Expand All @@ -17,7 +16,7 @@ use winapi::{
sysinfoapi::VerSetConditionMask,
winbase::{VerifyVersionInfoW, INFINITE, WAIT_OBJECT_0},
winnt::{
OSVERSIONINFOEXW, VER_BUILDNUMBER, VER_GREATER_EQUAL, VER_MAJORVERSION,
HANDLE, OSVERSIONINFOEXW, VER_BUILDNUMBER, VER_GREATER_EQUAL, VER_MAJORVERSION,
VER_MINORVERSION, VER_SERVICEPACKMAJOR, VER_SERVICEPACKMINOR,
},
},
Expand Down
5 changes: 3 additions & 2 deletions src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,8 @@ const PUBLIC_SERVER: &str = "public";

#[inline]
#[cfg(not(any(target_os = "android", target_os = "ios")))]
pub fn get_old_clipboard_text() -> &'static Arc<Mutex<String>> {
&OLD_CLIPBOARD_TEXT
pub fn get_old_clipboard_text() -> Arc<Mutex<String>> {
OLD_CLIPBOARD_TEXT.clone()
}

#[cfg(not(any(target_os = "android", target_os = "ios")))]
Expand Down Expand Up @@ -736,6 +736,7 @@ impl Client {
break;
}
if !TEXT_CLIPBOARD_STATE.lock().unwrap().is_required {
std::thread::sleep(Duration::from_millis(CLIPBOARD_INTERVAL));
continue;
}

Expand Down
2 changes: 1 addition & 1 deletion src/client/io_loop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1180,7 +1180,7 @@ impl<T: InvokeUiSession> Remote<T> {
Some(message::Union::Clipboard(cb)) => {
if !self.handler.lc.read().unwrap().disable_clipboard.v {
#[cfg(not(any(target_os = "android", target_os = "ios")))]
update_clipboard(cb, Some(&crate::client::get_old_clipboard_text()));
update_clipboard(cb, Some(crate::client::get_old_clipboard_text()));
#[cfg(any(target_os = "android", target_os = "ios"))]
{
let content = if cb.compress {
Expand Down
18 changes: 9 additions & 9 deletions src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ pub fn get_default_sound_input() -> Option<String> {
}

#[cfg(not(any(target_os = "android", target_os = "ios")))]
pub fn update_clipboard(clipboard: Clipboard, old: Option<&Arc<Mutex<String>>>) {
fn update_clipboard_(clipboard: Clipboard, old: Option<Arc<Mutex<String>>>) {
let content = if clipboard.compress {
decompress(&clipboard.content)
} else {
Expand All @@ -378,7 +378,7 @@ pub fn update_clipboard(clipboard: Clipboard, old: Option<&Arc<Mutex<String>>>)
match ClipboardContext::new() {
Ok(mut ctx) => {
let side = if old.is_none() { "host" } else { "client" };
let old = if let Some(old) = old { old } else { &CONTENT };
let old = if let Some(old) = old { old } else { CONTENT.clone() };
*old.lock().unwrap() = content.clone();
let _lock = ARBOARD_MTX.lock().unwrap();
allow_err!(ctx.set_text(content));
Expand All @@ -391,6 +391,13 @@ pub fn update_clipboard(clipboard: Clipboard, old: Option<&Arc<Mutex<String>>>)
}
}

#[cfg(not(any(target_os = "android", target_os = "ios")))]
pub fn update_clipboard(clipboard: Clipboard, old: Option<Arc<Mutex<String>>>) {
std::thread::spawn(move || {
update_clipboard_(clipboard, old);
});
}

#[cfg(feature = "use_rubato")]
pub fn resample_channels(
data: &[f32],
Expand Down Expand Up @@ -1543,13 +1550,6 @@ impl ClipboardContext {
}
}

#[inline]
#[cfg(any(target_os = "windows", target_os = "macos"))]
pub fn get_text(&mut self) -> ResultType<String> {
Ok(self.0.get_text()?)
}

#[cfg(target_os = "linux")]
pub fn get_text(&mut self) -> ResultType<String> {
Ok(self.0.get_text()?)
}
Expand Down
30 changes: 15 additions & 15 deletions src/lang/nl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -612,20 +612,20 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("android_new_voice_call_tip", "Er is een nieuwe spraakoproep ontvangen. Als u het aanvaardt, schakelt de audio over naar spraakcommunicatie."),
("texture_render_tip", "Pas textuurrendering toe om afbeeldingen vloeiender te maken."),
("Use texture rendering", "Textuurrendering gebruiken"),
("Floating window", ""),
("floating_window_tip", ""),
("Keep screen on", ""),
("Never", ""),
("During controlled", ""),
("During service is on", ""),
("Capture screen using DirectX", ""),
("Back", ""),
("Apps", ""),
("Volume up", ""),
("Volume down", ""),
("Power", ""),
("Telegram bot", ""),
("enable-bot-tip", ""),
("enable-bot-desc", ""),
("Floating window", "Zwevend venster"),
("floating_window_tip", "Helpt RustDesk op de achtergrond actief te houden"),
("Keep screen on", "Scherm ingeschakeld laten"),
("Never", "Nooit"),
("During controlled", "Tijdens gecontroleerde"),
("During service is on", "Tijdens actieve service"),
("Capture screen using DirectX", "Scherm opnemen via DirectX"),
("Back", "Terug"),
("Apps", "Apps"),
("Volume up", "Volume verhogen"),
("Volume down", "Volume verlagen"),
("Power", "Stroom"),
("Telegram bot", "Telegram bot"),
("enable-bot-tip", "Als u deze functie inschakelt, kunt u een 2FA-code ontvangen van uw bot. Het kan ook fungeren als een verbindingsmelding."),
("enable-bot-desc", "1, Open een chat met @BotFather.\n2, Verzend het commando \"/newbot\". Als deze stap voltooid is, ontvang je een token.\n3, Start een chat met de nieuw aangemaakte bot. Om hem te activeren stuurt u een bericht dat begint met een schuine streep (\"/\"), bijvoorbeeld \"/hello\".\n"),
].iter().cloned().collect();
}
23 changes: 16 additions & 7 deletions src/tray.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,14 +137,23 @@ pub fn make_tray() -> hbb_common::ResultType<()> {

if let Ok(_event) = tray_channel.try_recv() {
#[cfg(target_os = "windows")]
if _event.click_type == tray_icon::ClickType::Left
|| _event.click_type == tray_icon::ClickType::Double
{
if last_click.elapsed() < std::time::Duration::from_secs(1) {
return;
match _event {
TrayEvent::Click {
button,
button_state,
..
} => {
if button == tray_icon::MouseButton::Left
&& button_state == tray_icon::MouseButtonState::Up
{
if last_click.elapsed() < std::time::Duration::from_secs(1) {
return;
}
open_func();
last_click = std::time::Instant::now();
}
}
open_func();
last_click = std::time::Instant::now();
_ => {}
}
}

Expand Down

0 comments on commit 307a630

Please sign in to comment.