简体   繁体   中英

Send key combination from C using X11 (GTK, GDK) functions

I need exact equivalent of command (in C code)

system("xdotool key alt+o");

but much more portable (and less overloaded for so simple task). I write for GTK so i prefer some GTK function, but something for GDK or even for X11 also looks to be portable. Thanks.

Here's an example that does what you want:

http://www.doctort.org/adam/nerd-notes/x11-fake-keypress-event.html

It's command-line, but it's short and it's pretty easy to understand so turning it into something your code can call should be easy.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM