Merge pull request #3007 from fufesou/fix/cursor_pos_after_switch_monitor
try fix https://github.com/rustdesk/rustdesk/issues/2923
This commit is contained in:
		
						commit
						4e69b4f2f4
					
				@ -379,9 +379,15 @@ class _RemoteMenubarState extends State<RemoteMenubar> {
 | 
				
			|||||||
          mod_menu.PopupMenuItem<String>(
 | 
					          mod_menu.PopupMenuItem<String>(
 | 
				
			||||||
            height: _MenubarTheme.height,
 | 
					            height: _MenubarTheme.height,
 | 
				
			||||||
            padding: EdgeInsets.zero,
 | 
					            padding: EdgeInsets.zero,
 | 
				
			||||||
 | 
					            child: Listener(
 | 
				
			||||||
 | 
					              onPointerHover: (PointerHoverEvent e) =>
 | 
				
			||||||
 | 
					                  widget.ffi.inputModel.lastMousePos = e.position,
 | 
				
			||||||
 | 
					              child: MouseRegion(
 | 
				
			||||||
                child: Row(
 | 
					                child: Row(
 | 
				
			||||||
                    mainAxisAlignment: MainAxisAlignment.center,
 | 
					                    mainAxisAlignment: MainAxisAlignment.center,
 | 
				
			||||||
                    children: rowChildren),
 | 
					                    children: rowChildren),
 | 
				
			||||||
 | 
					              ),
 | 
				
			||||||
 | 
					            ),
 | 
				
			||||||
          )
 | 
					          )
 | 
				
			||||||
        ];
 | 
					        ];
 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
 | 
				
			|||||||
@ -408,6 +408,13 @@ class InputModel {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  void refreshMousePos() => handleMouse({
 | 
				
			||||||
 | 
					        'x': lastMousePos.dx,
 | 
				
			||||||
 | 
					        'y': lastMousePos.dy,
 | 
				
			||||||
 | 
					        'buttons': 0,
 | 
				
			||||||
 | 
					        'type': _kMouseEventMove,
 | 
				
			||||||
 | 
					      });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  void handleMouse(Map<String, dynamic> evt) {
 | 
					  void handleMouse(Map<String, dynamic> evt) {
 | 
				
			||||||
    double x = evt['x'];
 | 
					    double x = evt['x'];
 | 
				
			||||||
    double y = max(0.0, evt['y']);
 | 
					    double y = max(0.0, evt['y']);
 | 
				
			||||||
 | 
				
			|||||||
@ -244,6 +244,7 @@ class FfiModel with ChangeNotifier {
 | 
				
			|||||||
      parent.target?.canvasModel.updateViewStyle();
 | 
					      parent.target?.canvasModel.updateViewStyle();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    parent.target?.recordingModel.onSwitchDisplay();
 | 
					    parent.target?.recordingModel.onSwitchDisplay();
 | 
				
			||||||
 | 
					    parent.target?.inputModel.refreshMousePos();
 | 
				
			||||||
    notifyListeners();
 | 
					    notifyListeners();
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user