fix mouse jumping: query GDK pointer position at call time
Flutter's globalPosition is window-relative, not screen-absolute. Now using gdk_device_get_position() on the native side to get the actual screen coordinates at the moment startDrag/startResize is called. Dart no longer passes coordinates — the native handler queries the pointer directly. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -17,24 +17,17 @@ class WindowControls extends ChangeNotifier {
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
Future<void> startResize(ResizeEdge edge, Offset screenPosition) async {
|
||||
Future<void> startResize(ResizeEdge edge) async {
|
||||
try {
|
||||
await _channel.invokeMethod('startResize', {
|
||||
'edge': edge.index,
|
||||
'x': screenPosition.dx.round(),
|
||||
'y': screenPosition.dy.round(),
|
||||
});
|
||||
await _channel.invokeMethod('startResize', edge.index);
|
||||
} on MissingPluginException {
|
||||
// no-op
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> startDrag(Offset screenPosition) async {
|
||||
Future<void> startDrag() async {
|
||||
try {
|
||||
await _channel.invokeMethod('startDrag', {
|
||||
'x': screenPosition.dx.round(),
|
||||
'y': screenPosition.dy.round(),
|
||||
});
|
||||
await _channel.invokeMethod('startDrag');
|
||||
} on MissingPluginException {
|
||||
// no-op
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user