Skip to content

Commit ed1c4aa

Browse files
committed
Fix termux:x11 start & scale
1 parent f2eb3e0 commit ed1c4aa

File tree

7 files changed

+16
-17
lines changed

7 files changed

+16
-17
lines changed

lib/l10n/intl_en.arb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,5 @@
110110
"updateRequest": "Please try to use the latest version. Visit the project address to check for the latest version.",
111111
"avncScreenResize": "Adaptive Screen Size",
112112
"avncResizeFactor": "Screen Scaling Ratio",
113-
"avncResizeFactorValue": "Current scaling is",
114-
"recommendHidpi": "Recommended to enable HiDPI Support simultaneously"
113+
"avncResizeFactorValue": "Current scaling is"
115114
}

lib/l10n/intl_zh.arb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,5 @@
110110
"updateRequest": "请尽量使用最新版本。前往项目地址可查看最新版本。",
111111
"avncScreenResize": "自适应屏幕尺寸",
112112
"avncResizeFactor": "屏幕缩放比",
113-
"avncResizeFactorValue": "当前缩放为",
114-
"recommendHidpi": "推荐同步开启高分辨率支持"
113+
"avncResizeFactorValue": "当前缩放为"
115114
}

lib/l10n/intl_zh_Hant.arb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,5 @@
110110
"updateRequest": "請盡量使用最新版本。前往專案網址查看最新版本。",
111111
"avncScreenResize": "自適應螢幕尺寸",
112112
"avncResizeFactor": "螢幕縮放比",
113-
"avncResizeFactorValue": "目前縮放為",
114-
"recommendHidpi": "推薦同步開啟高解析度支援"
113+
"avncResizeFactorValue": "目前縮放為"
115114
}

lib/main.dart

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,8 @@ class _SettingPageState extends State<SettingPage> {
354354
_avncScaleFactor += value ? 0.5 : -0.5;
355355
_avncScaleFactor = _avncScaleFactor.clamp(-1, 1);
356356
G.prefs.setDouble("avncScaleFactor", _avncScaleFactor);
357+
// Termux:X11 并不是设置缩放比例本身,而是倍率
358+
X11Flutter.setX11ScaleFactor(value ? 0.5 : 2.0);
357359
setState(() {});
358360
},),
359361
const SizedBox.square(dimension: 16),
@@ -463,12 +465,6 @@ sed -i -E "s@^(VNC_RESOLUTION)=.*@\\1=${w}x${h}@" \$(command -v startvnc)""");
463465
if (!value && Util.getGlobal("dri3")) {
464466
G.prefs.setBool("dri3", false);
465467
}
466-
if (value) {
467-
ScaffoldMessenger.of(context).hideCurrentSnackBar();
468-
ScaffoldMessenger.of(context).showSnackBar(
469-
SnackBar(content: Text(AppLocalizations.of(context)!.recommendHidpi))
470-
);
471-
}
472468
setState(() {});
473469
},),
474470
const SizedBox.square(dimension: 16),

lib/workflow.dart

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,10 +212,10 @@ class Util {
212212

213213
while (true) {
214214
bool isReady = await isXServerReady(host, port);
215+
await Future.delayed(Duration(seconds: 1));
215216
if (isReady) {
216217
return;
217218
}
218-
await Future.delayed(Duration(seconds: 1));
219219
}
220220
}
221221

@@ -791,10 +791,14 @@ export PROOT_LOADER=\$DATA_DIR/applib/libproot-loader.so
791791
export PROOT_LOADER_32=\$DATA_DIR/applib/libproot-loader32.so
792792
${Util.getCurrentProp("boot")}
793793
${G.postCommand}
794-
${(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")):""}
795794
clear""");
796795
}
797796

797+
static Future<void> launchGUIBackend() async {
798+
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")):"");
799+
Util.termWrite("clear");
800+
}
801+
798802
static Future<void> waitForConnection() async {
799803
await retry(
800804
// Make a GET request
@@ -853,9 +857,11 @@ clear""");
853857
if (Util.getGlobal("autoLaunchVnc") as bool) {
854858
if (G.wasX11Enabled) {
855859
await Util.waitForXServer();
860+
launchGUIBackend();
856861
launchX11();
857862
return;
858863
}
864+
launchGUIBackend();
859865
waitForConnection().then((value) => G.wasAvncEnabled?launchAvnc():launchBrowser());
860866
}
861867
}

pubspec.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -711,8 +711,8 @@ packages:
711711
dependency: "direct main"
712712
description:
713713
path: "."
714-
ref: ed10bd71a24af6019ce7bccd173ee367546dac2c
715-
resolved-ref: ed10bd71a24af6019ce7bccd173ee367546dac2c
714+
ref: "3b92b515b1ebc32c93e18e8b3a2983656713e4dd"
715+
resolved-ref: "3b92b515b1ebc32c93e18e8b3a2983656713e4dd"
716716
url: "https://github.com/tiny-computer/x11_flutter.git"
717717
source: git
718718
version: "0.0.1"

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ dependencies:
5050
x11_flutter:
5151
git:
5252
url: https://github.com/tiny-computer/x11_flutter.git
53-
ref: ed10bd71a24af6019ce7bccd173ee367546dac2c
53+
ref: 3b92b515b1ebc32c93e18e8b3a2983656713e4dd
5454
avnc_flutter:
5555
git:
5656
url: https://github.com/tiny-computer/avnc_flutter.git

0 commit comments

Comments
 (0)