mirror of
https://github.com/rustdesk/rustdesk.git
synced 2025-06-11 12:43:12 +08:00
feat mouse click and move through monitor widget
Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
parent
2e848061cb
commit
d04f047d14
@ -324,10 +324,8 @@ class QualityMonitor extends StatelessWidget {
|
|||||||
Widget build(BuildContext context) => ChangeNotifierProvider.value(
|
Widget build(BuildContext context) => ChangeNotifierProvider.value(
|
||||||
value: qualityMonitorModel,
|
value: qualityMonitorModel,
|
||||||
child: Consumer<QualityMonitorModel>(
|
child: Consumer<QualityMonitorModel>(
|
||||||
builder: (context, qualityMonitorModel, child) => Positioned(
|
builder: (context, qualityMonitorModel, child) =>
|
||||||
top: 10,
|
qualityMonitorModel.show
|
||||||
right: 10,
|
|
||||||
child: qualityMonitorModel.show
|
|
||||||
? Container(
|
? Container(
|
||||||
padding: const EdgeInsets.all(8),
|
padding: const EdgeInsets.all(8),
|
||||||
color: MyTheme.canvasColor.withAlpha(120),
|
color: MyTheme.canvasColor.withAlpha(120),
|
||||||
@ -357,5 +355,5 @@ class QualityMonitor extends StatelessWidget {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
: const SizedBox.shrink())));
|
: const SizedBox.shrink()));
|
||||||
}
|
}
|
||||||
|
@ -279,6 +279,34 @@ class _RemotePageState extends State<RemotePage>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Widget _buildRawPointerMouseRegion(
|
||||||
|
Widget child,
|
||||||
|
PointerEnterEventListener? onEnter,
|
||||||
|
PointerExitEventListener? onExit,
|
||||||
|
) {
|
||||||
|
return RawPointerMouseRegion(
|
||||||
|
onEnter: enterView,
|
||||||
|
onExit: leaveView,
|
||||||
|
onPointerDown: (event) {
|
||||||
|
// A double check for blur status.
|
||||||
|
// Note: If there's an `onPointerDown` event is triggered, `_isWindowBlur` is expected being false.
|
||||||
|
// Sometimes the system does not send the necessary focus event to flutter. We should manually
|
||||||
|
// handle this inconsistent status by setting `_isWindowBlur` to false. So we can
|
||||||
|
// ensure the grab-key thread is running when our users are clicking the remote canvas.
|
||||||
|
if (_isWindowBlur) {
|
||||||
|
debugPrint(
|
||||||
|
"Unexpected status: onPointerDown is triggered while the remote window is in blur status");
|
||||||
|
_isWindowBlur = false;
|
||||||
|
}
|
||||||
|
if (!_rawKeyFocusNode.hasFocus) {
|
||||||
|
_rawKeyFocusNode.requestFocus();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
inputModel: _ffi.inputModel,
|
||||||
|
child: child,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
Widget getBodyForDesktop(BuildContext context) {
|
Widget getBodyForDesktop(BuildContext context) {
|
||||||
var paints = <Widget>[
|
var paints = <Widget>[
|
||||||
MouseRegion(onEnter: (evt) {
|
MouseRegion(onEnter: (evt) {
|
||||||
@ -295,27 +323,8 @@ class _RemotePageState extends State<RemotePage>
|
|||||||
cursorOverImage: _cursorOverImage,
|
cursorOverImage: _cursorOverImage,
|
||||||
keyboardEnabled: _keyboardEnabled,
|
keyboardEnabled: _keyboardEnabled,
|
||||||
remoteCursorMoved: _remoteCursorMoved,
|
remoteCursorMoved: _remoteCursorMoved,
|
||||||
listenerBuilder: (child) => RawPointerMouseRegion(
|
listenerBuilder: (child) =>
|
||||||
onEnter: enterView,
|
_buildRawPointerMouseRegion(child, enterView, leaveView),
|
||||||
onExit: leaveView,
|
|
||||||
onPointerDown: (event) {
|
|
||||||
// A double check for blur status.
|
|
||||||
// Note: If there's an `onPointerDown` event is triggered, `_isWindowBlur` is expected being false.
|
|
||||||
// Sometimes the system does not send the necessary focus event to flutter. We should manually
|
|
||||||
// handle this inconsistent status by setting `_isWindowBlur` to false. So we can
|
|
||||||
// ensure the grab-key thread is running when our users are clicking the remote canvas.
|
|
||||||
if (_isWindowBlur) {
|
|
||||||
debugPrint(
|
|
||||||
"Unexpected status: onPointerDown is triggered while the remote window is in blur status");
|
|
||||||
_isWindowBlur = false;
|
|
||||||
}
|
|
||||||
if (!_rawKeyFocusNode.hasFocus) {
|
|
||||||
_rawKeyFocusNode.requestFocus();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
inputModel: _ffi.inputModel,
|
|
||||||
child: child,
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}))
|
}))
|
||||||
];
|
];
|
||||||
@ -328,7 +337,14 @@ class _RemotePageState extends State<RemotePage>
|
|||||||
zoomCursor: _zoomCursor,
|
zoomCursor: _zoomCursor,
|
||||||
))));
|
))));
|
||||||
}
|
}
|
||||||
paints.add(QualityMonitor(_ffi.qualityMonitorModel));
|
paints.add(
|
||||||
|
Positioned(
|
||||||
|
top: 10,
|
||||||
|
right: 10,
|
||||||
|
child: _buildRawPointerMouseRegion(
|
||||||
|
QualityMonitor(_ffi.qualityMonitorModel), null, null),
|
||||||
|
),
|
||||||
|
);
|
||||||
paints.add(RemoteMenubar(
|
paints.add(RemoteMenubar(
|
||||||
id: widget.id,
|
id: widget.id,
|
||||||
ffi: _ffi,
|
ffi: _ffi,
|
||||||
|
@ -497,7 +497,11 @@ class _RemotePageState extends State<RemotePage> {
|
|||||||
child: Stack(children: () {
|
child: Stack(children: () {
|
||||||
final paints = [
|
final paints = [
|
||||||
ImagePaint(),
|
ImagePaint(),
|
||||||
QualityMonitor(gFFI.qualityMonitorModel),
|
Positioned(
|
||||||
|
top: 10,
|
||||||
|
right: 10,
|
||||||
|
child: QualityMonitor(gFFI.qualityMonitorModel),
|
||||||
|
),
|
||||||
getHelpTools(),
|
getHelpTools(),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: 0,
|
width: 0,
|
||||||
|
Loading…
Reference in New Issue
Block a user