pub struct CuX11Backend {
conn: RustConnection,
root: u32,
has_xfixes: bool,
reverse_keymap: RefCell<Option<ServerKeymap>>,
}Fields§
§conn: RustConnection§root: u32§has_xfixes: bool§reverse_keymap: RefCell<Option<ServerKeymap>>Reverse map of the SERVER keymap, built lazily from GetKeyboardMapping and kept
for this backend’s lifetime — one request (the backend is per-request), so a
setxkbmap switch is seen by the next request.
Implementations§
Source§impl CuX11Backend
impl CuX11Backend
Sourcepub fn connect() -> Result<Self, String>
pub fn connect() -> Result<Self, String>
Connect to the X server named by DISPLAY and negotiate XTEST (required for any
injection). XFixes is optional and only gates cursor compositing in screenshots.
Sourcefn build_reverse_keymap(&self) -> ServerKeymap
fn build_reverse_keymap(&self) -> ServerKeymap
Build the reverse view of the server’s current keymap from GetKeyboardMapping.
Column -> (group, level) convention, as observed on XKB-compat servers (Xvfb/Xorg
under setxkbmap de: keycode 24 = q Q q Q at Greek_OMEGA at): columns 0/1 are
group-1 plain/Shift, columns 2/3 mirror them as core group 2, and columns 4/5
carry group-1 levels 3/4 (AltGr, Shift+AltGr). Columns 4/5 are consulted only
when the map carries a level-3 modifier key to synthesize; columns 2/3 (group 2)
never are.
Sourcefn fake_input(&self, kind: u8, detail: u8, root: u32, x: i16, y: i16)
fn fake_input(&self, kind: u8, detail: u8, root: u32, x: i16, y: i16)
Fire one XTEST fake event and flush so it reaches the server before the action layer’s inter-event pacing sleep, matching the immediacy of real input.
fn root_geometry(&self) -> Result<(u16, u16), String>
Sourcefn sync(&self) -> Result<(), String>
fn sync(&self) -> Result<(), String>
One server round trip, forcing everything already sent on this connection to be processed before the next request is issued (the XSync idiom).
Sourcefn type_with_transient_binds(
&self,
keysyms: &[u32],
seq: &mut dyn FnMut(&HashMap<u32, u32>),
) -> Result<(), String>
fn type_with_transient_binds( &self, keysyms: &[u32], seq: &mut dyn FnMut(&HashMap<u32, u32>), ) -> Result<(), String>
Bind keysyms onto spare keycodes and run seq with the keysym -> keycode map,
choose/bind/inject atomically under a server grab; then, after a settle window,
restore the spares under a second grab. The settle exists because clients
translate a keycode by RE-FETCHING the keymap when they process the bind’s
MappingNotify — a fetch the grab itself blocks — so a restore issued inside the
first grab would be what they read back and every transient key would translate
to nothing (observed with xterm). Once seq has run, every failure is logged and
swallowed so the caller never re-runs the sequence.
Sourcefn restore_transient_binds(
&self,
span_lo: u32,
count: u8,
per: usize,
bound_syms: &[u32],
chosen: &[u32],
) -> Result<(), String>
fn restore_transient_binds( &self, span_lo: u32, count: u8, per: usize, bound_syms: &[u32], chosen: &[u32], ) -> Result<(), String>
Return the transiently bound spares to all-NoSymbol with ONE conditional
ChangeKeyboardMapping under its own grab. The span is re-fetched under that
grab and only spares still carrying OUR content are cleared; a keycode another
client (selkies’ allocator) claimed during the settle window keeps that client’s
content — this restore can never clobber a foreign binding.
Trait Implementations§
Source§impl CuBackend for CuX11Backend
impl CuBackend for CuX11Backend
fn name(&self) -> &'static str
fn fb_size(&self) -> Result<(i32, i32), String>
fn key(&self, scancode: u32, pressed: bool)
fn mouse_move(&self, x: f64, y: f64)
fn scroll(&self, dx: f64, dy: f64)
Source§fn screenshot_png(&self, display: u32) -> Result<Vec<u8>, String>
fn screenshot_png(&self, display: u32) -> Result<Vec<u8>, String>
fn cursor_pos(&self) -> Result<(f64, f64), String>
Source§fn resolve_keysyms(&self, keysyms: &[u32]) -> Vec<(u32, u32)>
fn resolve_keysyms(&self, keysyms: &[u32]) -> Vec<(u32, u32)>
(keycode, shift level)
per input keysym, (0, 0) where the keymap cannot produce it. Level bit 0 = Shift,
bit 1 = AltGr — the order xkb two/four-level key types use. Wayland resolves through
the compositor’s keymap policy (overlay-binding what the base lacks); X11 through
the server’s own GetKeyboardMapping.Source§fn altgr_keycode(&self) -> u32
fn altgr_keycode(&self) -> u32
ISO_Level3_Shift;
the X11 backend overrides it with the level-3 modifier key found in the server’s
keymap (0 = none, in which case resolve_keysyms reports no AltGr levels).Source§fn with_transient_keysyms(
&self,
keysyms: &[u32],
seq: &mut dyn FnMut(&HashMap<u32, u32>),
)
fn with_transient_keysyms( &self, keysyms: &[u32], seq: &mut dyn FnMut(&HashMap<u32, u32>), )
seq with every keysym in keysyms (which resolve_keysyms could not place)
made temporarily typeable, when the backend can arrange that; seq receives
keysym -> keycode for the transient bindings (empty when none could be arranged,
in which case those keysyms simply stay untypeable). Wayland’s resolve_keysyms
already overlay-binds anything the base keymap lacks, so the default runs seq
with no bindings; the X11 backend overrides this with a grab-atomic spare-keycode
remap.Auto Trait Implementations§
impl !Freeze for CuX11Backend
impl !RefUnwindSafe for CuX11Backend
impl !Sync for CuX11Backend
impl Send for CuX11Backend
impl Unpin for CuX11Backend
impl UnsafeUnpin for CuX11Backend
impl UnwindSafe for CuX11Backend
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more