move closing-tabs to local config, and add glgetstring to stack check

This commit is contained in:
rustdesk 2023-07-30 12:16:00 +08:00
parent 69f1969e60
commit dd4f52b63d
8 changed files with 35 additions and 20 deletions

View File

@ -1282,6 +1282,15 @@ bool mainGetBoolOptionSync(String key) {
return option2bool(key, bind.mainGetOptionSync(key: key)); return option2bool(key, bind.mainGetOptionSync(key: key));
} }
mainSetLocalBoolOption(String key, bool value) async {
String v = bool2option(key, value);
await bind.mainSetLocalOption(key: key, value: v);
}
bool mainGetLocalBoolOptionSync(String key) {
return option2bool(key, bind.mainGetLocalOption(key: key));
}
Future<bool> matchPeer(String searchText, Peer peer) async { Future<bool> matchPeer(String searchText, Peer peer) async {
if (searchText.isEmpty) { if (searchText.isEmpty) {
return true; return true;

View File

@ -314,19 +314,16 @@ class _GeneralState extends State<_General> {
Widget other() { Widget other() {
final children = [ final children = [
_OptionCheckBox(context, 'Confirm before closing multiple tabs', _OptionCheckBox(context, 'Confirm before closing multiple tabs',
'enable-confirm-closing-tabs'), 'enable-confirm-closing-tabs',
isServer: false),
_OptionCheckBox(context, 'Adaptive Bitrate', 'enable-abr') _OptionCheckBox(context, 'Adaptive Bitrate', 'enable-abr')
]; ];
if (Platform.isLinux) { // though this is related to GUI, but opengl problem affects all users, so put in config rather than local
children.add(Tooltip( children.add(Tooltip(
message: translate('software_render_tip'), message: translate('software_render_tip'),
child: _OptionCheckBox( child: _OptionCheckBox(context, "Always use software rendering",
context, 'allow-always-software-render'),
"Always use software rendering", ));
'allow-always-software-render',
),
));
}
if (bind.mainShowOption(key: 'allow-linux-headless')) { if (bind.mainShowOption(key: 'allow-linux-headless')) {
children.add(_OptionCheckBox( children.add(_OptionCheckBox(
context, 'Allow linux headless', 'allow-linux-headless')); context, 'Allow linux headless', 'allow-linux-headless'));
@ -1666,15 +1663,22 @@ Widget _OptionCheckBox(BuildContext context, String label, String key,
bool reverse = false, bool reverse = false,
bool enabled = true, bool enabled = true,
Icon? checkedIcon, Icon? checkedIcon,
bool? fakeValue}) { bool? fakeValue,
bool value = mainGetBoolOptionSync(key); bool isServer = true}) {
bool value =
isServer ? mainGetBoolOptionSync(key) : mainGetLocalBoolOptionSync(key);
if (reverse) value = !value; if (reverse) value = !value;
var ref = value.obs; var ref = value.obs;
onChanged(option) async { onChanged(option) async {
if (option != null) { if (option != null) {
if (reverse) option = !option; if (reverse) option = !option;
await mainSetBoolOption(key, option); isServer
ref.value = mainGetBoolOptionSync(key); ? await mainSetBoolOption(key, option)
: await mainSetLocalBoolOption(key, option);
ref.value = isServer
? mainGetBoolOptionSync(key)
: mainGetLocalBoolOptionSync(key);
;
update?.call(); update?.call();
} }
} }

View File

@ -129,7 +129,7 @@ class _FileManagerTabPageState extends State<FileManagerTabPage> {
} else { } else {
final opt = "enable-confirm-closing-tabs"; final opt = "enable-confirm-closing-tabs";
final bool res; final bool res;
if (!option2bool(opt, await bind.mainGetOption(key: opt))) { if (!option2bool(opt, await bind.mainGetLocalOption(key: opt))) {
res = true; res = true;
} else { } else {
res = await closeConfirmDialog(); res = await closeConfirmDialog();

View File

@ -360,7 +360,7 @@ class _ConnectionTabPageState extends State<ConnectionTabPage> {
} else { } else {
final opt = "enable-confirm-closing-tabs"; final opt = "enable-confirm-closing-tabs";
final bool res; final bool res;
if (!option2bool(opt, await bind.mainGetOption(key: opt))) { if (!option2bool(opt, await bind.mainGetLocalOption(key: opt))) {
res = true; res = true;
} else { } else {
res = await closeConfirmDialog(); res = await closeConfirmDialog();

View File

@ -254,7 +254,7 @@ class ConnectionManagerState extends State<ConnectionManager> {
} else { } else {
final opt = "enable-confirm-closing-tabs"; final opt = "enable-confirm-closing-tabs";
final bool res; final bool res;
if (!option2bool(opt, await bind.mainGetOption(key: opt))) { if (!option2bool(opt, await bind.mainGetLocalOption(key: opt))) {
res = true; res = true;
} else { } else {
res = await closeConfirmDialog(); res = await closeConfirmDialog();

View File

@ -701,7 +701,7 @@ Future<bool> closeConfirmDialog() async {
submit() { submit() {
final opt = "enable-confirm-closing-tabs"; final opt = "enable-confirm-closing-tabs";
String value = bool2option(opt, confirm); String value = bool2option(opt, confirm);
bind.mainSetOption(key: opt, value: value); bind.mainSetLocalOption(key: opt, value: value);
close(true); close(true);
} }

View File

@ -139,7 +139,8 @@ class AbModel {
"data": jsonEncode({"tags": tags, "peers": peersJsonData}) "data": jsonEncode({"tags": tags, "peers": peersJsonData})
}); });
var request = http.Request('POST', Uri.parse(api)); var request = http.Request('POST', Uri.parse(api));
if (licensedDevices > 0) { // support compression
if (licensedDevices > 0 && body.length > 1024) {
authHeaders['Content-Encoding'] = "gzip"; authHeaders['Content-Encoding'] = "gzip";
request.bodyBytes = GZipCodec().encode(utf8.encode(body)); request.bodyBytes = GZipCodec().encode(utf8.encode(body));
} else { } else {

View File

@ -31,6 +31,7 @@ extern "C" fn breakdown_signal_handler(sig: i32) {
s.contains(&"nouveau_pushbuf_kick") s.contains(&"nouveau_pushbuf_kick")
|| s.to_lowercase().contains("nvidia") || s.to_lowercase().contains("nvidia")
|| s.contains("gdk_window_end_draw_frame") || s.contains("gdk_window_end_draw_frame")
|| s.contains("glGetString")
}) { }) {
Config::set_option("allow-always-software-render".to_string(), "Y".to_string()); Config::set_option("allow-always-software-render".to_string(), "Y".to_string());
info = "Always use software rendering will be set.".to_string(); info = "Always use software rendering will be set.".to_string();