mirror of
https://github.com/VallierDev/uu-remote-linux.git
synced 2026-11-16 16:50:41 +01:00
X11: change the desktop resolution for the viewer's choice; survive live resizes (#86)
* Restart X11 capture at the new size when the desktop is resized mid-stream
A RandR resize during a session made x11grab fail with BadMatch on the old
size. read_encoder treated that as an encoder failure and walked the whole
fallback chain (NVENC -> CPU, HEVC -> H.264) with the stale size, then the
stream stopped ("Encoder output ended") and the viewer froze. New connections
already re-probed the geometry (#18); live ones did not.
- When an X11 stream fails and the root size differs, skip the encoder
fallback and restart capture at the new size with the same settings.
- Absolute pointer mapping follows the refreshed X11 size.
- New connections compare the root size with their capture instead of the
engine's change flag, which a live stream may already have consumed.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
* Change the X11 desktop resolution when the viewer picks one
The official Windows host changes its display resolution for the viewer's
分辨率 choice; this host only scaled the encoded stream, so a smaller choice
made text smaller and blurrier instead of larger.
On X11 the capture/resolution RPC now switches the primary output's mode with
xrandr (an existing mode of that size, else a CVT reduced-blanking mode at
60 Hz, or 30 Hz above an HDMI 2.0 pixel clock), re-applying it when mutter
resets the mode after the list changes. resolution_type 3 (original) and the
end of the last desktop stream restore the mode in use before the first
change. The stream restarts capture at the new native size and reports it in
the screen sources and CaptureSettingSync. UU_DESKTOP_RESIZE=0 keeps the old
encoder scaling; Wayland is unchanged.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
---------
Co-authored-by: VallierDev <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
This commit is contained in:
9 files changed
+297
-12
No files matched your search
+12
-4
@@ -46,14 +46,22 @@ unsafe fn x11_display_name() -> *const libc::c_char { b":0\0".as_ptr().cast() }
|
||||
|
||||
/// The X11 root can be resized while the host runs (RandR, xrdp reconnects); the
|
||||
/// geometry read at startup then makes x11grab reject every new connection.
|
||||
pub fn x11_resized() -> bool {
|
||||
/// Re-reads the root size; None when the X11 engine is not in use or the query fails.
|
||||
pub fn x11_size() -> Option<(u32, u32)> {
|
||||
match unsafe { x11_refresh_geometry() } {
|
||||
1 => true,
|
||||
0 => false,
|
||||
code => { log::warn!("X11 geometry query failed with code {code}"); false }
|
||||
0 | 1 => x11_last_size(),
|
||||
-1 => None,
|
||||
code => { log::warn!("X11 geometry query failed with code {code}"); None }
|
||||
}
|
||||
}
|
||||
|
||||
/// The root size from the last refresh, without an X round trip (pointer mapping).
|
||||
pub fn x11_last_size() -> Option<(u32, u32)> {
|
||||
let (mut w, mut h): (libc::c_int, libc::c_int) = (0, 0);
|
||||
if unsafe { x11_get_dimensions(&mut w, &mut h) } != 0 || w <= 0 || h <= 0 { return None; }
|
||||
Some((w as u32, h as u32))
|
||||
}
|
||||
|
||||
pub struct ScreenCapture {
|
||||
pub backend: crate::desktop_backend::DesktopBackend,
|
||||
pub init_error: Option<String>,
|
||||
|
||||
Reference in new issue
Block a user