mirror of
https://github.com/rustdesk/rustdesk.git
synced 2026-09-14 00:11:01 +03:00
fix(cursor): keep the Windows minimum in logical pixels
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
import 'dart:math' as math;
|
||||||
|
|
||||||
import 'package:flutter_custom_cursor/cursor_manager.dart'
|
import 'package:flutter_custom_cursor/cursor_manager.dart'
|
||||||
as custom_cursor_manager;
|
as custom_cursor_manager;
|
||||||
@@ -29,7 +30,11 @@ MouseCursor buildCursorOfCache(
|
|||||||
// the proportions of thin remote cursors when normalizing their DPI.
|
// the proportions of thin remote cursors when normalizing their DPI.
|
||||||
final legacyMinimum = cache.pixelRatio == 0 ||
|
final legacyMinimum = cache.pixelRatio == 0 ||
|
||||||
cursor.parent.target?.canvasModel.viewStyle.style == kRemoteViewStyleOriginal;
|
cursor.parent.target?.canvasModel.viewStyle.style == kRemoteViewStyleOriginal;
|
||||||
final key = '${cache.updateGetKey(scale, resizeImage: false, useLegacyMinimum: legacyMinimum)}_$dpr';
|
// The minimum is logical, while Windows callers pass a physical scale.
|
||||||
|
final effectiveScale = !legacyMinimum && isWindows
|
||||||
|
? math.max(scale, kMinCursorSize * dpr / math.max(cache.width, cache.height))
|
||||||
|
: scale;
|
||||||
|
final key = '${cache.updateGetKey(effectiveScale, resizeImage: false, useLegacyMinimum: legacyMinimum)}_$dpr';
|
||||||
if (!cursor.cachedKeys.contains(key)) {
|
if (!cursor.cachedKeys.contains(key)) {
|
||||||
debugPrint(
|
debugPrint(
|
||||||
"Register custom cursor with key $key (${cache.hotx},${cache.hoty})");
|
"Register custom cursor with key $key (${cache.hotx},${cache.hoty})");
|
||||||
|
|||||||
@@ -123,8 +123,8 @@ void main() {
|
|||||||
(kRemoteViewStyleAdaptive, false, 1, 0.25, Platform.isWindows ? 2.0 : 1.0),
|
(kRemoteViewStyleAdaptive, false, 1, 0.25, Platform.isWindows ? 2.0 : 1.0),
|
||||||
(kRemoteViewStyleAdaptive, false, 2, 0.25, Platform.isWindows ? 1.0 : 0.5),
|
(kRemoteViewStyleAdaptive, false, 2, 0.25, Platform.isWindows ? 1.0 : 0.5),
|
||||||
(kRemoteViewStyleCustom, false, 2, 0.25, Platform.isWindows ? 1.0 : 0.5),
|
(kRemoteViewStyleCustom, false, 2, 0.25, Platform.isWindows ? 1.0 : 0.5),
|
||||||
(kRemoteViewStyleAdaptive, true, 2, 0.25, 1 / 3),
|
(kRemoteViewStyleAdaptive, true, 2, 0.25, Platform.isWindows ? 2 / 3 : 1 / 3),
|
||||||
(kRemoteViewStyleCustom, true, 2, 0.25, 1 / 3),
|
(kRemoteViewStyleCustom, true, 2, 0.25, Platform.isWindows ? 2 / 3 : 1 / 3),
|
||||||
(kRemoteViewStyleOriginal, false, 2, 0.5, Platform.isWindows ? 1.0 : 2 / 3),
|
(kRemoteViewStyleOriginal, false, 2, 0.5, Platform.isWindows ? 1.0 : 2 / 3),
|
||||||
]) {
|
]) {
|
||||||
testWidgets(
|
testWidgets(
|
||||||
|
|||||||
Reference in New Issue
Block a user