mirror of
https://github.com/weyne85/rustdesk.git
synced 2025-10-29 17:00:05 +00:00
Fix. Do not update cursor pos when switching display on toolbar when 'Show monitors on toolbar'
Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
@@ -415,18 +415,21 @@ class FfiModel with ChangeNotifier {
|
||||
}
|
||||
}
|
||||
|
||||
updateCurDisplay(SessionID sessionId) {
|
||||
updateCurDisplay(SessionID sessionId, {updateCursorPos = true}) {
|
||||
final newRect = displaysRect();
|
||||
if (newRect == null) {
|
||||
return;
|
||||
}
|
||||
if (newRect != _rect) {
|
||||
if (newRect.left != _rect?.left || newRect.top != _rect?.top) {
|
||||
parent.target?.cursorModel
|
||||
.updateDisplayOrigin(newRect.left, newRect.top);
|
||||
if (updateCursorPos) {
|
||||
if (newRect.left != _rect?.left || newRect.top != _rect?.top) {
|
||||
parent.target?.cursorModel
|
||||
.updateDisplayOrigin(newRect.left, newRect.top);
|
||||
}
|
||||
}
|
||||
_rect = newRect;
|
||||
parent.target?.canvasModel.updateViewStyle();
|
||||
parent.target?.canvasModel
|
||||
.updateViewStyle(refreshMousePos: updateCursorPos);
|
||||
_updateSessionWidthHeight(sessionId);
|
||||
}
|
||||
}
|
||||
@@ -912,7 +915,7 @@ class FfiModel with ChangeNotifier {
|
||||
if (_pi.isSupportMultiUiSession) {
|
||||
// If the peer supports multi-ui-session, no switch display message will be send back.
|
||||
// We need to update the display manually.
|
||||
switchToNewDisplay(newDisplay, sessionId, peerId);
|
||||
switchToNewDisplay(newDisplay, sessionId, peerId, true);
|
||||
}
|
||||
} else {
|
||||
msgBox(sessionId, 'nocancel-error', 'Prompt', 'No Displays', '',
|
||||
@@ -952,12 +955,17 @@ class FfiModel with ChangeNotifier {
|
||||
}
|
||||
|
||||
// Directly switch to the new display without waiting for the response.
|
||||
switchToNewDisplay(int display, SessionID sessionId, String peerId) {
|
||||
switchToNewDisplay(
|
||||
int display,
|
||||
SessionID sessionId,
|
||||
String peerId,
|
||||
bool updateCursorPos,
|
||||
) {
|
||||
// VideoHandler creation is upon when video frames are received, so either caching commands(don't know next width/height) or stopping recording when switching displays.
|
||||
parent.target?.recordingModel.onClose();
|
||||
// no need to wait for the response
|
||||
pi.currentDisplay = display;
|
||||
updateCurDisplay(sessionId);
|
||||
updateCurDisplay(sessionId, updateCursorPos: updateCursorPos);
|
||||
try {
|
||||
CurrentDisplayState.find(peerId).value = display;
|
||||
} catch (e) {
|
||||
@@ -1242,7 +1250,7 @@ class CanvasModel with ChangeNotifier {
|
||||
? windowBorderWidth + kDragToResizeAreaPadding.bottom
|
||||
: 0;
|
||||
|
||||
updateViewStyle() async {
|
||||
updateViewStyle({refreshMousePos = true}) async {
|
||||
Size getSize() {
|
||||
final size = MediaQueryData.fromWindow(ui.window).size;
|
||||
// If minimized, w or h may be negative here.
|
||||
@@ -1283,7 +1291,9 @@ class CanvasModel with ChangeNotifier {
|
||||
_y = (size.height - displayHeight * _scale) / 2;
|
||||
_imageOverflow.value = _x < 0 || y < 0;
|
||||
notifyListeners();
|
||||
parent.target?.inputModel.refreshMousePos();
|
||||
if (refreshMousePos) {
|
||||
parent.target?.inputModel.refreshMousePos();
|
||||
}
|
||||
}
|
||||
|
||||
updateScrollStyle() async {
|
||||
|
||||
Reference in New Issue
Block a user