Skip to content

An open-source remote desktop application designed for self-hosting, as an alternative to TeamViewer.

fix: win10, border (#10753)

fufesoua039741e5af7
diff --git a/flutter/lib/common.dart b/flutter/lib/common.dart
index 2fde813bc..9252698cf 100644
--- a/flutter/lib/common.dart
+++ b/flutter/lib/common.dart
@@ -2566,6 +2566,8 @@ bool get kUseCompatibleUiMode =>
isWindows &&
const [WindowsTarget.w7].contains(windowsBuildNumber.windowsVersion);
+bool get isWin10 => windowsBuildNumber.windowsVersion == WindowsTarget.w10;
+
class ServerConfig {
late String idServer;
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,
+ ],
+ );
+}
diff --git a/flutter/lib/consts.dart b/flutter/lib/consts.dart
index 95b207826..9b8e45aa4 100644
--- a/flutter/lib/consts.dart
+++ b/flutter/lib/consts.dart
@@ -248,7 +248,7 @@ const kFullScreenEdgeSize = 0.0;
const kMaximizeEdgeSize = 0.0;
// Do not use kWindowResizeEdgeSize directly. Use `windowResizeEdgeSize` in `common.dart` instead.
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 kFrameBorderRadius = 12.0;
const kFrameClipRRectBorderRadius = 12.0;
diff --git a/flutter/lib/desktop/pages/file_manager_tab_page.dart b/flutter/lib/desktop/pages/file_manager_tab_page.dart
index cc77cdd95..525149889 100644
--- a/flutter/lib/desktop/pages/file_manager_tab_page.dart
+++ b/flutter/lib/desktop/pages/file_manager_tab_page.dart
@@ -103,11 +103,13 @@ class _FileManagerTabPageState extends State<FileManagerTabPage> {
));
final tabWidget = isLinux
? buildVirtualWindowFrame(context, child)
- : Container(
- decoration: BoxDecoration(
- border: Border.all(color: MyTheme.color(context).border!)),
- child: child,
- );
+ : workaroundWindowBorder(
+ context,
+ Container(
+ decoration: BoxDecoration(
+ border: Border.all(color: MyTheme.color(context).border!)),
+ child: child,
+ ));
return isMacOS || kUseCompatibleUiMode
? tabWidget
: SubWindowDragToResizeArea(
diff --git a/flutter/lib/desktop/pages/port_forward_tab_page.dart b/flutter/lib/desktop/pages/port_forward_tab_page.dart
index f399f7cab..9d366bcb0 100644
--- a/flutter/lib/desktop/pages/port_forward_tab_page.dart
+++ b/flutter/lib/desktop/pages/port_forward_tab_page.dart
@@ -118,11 +118,13 @@ class _PortForwardTabPageState extends State<PortForwardTabPage> {
backgroundColor: Theme.of(context).colorScheme.background,
body: child),
)
- : Container(
- decoration: BoxDecoration(
- border: Border.all(color: MyTheme.color(context).border!)),
- child: child,
- );
+ : workaroundWindowBorder(
+ context,
+ Container(
+ decoration: BoxDecoration(
+ border: Border.all(color: MyTheme.color(context).border!)),
+ child: child,
+ ));
return isMacOS || kUseCompatibleUiMode
? tabWidget
: Obx(
diff --git a/flutter/lib/desktop/pages/remote_tab_page.dart b/flutter/lib/desktop/pages/remote_tab_page.dart
index efd437e1f..025e530c2 100644
--- a/flutter/lib/desktop/pages/remote_tab_page.dart
+++ b/flutter/lib/desktop/pages/remote_tab_page.dart
@@ -212,14 +212,16 @@ class _ConnectionTabPageState extends State<ConnectionTabPage> {
);
final tabWidget = isLinux
? buildVirtualWindowFrame(context, child)
- : Obx(() => Container(
- decoration: BoxDecoration(
- border: Border.all(
- color: MyTheme.color(context).border!,
- width: stateGlobal.windowBorderWidth.value),
- ),
- child: child,
- ));
+ : workaroundWindowBorder(
+ context,
+ Obx(() => Container(
+ decoration: BoxDecoration(
+ border: Border.all(
+ color: MyTheme.color(context).border!,
+ width: stateGlobal.windowBorderWidth.value),
+ ),
+ child: child,
+ )));
return isMacOS || kUseCompatibleUiMode
? tabWidget
: Obx(() => SubWindowDragToResizeArea(
diff --git a/flutter/lib/desktop/pages/server_page.dart b/flutter/lib/desktop/pages/server_page.dart
index 95d9f2c7c..9a93cb34f 100644
--- a/flutter/lib/desktop/pages/server_page.dart
+++ b/flutter/lib/desktop/pages/server_page.dart
@@ -88,12 +88,14 @@ class _DesktopServerPageState extends State<DesktopServerPage>
);
return isLinux
? buildVirtualWindowFrame(context, body)
- : Container(
- decoration: BoxDecoration(
- border:
- Border.all(color: MyTheme.color(context).border!)),
- child: body,
- );
+ : workaroundWindowBorder(
+ context,
+ Container(
+ decoration: BoxDecoration(
+ border:
+ Border.all(color: MyTheme.color(context).border!)),
+ child: body,
+ ));
},
),
);
diff --git a/flutter/lib/main.dart b/flutter/lib/main.dart
index 5493975fa..b5a0af711 100644
--- a/flutter/lib/main.dart
+++ b/flutter/lib/main.dart
@@ -489,9 +489,10 @@ class _AppState extends State<App> with WidgetsBindingObserver {
child = keyListenerBuilder(context, child);
}
if (isLinux) {
- child = buildVirtualWindowFrame(context, child);
+ return buildVirtualWindowFrame(context, child);
+ } else {
+ return workaroundWindowBorder(context, child);
}
- return child;
},
),
);