Merge pull request #6575 from fufesou/fix/android_switch_display

fix, android switch display. Remove old display video subscription.
This commit is contained in:
RustDesk 2023-11-30 16:32:06 +08:00 committed by GitHub
commit 83b74c0930
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 32 additions and 17 deletions

View File

@ -2703,7 +2703,10 @@ openMonitorInTheSameTab(int i, FFI ffi, PeerInfo pi) {
? List.generate(pi.displays.length, (index) => index)
: [i];
bind.sessionSwitchDisplay(
sessionId: ffi.sessionId, value: Int32List.fromList(displays));
isDesktop: isDesktop,
sessionId: ffi.sessionId,
value: Int32List.fromList(displays),
);
ffi.ffiModel.switchToNewDisplay(i, ffi.sessionId, ffi.id);
}

View File

@ -395,8 +395,10 @@ class FfiModel with ChangeNotifier {
msgBox(sessionId, 'custom-nook-nocancel-hasclose-info', 'Prompt',
'elevated_switch_display_msg', '', parent.target!.dialogManager);
bind.sessionSwitchDisplay(
isDesktop: isDesktop,
sessionId: sessionId,
value: Int32List.fromList([pi.primaryDisplay]));
value: Int32List.fromList([pi.primaryDisplay]),
);
}
}
}
@ -788,7 +790,10 @@ class FfiModel with ChangeNotifier {
// move to the first display and set fullscreen
bind.sessionSwitchDisplay(
sessionId: sessionId, value: Int32List.fromList([0]));
isDesktop: isDesktop,
sessionId: sessionId,
value: Int32List.fromList([0]),
);
_pi.currentDisplay = 0;
try {
CurrentDisplayState.find(peerId).value = _pi.currentDisplay;
@ -899,7 +904,10 @@ class FfiModel with ChangeNotifier {
: pi.primaryDisplay;
final displays = newDisplay;
bind.sessionSwitchDisplay(
sessionId: sessionId, value: Int32List.fromList([displays]));
isDesktop: isDesktop,
sessionId: sessionId,
value: Int32List.fromList([displays]),
);
if (_pi.isSupportMultiUiSession) {
// If the peer supports multi-ui-session, no switch display message will be send back.

View File

@ -1509,7 +1509,7 @@ pub mod sessions {
}
}
pub fn session_switch_display(session_id: SessionID, value: Vec<i32>) {
pub fn session_switch_display(is_desktop: bool, session_id: SessionID, value: Vec<i32>) {
for s in SESSIONS.read().unwrap().values() {
let read_lock = s.ui_handler.session_handlers.read().unwrap();
if read_lock.contains_key(&session_id) {
@ -1519,6 +1519,9 @@ pub mod sessions {
// The switch display message will contain `SupportedResolutions`, which is useful when changing resolutions.
s.switch_display(value[0]);
if !is_desktop {
s.capture_displays(vec![], vec![], value);
} else {
// Check if other displays are needed.
#[cfg(feature = "flutter_texture_render")]
if value.len() == 1 {
@ -1529,6 +1532,7 @@ pub mod sessions {
&read_lock,
);
}
}
} else {
// Try capture all displays.
s.capture_displays(vec![], vec![], value);

View File

@ -439,8 +439,8 @@ pub fn session_ctrl_alt_del(session_id: SessionID) {
}
}
pub fn session_switch_display(session_id: SessionID, value: Vec<i32>) {
sessions::session_switch_display(session_id, value);
pub fn session_switch_display(is_desktop: bool, session_id: SessionID, value: Vec<i32>) {
sessions::session_switch_display(is_desktop, session_id, value);
}
pub fn session_handle_flutter_key_event(