fix can't use mouse on remote multi screen

This commit is contained in:
csf 2022-09-29 18:56:47 +08:00
parent cae2c2942e
commit 1d04eda6f5
2 changed files with 15 additions and 12 deletions

View File

@ -314,7 +314,7 @@ class _RemotePageState extends State<RemotePage> {
icon: Icon(Icons.tv),
onPressed: () {
setState(() => _showEdit = false);
showOptions(widget.id, gFFI.dialogManager);
showOptions(context, widget.id, gFFI.dialogManager);
},
)
] +
@ -446,8 +446,9 @@ class _RemotePageState extends State<RemotePage> {
gFFI.cursorModel.move(d.localPosition.dx, d.localPosition.dy);
inputModel.sendMouse('down', MouseButtons.left);
} else {
final cursorX = gFFI.cursorModel.x;
final cursorY = gFFI.cursorModel.y;
final offset = gFFI.cursorModel.offset;
final cursorX = offset.dx;
final cursorY = offset.dy;
final visible =
gFFI.cursorModel.getVisibleRect().inflate(1); // extend edges
final size = MediaQueryData.fromWindow(ui.window).size;
@ -873,7 +874,8 @@ class ImagePainter extends CustomPainter {
}
}
void showOptions(String id, OverlayDialogManager dialogManager) async {
void showOptions(
BuildContext context, String id, OverlayDialogManager dialogManager) async {
String quality = await bind.sessionGetImageQuality(id: id) ?? 'balanced';
if (quality == '') quality = 'balanced';
String codec =
@ -902,12 +904,16 @@ void showOptions(String id, OverlayDialogManager dialogManager) async {
width: 40,
height: 40,
decoration: BoxDecoration(
border: Border.all(color: Colors.black87),
color: i == cur ? Colors.black87 : Colors.white),
border: Border.all(color: Theme.of(context).hintColor),
borderRadius: BorderRadius.circular(2),
color: i == cur
? Theme.of(context).toggleableActiveColor.withOpacity(0.6)
: null),
child: Center(
child: Text((i + 1).toString(),
style: TextStyle(
color: i == cur ? Colors.white : Colors.black87))))));
color: i == cur ? Colors.white : Colors.black87,
fontWeight: FontWeight.bold))))));
}
displays.add(Padding(
padding: const EdgeInsets.only(top: 8),

View File

@ -110,11 +110,11 @@ class InputModel {
RawKeyEventDataLinux newData = e.data as RawKeyEventDataLinux;
scanCode = newData.scanCode;
keyCode = newData.keyCode;
} else if (e.data is RawKeyEventDataAndroid){
} else if (e.data is RawKeyEventDataAndroid) {
RawKeyEventDataAndroid newData = e.data as RawKeyEventDataAndroid;
scanCode = newData.scanCode + 8;
keyCode = newData.keyCode;
}else {
} else {
scanCode = -1;
keyCode = -1;
}
@ -357,9 +357,6 @@ class InputModel {
x = 0;
y = 0;
}
// fix mouse out of bounds
x = min(max(0.0, x), d.width.toDouble());
y = min(max(0.0, y), d.height.toDouble());
evt['x'] = '${x.round()}';
evt['y'] = '${y.round()}';
var buttons = '';