@@ -6,13 +6,13 @@ use futures_executor::ThreadPool;
66use smithay:: backend:: input:: KeyState ;
77use std:: collections:: HashMap ;
88use std:: collections:: HashSet ;
9+ use std:: sync:: OnceLock ;
910use std:: sync:: { Arc , Mutex } ;
1011use std:: { error:: Error , future:: pending} ;
1112use xkbcommon:: xkb:: { self , Keysym } ;
1213use zbus:: message:: Header ;
1314use zbus:: names:: UniqueName ;
1415use zbus:: SignalContext ;
15- use std:: sync:: OnceLock ;
1616
1717// As defined in at-spi2-core
1818const ATSPI_DEVICE_A11Y_MANAGER_VIRTUAL_MOD_START : u32 = 15 ;
@@ -85,7 +85,6 @@ impl A11yKeyboardMonitorState {
8585 modifiers : & smithay:: input:: keyboard:: ModifiersState ,
8686 keysym : & smithay:: input:: keyboard:: KeysymHandle ,
8787 state : smithay:: backend:: input:: KeyState ,
88- unichar : char ,
8988 ) {
9089 let Some ( conn) = self . conn . get ( ) else {
9190 return ;
@@ -108,14 +107,15 @@ impl A11yKeyboardMonitorState {
108107 KeyState :: Pressed => false ,
109108 KeyState :: Released => true ,
110109 } ;
111- // XXX keysym and keycode?
112110 // XXX need to add virtual modifiers?
111+ let xkb = keysym. xkb ( ) . lock ( ) . unwrap ( ) ;
112+ let unichar = unsafe { xkb. state ( ) } . key_get_utf32 ( keysym. raw_code ( ) ) ;
113113 let future = KeyboardMonitor :: key_event (
114114 signal_context,
115115 released,
116116 modifiers. serialized . depressed ,
117117 keysym. modified_sym ( ) . raw ( ) ,
118- unichar as u32 ,
118+ unichar,
119119 keysym. raw_code ( ) . raw ( ) as u16 ,
120120 ) ;
121121 self . executor . spawn_ok ( async {
@@ -220,10 +220,8 @@ impl KeyboardMonitor {
220220#[ derive( Debug ) ]
221221struct Modifiers ( u32 ) ;
222222
223- async fn serve (
224- clients : Arc < Mutex < Clients > > ,
225- ) -> zbus:: Result < zbus:: Connection > {
226- let keyboard_monitor = KeyboardMonitor { clients} ;
223+ async fn serve ( clients : Arc < Mutex < Clients > > ) -> zbus:: Result < zbus:: Connection > {
224+ let keyboard_monitor = KeyboardMonitor { clients } ;
227225 zbus:: connection:: Builder :: session ( ) ?
228226 . name ( "org.freedesktop.a11y.Manager" ) ?
229227 . serve_at ( "/org/freedesktop/a11y/Manager" , keyboard_monitor) ?
0 commit comments