Merge branch 'rustdesk:master' into master
This commit is contained in:
		
						commit
						e9586fc8fb
					
				| @ -33,8 +33,6 @@ const int kMobileMaxDisplayHeight = 1280; | ||||
| const int kDesktopMaxDisplayWidth = 1920; | ||||
| const int kDesktopMaxDisplayHeight = 1080; | ||||
| 
 | ||||
| const int kDesktopDoubleClickTimeMilli = 200; | ||||
| 
 | ||||
| const Size kConnectionManagerWindowSize = Size(300, 400); | ||||
| // Tabbar transition duration, now we remove the duration | ||||
| const Duration kTabTransitionDuration = Duration.zero; | ||||
|  | ||||
| @ -57,7 +57,8 @@ class _FileManagerPageState extends State<FileManagerPage> | ||||
|   final _breadCrumbScrollerRemote = ScrollController(); | ||||
| 
 | ||||
|   /// [_lastClickTime], [_lastClickEntry] help to handle double click | ||||
|   int _lastClickTime = DateTime.now().millisecondsSinceEpoch; | ||||
|   int _lastClickTime = | ||||
|       DateTime.now().millisecondsSinceEpoch - bind.getDoubleClickTime() - 1000; | ||||
|   Entry? _lastClickEntry; | ||||
| 
 | ||||
|   final _dropMaskVisible = false.obs; // TODO impl drop mask | ||||
| @ -404,7 +405,7 @@ class _FileManagerPageState extends State<FileManagerPage> | ||||
|     final elapsed = current - _lastClickTime; | ||||
|     _lastClickTime = current; | ||||
|     if (_lastClickEntry == entry) { | ||||
|       if (elapsed < kDesktopDoubleClickTimeMilli) { | ||||
|       if (elapsed < bind.getDoubleClickTime()) { | ||||
|         return true; | ||||
|       } | ||||
|     } else { | ||||
|  | ||||
| @ -178,7 +178,7 @@ typedef LabelGetter = Rx<String> Function(String key); | ||||
| 
 | ||||
| /// [_lastClickTime], help to handle double click | ||||
| int _lastClickTime = | ||||
|     DateTime.now().millisecondsSinceEpoch - kDesktopDoubleClickTimeMilli - 1000; | ||||
|     DateTime.now().millisecondsSinceEpoch - bind.getDoubleClickTime() - 1000; | ||||
| 
 | ||||
| class DesktopTab extends StatelessWidget { | ||||
|   final bool showLogo; | ||||
| @ -311,7 +311,7 @@ class DesktopTab extends StatelessWidget { | ||||
|                         final current = DateTime.now().millisecondsSinceEpoch; | ||||
|                         final elapsed = current - _lastClickTime; | ||||
|                         _lastClickTime = current; | ||||
|                         if (elapsed < kDesktopDoubleClickTimeMilli) { | ||||
|                         if (elapsed < bind.getDoubleClickTime()) { | ||||
|                           // onDoubleTap | ||||
|                           toggleMaximize(isMainWindow) | ||||
|                               .then((value) => isMaximized.value = value); | ||||
|  | ||||
| @ -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<T: InvokeUiSession> Remote<T> { | ||||
|     } | ||||
| 
 | ||||
|     #[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) | ||||
|  | ||||
| @ -804,8 +804,8 @@ pub fn main_is_root() -> bool { | ||||
|     is_root() | ||||
| } | ||||
| 
 | ||||
| pub fn main_is_release() -> bool { | ||||
|     is_release() | ||||
| pub fn get_double_click_time() -> SyncReturn<i32> { | ||||
|     SyncReturn(crate::platform::get_double_click_time() as _) | ||||
| } | ||||
| 
 | ||||
| pub fn main_start_dbus_server() { | ||||
|  | ||||
| @ -684,3 +684,33 @@ pub fn check_super_user_permission() -> ResultType<bool> { | ||||
|     let status = std::process::Command::new("pkexec").arg(arg).status()?; | ||||
|     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 { | ||||
|     // GtkSettings *settings = gtk_settings_get_default ();
 | ||||
|     // g_object_get (settings, "gtk-double-click-time", &double_click_time, NULL);
 | ||||
|     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 | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -537,3 +537,9 @@ pub fn quit_gui() { | ||||
|         let () = msg_send!(NSApp(), terminate: nil); | ||||
|     }; | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| pub fn get_double_click_time() -> u32 { | ||||
|     // to-do: https://github.com/servo/core-foundation-rs/blob/786895643140fa0ee4f913d7b4aeb0c4626b2085/cocoa/src/appkit.rs#L2823
 | ||||
|     500 as _ | ||||
| } | ||||
|  | ||||
| @ -1632,3 +1632,7 @@ pub fn is_foreground_window_elevated() -> ResultType<bool> { | ||||
| fn get_current_pid() -> u32 { | ||||
|     unsafe { GetCurrentProcessId() } | ||||
| } | ||||
| 
 | ||||
| pub fn get_double_click_time() -> u32 { | ||||
|     unsafe { GetDoubleClickTime() } | ||||
| } | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user