Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
rustdesk
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
李朝发
rustdesk
Commits
a9bb7c79
Commit
a9bb7c79
authored
Sep 08, 2022
by
fufesou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
flutter_destkop: fix cursor scale
Signed-off-by:
fufesou
<
shuanglongchen@yeah.net
>
parent
48998ded
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
21 deletions
+31
-21
remote_page.dart
flutter/lib/desktop/pages/remote_page.dart
+21
-13
model.dart
flutter/lib/models/model.dart
+10
-8
No files found.
flutter/lib/desktop/pages/remote_page.dart
View file @
a9bb7c79
...
...
@@ -539,7 +539,7 @@ class ImagePaint extends StatelessWidget {
Widget
build
(
BuildContext
context
)
{
final
m
=
Provider
.
of
<
ImageModel
>(
context
);
var
c
=
Provider
.
of
<
CanvasModel
>(
context
);
final
cursor
=
Provider
.
of
<
CursorModel
>(
context
);
final
s
=
c
.
scale
;
if
(
c
.
scrollStyle
==
ScrollStyle
.
scrollbar
)
{
final
imageWidget
=
SizedBox
(
...
...
@@ -568,18 +568,7 @@ class ImagePaint extends StatelessWidget {
cursor:
(
cursorOverImage
.
isTrue
&&
keyboardEnabled
.
isTrue
)
?
(
remoteCursorMoved
.
isTrue
?
SystemMouseCursors
.
none
:
(
cursor
.
cacheLinux
!=
null
?
FlutterCustomMemoryImageCursor
(
pixbuf:
cursor
.
cacheLinux
!.
data
,
key:
cursor
.
cacheLinux
!.
key
,
hotx:
cursor
.
cacheLinux
!.
hotx
,
hoty:
cursor
.
cacheLinux
!.
hoty
,
imageWidth:
(
cursor
.
cacheLinux
!.
width
*
s
).
toInt
(),
imageHeight:
(
cursor
.
cacheLinux
!.
height
*
s
).
toInt
(),
)
:
MouseCursor
.
defer
))
:
_buildCustomCursorLinux
(
context
,
s
))
:
MouseCursor
.
defer
,
onHover:
(
evt
)
{
pos
.
value
=
evt
.
position
;
...
...
@@ -599,6 +588,25 @@ class ImagePaint extends StatelessWidget {
}
}
MouseCursor
_buildCustomCursorLinux
(
BuildContext
context
,
double
scale
)
{
final
cursor
=
Provider
.
of
<
CursorModel
>(
context
);
final
cacheLinux
=
cursor
.
cacheLinux
;
if
(
cacheLinux
==
null
)
{
return
MouseCursor
.
defer
;
}
else
{
final
key
=
cacheLinux
.
key
(
scale
);
cursor
.
addKeyLinux
(
key
);
return
FlutterCustomMemoryImageCursor
(
pixbuf:
cacheLinux
.
data
,
key:
key
,
hotx:
cacheLinux
.
hotx
,
hoty:
cacheLinux
.
hoty
,
imageWidth:
(
cacheLinux
.
width
*
scale
).
toInt
(),
imageHeight:
(
cacheLinux
.
height
*
scale
).
toInt
(),
);
}
}
Widget
_buildCrossScrollbar
(
Widget
child
)
{
final
physicsVertical
=
cursorOverImage
.
value
?
const
NeverScrollableScrollPhysics
()
:
null
;
...
...
flutter/lib/models/model.dart
View file @
a9bb7c79
...
...
@@ -604,7 +604,6 @@ class CursorData {
final
double
hoty
;
final
int
width
;
final
int
height
;
late
String
key
;
CursorData
({
required
this
.
peerId
,
...
...
@@ -614,10 +613,12 @@ class CursorData {
required
this
.
hoty
,
required
this
.
width
,
required
this
.
height
,
})
{
key
=
'
${peerId}
_
${id}
_
${(hotx * 10e6).round().toInt()}
_
${(hoty * 10e6).round().toInt()}
_
${width}
_
$height
'
;
}
});
int
_doubleToInt
(
double
v
)
=>
(
v
*
10
e6
).
round
().
toInt
();
String
key
(
double
scale
)
=>
'
${peerId}
_
${id}
_
${_doubleToInt(hotx)}
_
${_doubleToInt(hoty)}
_
${_doubleToInt(width * scale)}
_
${_doubleToInt(height * scale)}
'
;
}
class
CursorModel
with
ChangeNotifier
{
...
...
@@ -625,6 +626,7 @@ class CursorModel with ChangeNotifier {
final
_images
=
<
int
,
Tuple3
<
ui
.
Image
,
double
,
double
>>{};
CursorData
?
_cacheLinux
;
final
_cacheMapLinux
=
<
int
,
CursorData
>{};
final
_cacheKeysLinux
=
<
String
>{};
double
_x
=
-
10000
;
double
_y
=
-
10000
;
double
_hotx
=
0
;
...
...
@@ -649,8 +651,8 @@ class CursorModel with ChangeNotifier {
CursorModel
(
this
.
parent
);
List
<
String
>
get
cachedKeysLinux
=>
_cacheMapLinux
.
values
.
map
((
v
)
=>
v
.
key
).
toList
(
);
Set
<
String
>
get
cachedKeysLinux
=>
_cacheKeysLinux
;
addKeyLinux
(
String
key
)
=>
_cacheKeysLinux
.
add
(
key
);
// remote physical display coordinate
Rect
getVisibleRect
()
{
...
...
@@ -878,7 +880,7 @@ class CursorModel with ChangeNotifier {
}
void
_clearCacheLinux
()
{
final
cachedKeys
=
[...
cachedKeysLinux
]
;
final
cachedKeys
=
{...
cachedKeysLinux
}
;
for
(
var
key
in
cachedKeys
)
{
customCursorController
.
freeCache
(
key
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment