mirror of
https://github.com/rustdesk/rustdesk.git
synced 2026-04-07 06:41:28 +03:00
fix: win10, border (#10753)
Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
@@ -2566,6 +2566,8 @@ bool get kUseCompatibleUiMode =>
|
|||||||
isWindows &&
|
isWindows &&
|
||||||
const [WindowsTarget.w7].contains(windowsBuildNumber.windowsVersion);
|
const [WindowsTarget.w7].contains(windowsBuildNumber.windowsVersion);
|
||||||
|
|
||||||
|
bool get isWin10 => windowsBuildNumber.windowsVersion == WindowsTarget.w10;
|
||||||
|
|
||||||
class ServerConfig {
|
class ServerConfig {
|
||||||
late String idServer;
|
late String idServer;
|
||||||
late String relayServer;
|
late String relayServer;
|
||||||
@@ -3638,3 +3640,59 @@ extension WorkaroundFreezeLinuxMint on Widget {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Don't use `extension` here, the border looks weird if using `extension` in my test.
|
||||||
|
Widget workaroundWindowBorder(BuildContext context, Widget child) {
|
||||||
|
if (!isWin10) {
|
||||||
|
return child;
|
||||||
|
}
|
||||||
|
|
||||||
|
final isLight = Theme.of(context).brightness == Brightness.light;
|
||||||
|
final borderColor = isLight ? Colors.black87 : Colors.grey;
|
||||||
|
final width = isLight ? 0.5 : 0.1;
|
||||||
|
|
||||||
|
getBorderWidget(Widget child) {
|
||||||
|
return Obx(() =>
|
||||||
|
(stateGlobal.isMaximized.isTrue || stateGlobal.fullscreen.isTrue)
|
||||||
|
? Offstage()
|
||||||
|
: child);
|
||||||
|
}
|
||||||
|
|
||||||
|
final List<Widget> borders = [
|
||||||
|
getBorderWidget(Container(
|
||||||
|
color: borderColor,
|
||||||
|
height: width + 0.1,
|
||||||
|
))
|
||||||
|
];
|
||||||
|
if (kWindowType == WindowType.Main && !isLight) {
|
||||||
|
borders.addAll([
|
||||||
|
getBorderWidget(Align(
|
||||||
|
alignment: Alignment.topLeft,
|
||||||
|
child: Container(
|
||||||
|
color: borderColor,
|
||||||
|
width: width,
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
getBorderWidget(Align(
|
||||||
|
alignment: Alignment.topRight,
|
||||||
|
child: Container(
|
||||||
|
color: borderColor,
|
||||||
|
width: width,
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
getBorderWidget(Align(
|
||||||
|
alignment: Alignment.bottomCenter,
|
||||||
|
child: Container(
|
||||||
|
color: borderColor,
|
||||||
|
height: width,
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
return Stack(
|
||||||
|
children: [
|
||||||
|
child,
|
||||||
|
...borders,
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|||||||
@@ -248,7 +248,7 @@ const kFullScreenEdgeSize = 0.0;
|
|||||||
const kMaximizeEdgeSize = 0.0;
|
const kMaximizeEdgeSize = 0.0;
|
||||||
// Do not use kWindowResizeEdgeSize directly. Use `windowResizeEdgeSize` in `common.dart` instead.
|
// Do not use kWindowResizeEdgeSize directly. Use `windowResizeEdgeSize` in `common.dart` instead.
|
||||||
const kWindowResizeEdgeSize = 5.0;
|
const kWindowResizeEdgeSize = 5.0;
|
||||||
const kWindowBorderWidth = 1.0;
|
final kWindowBorderWidth = isWindows ? 0.0 : 1.0;
|
||||||
const kDesktopMenuPadding = EdgeInsets.only(left: 12.0, right: 3.0);
|
const kDesktopMenuPadding = EdgeInsets.only(left: 12.0, right: 3.0);
|
||||||
const kFrameBorderRadius = 12.0;
|
const kFrameBorderRadius = 12.0;
|
||||||
const kFrameClipRRectBorderRadius = 12.0;
|
const kFrameClipRRectBorderRadius = 12.0;
|
||||||
|
|||||||
@@ -103,11 +103,13 @@ class _FileManagerTabPageState extends State<FileManagerTabPage> {
|
|||||||
));
|
));
|
||||||
final tabWidget = isLinux
|
final tabWidget = isLinux
|
||||||
? buildVirtualWindowFrame(context, child)
|
? buildVirtualWindowFrame(context, child)
|
||||||
: Container(
|
: workaroundWindowBorder(
|
||||||
decoration: BoxDecoration(
|
context,
|
||||||
border: Border.all(color: MyTheme.color(context).border!)),
|
Container(
|
||||||
child: child,
|
decoration: BoxDecoration(
|
||||||
);
|
border: Border.all(color: MyTheme.color(context).border!)),
|
||||||
|
child: child,
|
||||||
|
));
|
||||||
return isMacOS || kUseCompatibleUiMode
|
return isMacOS || kUseCompatibleUiMode
|
||||||
? tabWidget
|
? tabWidget
|
||||||
: SubWindowDragToResizeArea(
|
: SubWindowDragToResizeArea(
|
||||||
|
|||||||
@@ -118,11 +118,13 @@ class _PortForwardTabPageState extends State<PortForwardTabPage> {
|
|||||||
backgroundColor: Theme.of(context).colorScheme.background,
|
backgroundColor: Theme.of(context).colorScheme.background,
|
||||||
body: child),
|
body: child),
|
||||||
)
|
)
|
||||||
: Container(
|
: workaroundWindowBorder(
|
||||||
decoration: BoxDecoration(
|
context,
|
||||||
border: Border.all(color: MyTheme.color(context).border!)),
|
Container(
|
||||||
child: child,
|
decoration: BoxDecoration(
|
||||||
);
|
border: Border.all(color: MyTheme.color(context).border!)),
|
||||||
|
child: child,
|
||||||
|
));
|
||||||
return isMacOS || kUseCompatibleUiMode
|
return isMacOS || kUseCompatibleUiMode
|
||||||
? tabWidget
|
? tabWidget
|
||||||
: Obx(
|
: Obx(
|
||||||
|
|||||||
@@ -212,14 +212,16 @@ class _ConnectionTabPageState extends State<ConnectionTabPage> {
|
|||||||
);
|
);
|
||||||
final tabWidget = isLinux
|
final tabWidget = isLinux
|
||||||
? buildVirtualWindowFrame(context, child)
|
? buildVirtualWindowFrame(context, child)
|
||||||
: Obx(() => Container(
|
: workaroundWindowBorder(
|
||||||
decoration: BoxDecoration(
|
context,
|
||||||
border: Border.all(
|
Obx(() => Container(
|
||||||
color: MyTheme.color(context).border!,
|
decoration: BoxDecoration(
|
||||||
width: stateGlobal.windowBorderWidth.value),
|
border: Border.all(
|
||||||
),
|
color: MyTheme.color(context).border!,
|
||||||
child: child,
|
width: stateGlobal.windowBorderWidth.value),
|
||||||
));
|
),
|
||||||
|
child: child,
|
||||||
|
)));
|
||||||
return isMacOS || kUseCompatibleUiMode
|
return isMacOS || kUseCompatibleUiMode
|
||||||
? tabWidget
|
? tabWidget
|
||||||
: Obx(() => SubWindowDragToResizeArea(
|
: Obx(() => SubWindowDragToResizeArea(
|
||||||
|
|||||||
@@ -88,12 +88,14 @@ class _DesktopServerPageState extends State<DesktopServerPage>
|
|||||||
);
|
);
|
||||||
return isLinux
|
return isLinux
|
||||||
? buildVirtualWindowFrame(context, body)
|
? buildVirtualWindowFrame(context, body)
|
||||||
: Container(
|
: workaroundWindowBorder(
|
||||||
decoration: BoxDecoration(
|
context,
|
||||||
border:
|
Container(
|
||||||
Border.all(color: MyTheme.color(context).border!)),
|
decoration: BoxDecoration(
|
||||||
child: body,
|
border:
|
||||||
);
|
Border.all(color: MyTheme.color(context).border!)),
|
||||||
|
child: body,
|
||||||
|
));
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -489,9 +489,10 @@ class _AppState extends State<App> with WidgetsBindingObserver {
|
|||||||
child = keyListenerBuilder(context, child);
|
child = keyListenerBuilder(context, child);
|
||||||
}
|
}
|
||||||
if (isLinux) {
|
if (isLinux) {
|
||||||
child = buildVirtualWindowFrame(context, child);
|
return buildVirtualWindowFrame(context, child);
|
||||||
|
} else {
|
||||||
|
return workaroundWindowBorder(context, child);
|
||||||
}
|
}
|
||||||
return child;
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user