File tree Expand file tree Collapse file tree 1 file changed +24
-1
lines changed
Expand file tree Collapse file tree 1 file changed +24
-1
lines changed Original file line number Diff line number Diff line change 1- use std:: { error:: Error , io} ;
1+ use std:: { error:: Error , io, thread , time :: Duration } ;
22
33use x11rb:: {
44 connection:: Connection ,
@@ -139,6 +139,7 @@ impl X11 {
139139 ) ?;
140140
141141 self . connection . sync ( ) ?;
142+ self . wait_actvate_window ( ) ?;
142143
143144 Ok ( ( ) )
144145 }
@@ -149,4 +150,26 @@ impl X11 {
149150
150151 Ok ( ( ) )
151152 }
153+
154+ fn wait_actvate_window ( & self ) -> Result < bool , Box < dyn std:: error:: Error > > {
155+ loop {
156+ let prop = self
157+ . connection
158+ . get_property (
159+ false ,
160+ self . root_id ,
161+ self . net_active_window ,
162+ AtomEnum :: WINDOW ,
163+ 0 ,
164+ 1 ,
165+ ) ?
166+ . reply ( ) ?;
167+
168+ if u32:: from_ne_bytes ( prop. value [ 0 ..4 ] . try_into ( ) ?) == self . window_id {
169+ return Ok ( true ) ;
170+ }
171+
172+ thread:: sleep ( Duration :: from_millis ( 10 ) ) ;
173+ }
174+ }
152175}
You can’t perform that action at this time.
0 commit comments