Merge pull request #3875 from fufesou/fix/x11_login_screen

fix x11 login screen
This commit is contained in:
RustDesk 2023-04-01 10:37:16 +08:00 committed by GitHub
commit 1c2c03acb4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 3 deletions

View File

@ -40,6 +40,12 @@ pub fn is_desktop_wayland() -> bool {
get_display_server() == DISPLAY_SERVER_WAYLAND
}
#[inline]
pub fn is_x11_wayland() -> bool {
let ds = get_display_server();
ds == DISPLAY_SERVER_X11 || ds == DISPLAY_SERVER_WAYLAND
}
#[inline]
pub fn is_x11_or_headless() -> bool {
!is_desktop_wayland()

View File

@ -190,12 +190,15 @@ impl<T: Subscriber + From<ConnInner>> ServiceTmpl<T> {
}
#[inline]
fn wait_prelogin(&self) {
fn wait_prelogin_or_x11gdm(&self) {
#[cfg(target_os = "linux")]
while self.active() {
if crate::platform::linux::is_prelogin() {
break;
}
if crate::platform::linux::is_x11_wayland() {
break;
}
thread::sleep(time::Duration::from_millis(300));
}
}
@ -209,7 +212,7 @@ impl<T: Subscriber + From<ConnInner>> ServiceTmpl<T> {
let mut callback = callback;
let sp = self.clone();
let thread = thread::spawn(move || {
sp.wait_prelogin();
sp.wait_prelogin_or_x11gdm();
let mut state = S::default();
let mut may_reset = false;
@ -245,7 +248,7 @@ impl<T: Subscriber + From<ConnInner>> ServiceTmpl<T> {
let sp = self.clone();
let mut callback = callback;
let thread = thread::spawn(move || {
sp.wait_prelogin();
sp.wait_prelogin_or_x11gdm();
let mut error_timeout = HIBERNATE_TIMEOUT;
while sp.active() {