diff --git a/src/client/io_loop.rs b/src/client/io_loop.rs index e4e604cde..52042da06 100644 --- a/src/client/io_loop.rs +++ b/src/client/io_loop.rs @@ -28,7 +28,7 @@ use hbb_common::tokio::{ }; use hbb_common::{ allow_err, - message_proto::{self, *}, + message_proto::*, sleep, }; use hbb_common::{fs, log, Stream}; @@ -1185,10 +1185,10 @@ impl Remote { } #[cfg(windows)] - fn handle_cliprdr_msg(&self, clip: message_proto::Cliprdr) { + fn handle_cliprdr_msg(&self, clip: hbb_common::message_proto::Cliprdr) { if !self.handler.lc.read().unwrap().disable_clipboard { #[cfg(any(target_os = "android", target_os = "ios", feature = "flutter"))] - if let Some(message_proto::cliprdr::Union::FormatList(_)) = &clip.union { + if let Some(hbb_common::message_proto::cliprdr::Union::FormatList(_)) = &clip.union { if self.client_conn_id != clipboard::get_client_conn_id(&crate::flutter::get_cur_session_id()) .unwrap_or(0) diff --git a/src/platform/linux.rs b/src/platform/linux.rs index 3a779b577..8c0df67dd 100644 --- a/src/platform/linux.rs +++ b/src/platform/linux.rs @@ -685,9 +685,32 @@ pub fn check_super_user_permission() -> ResultType { Ok(status.success() && status.code() == Some(0)) } +type GtkSettingsPtr = *mut c_void; +type GObjectPtr = *mut c_void; +#[link(name = "gtk-3")] +extern "C" { + // fn gtk_init(argc: *mut c_int, argv: *mut *mut c_char); + fn gtk_settings_get_default() -> GtkSettingsPtr; +} + +#[link(name = "gobject-2.0")] +extern "C" { + fn g_object_get(object: GObjectPtr, first_property_name: *const c_char, ...); +} + pub fn get_double_click_time() -> u32 { - // to-do // GtkSettings *settings = gtk_settings_get_default (); // g_object_get (settings, "gtk-double-click-time", &double_click_time, NULL); - 500 as _ + unsafe { + let mut double_click_time = 0u32; + let property = std::ffi::CString::new("gtk-double-click-time").unwrap(); + let setings = gtk_settings_get_default(); + g_object_get( + setings, + property.as_ptr(), + &mut double_click_time as *mut u32, + 0 as *const libc::c_void, + ); + double_click_time + } }