mirror of
https://github.com/rustdesk/rustdesk.git
synced 2026-04-04 01:51:29 +03:00
Warn on MIT-SHM not working on Linux X11 (#6856)
* Clarify video capture method * fix improper level of pointer usage of xcb_generic_error_t * add ffi of xcb_shm_query_version * throw a warn about MIT-SHM not working * add missing #[cfg] * checks SHM validity on the fly, rather than cache on creation --------- Co-authored-by: root <root@localhost> Co-authored-by: rustdesk-fork <rustdesk@fork.com>
This commit is contained in:
@@ -87,6 +87,24 @@ impl Server {
|
||||
pub fn setup(&self) -> *const xcb_setup_t {
|
||||
self.setup
|
||||
}
|
||||
pub fn get_shm_status(&self) -> Result<(), Error> {
|
||||
unsafe { check_x11_shm_available(self.raw) }
|
||||
}
|
||||
}
|
||||
|
||||
unsafe fn check_x11_shm_available(c: *mut xcb_connection_t) -> Result<(), Error> {
|
||||
let cookie = xcb_shm_query_version(c);
|
||||
let mut e: *mut xcb_generic_error_t = std::ptr::null_mut();
|
||||
let reply = xcb_shm_query_version_reply(c, cookie, &mut e as _);
|
||||
if reply.is_null() {
|
||||
// TODO: Should seperate SHM disabled from SHM not supported?
|
||||
return Err(Error::UnsupportedExtension);
|
||||
} else if e.is_null() {
|
||||
return Ok(());
|
||||
} else {
|
||||
// TODO: Does "This request does never generate any errors" in manual means `e` is never set, so we would never reach here?
|
||||
return Err(Error::Generic);
|
||||
}
|
||||
}
|
||||
|
||||
impl Drop for Server {
|
||||
|
||||
Reference in New Issue
Block a user