diff --git a/lib/l10n/intl_en.arb b/lib/l10n/intl_en.arb index f0e7104..a7603ea 100644 --- a/lib/l10n/intl_en.arb +++ b/lib/l10n/intl_en.arb @@ -110,6 +110,5 @@ "updateRequest": "Please try to use the latest version. Visit the project address to check for the latest version.", "avncScreenResize": "Adaptive Screen Size", "avncResizeFactor": "Screen Scaling Ratio", - "avncResizeFactorValue": "Current scaling is", - "recommendHidpi": "Recommended to enable HiDPI Support simultaneously" + "avncResizeFactorValue": "Current scaling is" } \ No newline at end of file diff --git a/lib/l10n/intl_zh.arb b/lib/l10n/intl_zh.arb index dc6980b..3760265 100644 --- a/lib/l10n/intl_zh.arb +++ b/lib/l10n/intl_zh.arb @@ -110,6 +110,5 @@ "updateRequest": "请尽量使用最新版本。前往项目地址可查看最新版本。", "avncScreenResize": "自适应屏幕尺寸", "avncResizeFactor": "屏幕缩放比", - "avncResizeFactorValue": "当前缩放为", - "recommendHidpi": "推荐同步开启高分辨率支持" + "avncResizeFactorValue": "当前缩放为" } \ No newline at end of file diff --git a/lib/l10n/intl_zh_Hant.arb b/lib/l10n/intl_zh_Hant.arb index 0966ce7..309d76f 100644 --- a/lib/l10n/intl_zh_Hant.arb +++ b/lib/l10n/intl_zh_Hant.arb @@ -110,6 +110,5 @@ "updateRequest": "請盡量使用最新版本。前往專案網址查看最新版本。", "avncScreenResize": "自適應螢幕尺寸", "avncResizeFactor": "螢幕縮放比", - "avncResizeFactorValue": "目前縮放為", - "recommendHidpi": "推薦同步開啟高解析度支援" + "avncResizeFactorValue": "目前縮放為" } diff --git a/lib/main.dart b/lib/main.dart index 2a4d8f3..61893c7 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -354,6 +354,8 @@ class _SettingPageState extends State { _avncScaleFactor += value ? 0.5 : -0.5; _avncScaleFactor = _avncScaleFactor.clamp(-1, 1); G.prefs.setDouble("avncScaleFactor", _avncScaleFactor); + // Termux:X11 并不是设置缩放比例本身,而是倍率 + X11Flutter.setX11ScaleFactor(value ? 0.5 : 2.0); setState(() {}); },), const SizedBox.square(dimension: 16), @@ -463,12 +465,6 @@ sed -i -E "s@^(VNC_RESOLUTION)=.*@\\1=${w}x${h}@" \$(command -v startvnc)"""); if (!value && Util.getGlobal("dri3")) { G.prefs.setBool("dri3", false); } - if (value) { - ScaffoldMessenger.of(context).hideCurrentSnackBar(); - ScaffoldMessenger.of(context).showSnackBar( - SnackBar(content: Text(AppLocalizations.of(context)!.recommendHidpi)) - ); - } setState(() {}); },), const SizedBox.square(dimension: 16), diff --git a/lib/workflow.dart b/lib/workflow.dart index 9ed41a6..513749c 100644 --- a/lib/workflow.dart +++ b/lib/workflow.dart @@ -212,10 +212,10 @@ class Util { while (true) { bool isReady = await isXServerReady(host, port); + await Future.delayed(Duration(seconds: 1)); if (isReady) { return; } - await Future.delayed(Duration(seconds: 1)); } } @@ -791,10 +791,14 @@ export PROOT_LOADER=\$DATA_DIR/applib/libproot-loader.so export PROOT_LOADER_32=\$DATA_DIR/applib/libproot-loader32.so ${Util.getCurrentProp("boot")} ${G.postCommand} -${(Util.getGlobal("autoLaunchVnc") as bool)?((Util.getGlobal("useX11") as bool)?"""mkdir -p "\$HOME/.vnc" && bash /etc/X11/xinit/Xsession &> "\$HOME/.vnc/x.log" &""":Util.getCurrentProp("vnc")):""} clear"""); } + static Future launchGUIBackend() async { + Util.termWrite((Util.getGlobal("autoLaunchVnc") as bool)?((Util.getGlobal("useX11") as bool)?"""mkdir -p "\$HOME/.vnc" && bash /etc/X11/xinit/Xsession &> "\$HOME/.vnc/x.log" &""":Util.getCurrentProp("vnc")):""); + Util.termWrite("clear"); + } + static Future waitForConnection() async { await retry( // Make a GET request @@ -853,9 +857,11 @@ clear"""); if (Util.getGlobal("autoLaunchVnc") as bool) { if (G.wasX11Enabled) { await Util.waitForXServer(); + launchGUIBackend(); launchX11(); return; } + launchGUIBackend(); waitForConnection().then((value) => G.wasAvncEnabled?launchAvnc():launchBrowser()); } } diff --git a/pubspec.lock b/pubspec.lock index 590057a..3e6bce4 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -711,8 +711,8 @@ packages: dependency: "direct main" description: path: "." - ref: ed10bd71a24af6019ce7bccd173ee367546dac2c - resolved-ref: ed10bd71a24af6019ce7bccd173ee367546dac2c + ref: "3b92b515b1ebc32c93e18e8b3a2983656713e4dd" + resolved-ref: "3b92b515b1ebc32c93e18e8b3a2983656713e4dd" url: "https://github.com/tiny-computer/x11_flutter.git" source: git version: "0.0.1" diff --git a/pubspec.yaml b/pubspec.yaml index 479431d..b3fe268 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -50,7 +50,7 @@ dependencies: x11_flutter: git: url: https://github.com/tiny-computer/x11_flutter.git - ref: ed10bd71a24af6019ce7bccd173ee367546dac2c + ref: 3b92b515b1ebc32c93e18e8b3a2983656713e4dd avnc_flutter: git: url: https://github.com/tiny-computer/avnc_flutter.git