You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I noticed a lot of latency and jitteriness. It turned out that key_click was taking 43 milliseconds to run! So I went to investigate and found that key_click sleeps for 20 milliseconds twice. See here.
Why is that the case? It's only the keyboard functions that do this and not the mouse functions. It seems unnecessary to me.
The text was updated successfully, but these errors were encountered:
I found out that the delays are there because it takes "a while" for modifier keys to take effect. So you need to wait a little bit after pressing shift before pressing 5 to get a %. I really can't stand the delay so I solved this by setting the flags on the key event.
This snippet will produce a keydown event with 5 (key code 23) and shift held down. So this will produce %. No annoying delay necessary.
let event = CGEvent::new_keyboard_event(self.event_source.clone(),23,true).unwrap();
event.set_flags(CGEventFlags::CGEventFlagShift);
event.post(CGEventTapLocation::HID);
I noticed a lot of latency and jitteriness. It turned out that
key_click
was taking 43 milliseconds to run! So I went to investigate and found thatkey_click
sleeps for 20 milliseconds twice. See here.Why is that the case? It's only the keyboard functions that do this and not the mouse functions. It seems unnecessary to me.
The text was updated successfully, but these errors were encountered: