mirror of
https://github.com/yuezk/GlobalProtect-openconnect.git
synced 2026-11-18 22:16:18 -05:00
chore: update dependencies
This commit is contained in:
8 files changed
+1198
-1491
No files matched your search
@@ -58,7 +58,7 @@ async fn gateway_login_with_options(
|
||||
|
||||
// It's possible to get an empty response, log the response headers for debugging
|
||||
if res.trim().is_empty() {
|
||||
debug!("Empty gateway login response headers: {:?}", res);
|
||||
info!("Empty gateway login response headers: {:?}", res);
|
||||
bail!("Got empty gateway login response");
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
use std::collections::HashMap;
|
||||
use std::env;
|
||||
use std::ffi::OsStr;
|
||||
use std::io::Write;
|
||||
use std::path::Path;
|
||||
|
||||
@@ -41,6 +42,15 @@ pub fn patch_gui_runtime_env(hidpi: bool) {
|
||||
// This is to avoid blank screen on some systems
|
||||
unsafe { std::env::set_var("WEBKIT_DISABLE_COMPOSITING_MODE", "1") };
|
||||
|
||||
if is_wayland_session(
|
||||
env::var_os("WAYLAND_DISPLAY").as_deref(),
|
||||
env::var("XDG_SESSION_TYPE").ok().as_deref(),
|
||||
) {
|
||||
info!("Wayland session detected, enabling Linux WebKit rendering fallbacks");
|
||||
set_env_if_missing("WEBKIT_DISABLE_DMABUF_RENDERER", "1");
|
||||
set_env_if_missing("LIBGL_ALWAYS_SOFTWARE", "1");
|
||||
}
|
||||
|
||||
if hidpi {
|
||||
info!("Setting GDK_SCALE=2 and GDK_DPI_SCALE=0.5");
|
||||
unsafe {
|
||||
@@ -49,3 +59,44 @@ pub fn patch_gui_runtime_env(hidpi: bool) {
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
fn is_wayland_session(wayland_display: Option<&OsStr>, xdg_session_type: Option<&str>) -> bool {
|
||||
if wayland_display.is_some() {
|
||||
return true;
|
||||
}
|
||||
|
||||
matches!(xdg_session_type, Some("wayland"))
|
||||
}
|
||||
|
||||
fn set_env_if_missing(key: &str, value: &str) {
|
||||
if env::var_os(key).is_some() {
|
||||
return;
|
||||
}
|
||||
|
||||
info!("Setting {}={}", key, value);
|
||||
unsafe { env::set_var(key, value) };
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use std::ffi::OsStr;
|
||||
|
||||
use super::is_wayland_session;
|
||||
|
||||
#[test]
|
||||
fn detects_wayland_from_wayland_display() {
|
||||
assert!(is_wayland_session(Some(OsStr::new("wayland-1")), None));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn detects_wayland_from_session_type() {
|
||||
assert!(is_wayland_session(None, Some("wayland")));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn ignores_non_wayland_sessions() {
|
||||
assert!(!is_wayland_session(None, None));
|
||||
assert!(!is_wayland_session(None, Some("x11")));
|
||||
assert!(!is_wayland_session(None, Some("tty")));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user