Skip to main content

post_key

Function post_key 

Source
pub unsafe fn post_key(key_code: u16, characters: &str)
Expand description

Post a key press and release to whichever window is key.

Window number 0 means “the key window”, which while a menu is tracking is the menu itself — so an Escape posted here is what dismisses it. Menus read the event queue directly, so this reaches them without a sendEvent:.

§Safety

Must be called on the main thread.