mirror of
https://github.com/weyne85/rustdesk.git
synced 2025-10-29 17:00:05 +00:00
resolution, mid commit, to debug
Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
@@ -1211,6 +1211,14 @@ impl<T: InvokeUiSession> Remote<T> {
|
||||
s.cursor_embedded,
|
||||
);
|
||||
}
|
||||
let custom_resolution = if s.width != s.original_resolution.width
|
||||
|| s.height != s.original_resolution.height
|
||||
{
|
||||
Some((s.width, s.height))
|
||||
} else {
|
||||
None
|
||||
};
|
||||
self.handler.set_custom_resolution(custom_resolution);
|
||||
}
|
||||
Some(misc::Union::CloseReason(c)) => {
|
||||
self.handler.msgbox("error", "Connection Error", &c, "");
|
||||
|
||||
@@ -286,6 +286,8 @@ impl FlutterHandler {
|
||||
h.insert("width", d.width);
|
||||
h.insert("height", d.height);
|
||||
h.insert("cursor_embedded", if d.cursor_embedded { 1 } else { 0 });
|
||||
h.insert("original_width", d.original_resolution.width);
|
||||
h.insert("original_height", d.original_resolution.height);
|
||||
msg_vec.push(h);
|
||||
}
|
||||
serde_json::ser::to_string(&msg_vec).unwrap_or("".to_owned())
|
||||
@@ -618,6 +620,14 @@ impl InvokeUiSession for FlutterHandler {
|
||||
.to_string(),
|
||||
),
|
||||
("resolutions", &resolutions),
|
||||
(
|
||||
"original_width",
|
||||
&display.original_resolution.width.to_string(),
|
||||
),
|
||||
(
|
||||
"original_height",
|
||||
&display.original_resolution.height.to_string(),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
@@ -880,6 +880,18 @@ pub fn main_handle_relay_id(id: String) -> String {
|
||||
handle_relay_id(id)
|
||||
}
|
||||
|
||||
pub fn main_get_current_display() -> SyncReturn<String> {
|
||||
let display_info = match crate::video_service::get_current_display() {
|
||||
Ok((_, _, display)) => serde_json::to_string(&HashMap::from([
|
||||
("w", display.width()),
|
||||
("h", display.height()),
|
||||
]))
|
||||
.unwrap_or_default(),
|
||||
Err(..) => "".to_string(),
|
||||
};
|
||||
SyncReturn(display_info)
|
||||
}
|
||||
|
||||
pub fn session_add_port_forward(
|
||||
id: String,
|
||||
local_port: i32,
|
||||
@@ -1426,10 +1438,10 @@ pub fn plugin_event(_id: String, _peer: String, _event: Vec<u8>) {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn plugin_register_event_stream(id: String, event2ui: StreamSink<EventToUI>) {
|
||||
pub fn plugin_register_event_stream(_id: String, _event2ui: StreamSink<EventToUI>) {
|
||||
#[cfg(feature = "plugin_framework")]
|
||||
{
|
||||
crate::plugin::native_handlers::session::session_register_event_stream(id, event2ui);
|
||||
crate::plugin::native_handlers::session::session_register_event_stream(_id, _event2ui);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1577,16 +1589,16 @@ pub fn plugin_list_reload() {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn plugin_install(id: String, b: bool) {
|
||||
pub fn plugin_install(_id: String, _b: bool) {
|
||||
#[cfg(feature = "plugin_framework")]
|
||||
#[cfg(not(any(target_os = "android", target_os = "ios")))]
|
||||
{
|
||||
if b {
|
||||
if _b {
|
||||
if let Err(e) = crate::plugin::install_plugin(&id) {
|
||||
log::error!("Failed to install plugin '{}': {}", id, e);
|
||||
}
|
||||
} else {
|
||||
crate::plugin::uninstall_plugin(&id, true);
|
||||
crate::plugin::uninstall_plugin(&_id, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -829,11 +829,12 @@ impl<T: InvokeUiSession> Session<T> {
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn set_custom_resolution(&mut self, wh: Option<(i32, i32)>) {
|
||||
self.lc.write().unwrap().set_custom_resolution(wh);
|
||||
}
|
||||
|
||||
pub fn change_resolution(&self, width: i32, height: i32) {
|
||||
self.lc
|
||||
.write()
|
||||
.unwrap()
|
||||
.set_custom_resolution(Some((width, height)));
|
||||
let mut misc = Misc::new();
|
||||
misc.set_change_resolution(Resolution {
|
||||
width,
|
||||
|
||||
Reference in New Issue
Block a user