mirror of
https://github.com/rustdesk/rustdesk.git
synced 2025-05-11 10:26:19 +02:00
enable retina scale factor (#7269)
* enable retina scale factor * enabled only when there are only one video service running * scale mouse event * scale cursor position * scale remote menu display button * adjust resolution Signed-off-by: 21pages <pages21@163.com> * Update server.rs --------- Signed-off-by: 21pages <pages21@163.com> Co-authored-by: RustDesk <71636191+rustdesk@users.noreply.github.com>
This commit is contained in:
parent
96792bec78
commit
50d080d098
11 changed files with 210 additions and 26 deletions
|
@ -759,15 +759,18 @@ class _MonitorMenu extends StatelessWidget {
|
|||
final children = <Widget>[];
|
||||
for (var i = 0; i < pi.displays.length; i++) {
|
||||
final d = pi.displays[i];
|
||||
final fontSize = (d.width * scale < d.height * scale
|
||||
? d.width * scale
|
||||
: d.height * scale) *
|
||||
double s = d.scale;
|
||||
int dWidth = d.width.toDouble() ~/ s;
|
||||
int dHeight = d.height.toDouble() ~/ s;
|
||||
final fontSize = (dWidth * scale < dHeight * scale
|
||||
? dWidth * scale
|
||||
: dHeight * scale) *
|
||||
0.65;
|
||||
children.add(Positioned(
|
||||
left: (d.x - rect.left) * scale + startX,
|
||||
top: (d.y - rect.top) * scale + startY,
|
||||
width: d.width * scale,
|
||||
height: d.height * scale,
|
||||
width: dWidth * scale,
|
||||
height: dHeight * scale,
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(
|
||||
|
@ -1287,7 +1290,9 @@ class _ResolutionsMenuState extends State<_ResolutionsMenu> {
|
|||
if (lastGroupValue == _kCustomResolutionValue) {
|
||||
_groupValue = _kCustomResolutionValue;
|
||||
} else {
|
||||
_groupValue = '${rect?.width.toInt()}x${rect?.height.toInt()}';
|
||||
var scale = pi.scaleOfDisplay(pi.currentDisplay);
|
||||
_groupValue =
|
||||
'${(rect?.width ?? 0) ~/ scale}x${(rect?.height ?? 0) ~/ scale}';
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1386,6 +1391,11 @@ class _ResolutionsMenuState extends State<_ResolutionsMenu> {
|
|||
if (display == null) {
|
||||
return Offstage();
|
||||
}
|
||||
if (!resolutions.any((e) =>
|
||||
e.width == display.originalWidth &&
|
||||
e.height == display.originalHeight)) {
|
||||
return Offstage();
|
||||
}
|
||||
return Offstage(
|
||||
offstage: !showOriginalBtn,
|
||||
child: MenuButton(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue