The Following User Says Thank You to helex For This Useful Post: | ||
![]() |
2011-07-19
, 18:52
|
Posts: 1,680 |
Thanked: 3,685 times |
Joined on Jan 2011
|
#2
|
Hi Guys!
Has anybody a idea how to send a keycode from my application in the background to the acutally running application in the foreground?
I would prefer a way that works similar at Maemo5 and MeeGo Tablet / Handset. It should feel for the target application like a normal hardware keyboard press.
What is the mostly common linux way to do this?
The Following User Says Thank You to vi_ For This Useful Post: | ||
![]() |
2011-07-19
, 19:03
|
|
Posts: 543 |
Thanked: 802 times |
Joined on Apr 2010
@ Germany
|
#3
|
![]() |
2011-07-21
, 19:32
|
|
Posts: 543 |
Thanked: 802 times |
Joined on Apr 2010
@ Germany
|
#4
|
![]() |
2011-07-21
, 19:38
|
Posts: 1,680 |
Thanked: 3,685 times |
Joined on Jan 2011
|
#5
|
The Following User Says Thank You to vi_ For This Useful Post: | ||
![]() |
2011-07-28
, 21:49
|
|
Posts: 543 |
Thanked: 802 times |
Joined on Apr 2010
@ Germany
|
#6
|
#include <X11/extensions/XTest.h> #include <stdio.h> #define KEY_DOWN True #define KEY_UP False #define KEY_MOD 37 int main(int argc, char *argv[]) { int i; char c; Display *dpy = XOpenDisplay(NULL); if (!dpy) return 1; for (i=1; i<argc; i++) { c=atoi (argv[i]); printf ("<%u>\n", c); XTestFakeKeyEvent(dpy, c, KEY_DOWN, CurrentTime); XTestFakeKeyEvent(dpy, c, KEY_UP, CurrentTime); } XCloseDisplay(dpy); return 0; }
![]() |
2011-07-29
, 01:33
|
Posts: 225 |
Thanked: 105 times |
Joined on May 2010
|
#7
|
![]() |
2011-07-29
, 04:43
|
Posts: 2,225 |
Thanked: 3,822 times |
Joined on Jun 2010
@ Florida
|
#8
|
The Following 2 Users Say Thank You to Mentalist Traceur For This Useful Post: | ||
![]() |
2011-07-29
, 20:49
|
|
Posts: 543 |
Thanked: 802 times |
Joined on Apr 2010
@ Germany
|
#9
|
I compiled xdotool before for the N900 - not .deb packaged let alone in the repositories, but I made a thread about it. (It does exactly what you want, if you're okay with doing it through the command line or having your app do it through the command line.)
![]() |
2011-07-29
, 21:12
|
Posts: 2,225 |
Thanked: 3,822 times |
Joined on Jun 2010
@ Florida
|
#10
|
THANKS A LOT!
My small application works now. Not perfect, but rudimentary. Glad to see that I got my idea working. Will try to package your bin into my package. But I'm still searching for a better solution that accepts keycodes directly and not thru Characters. Preferential without using the commandline. Many kombinations are still not working and I expect many language settings related problems in the near future...
Will create a new Thread as soon as I have the packaging done.
Has anybody a idea how to send a keycode from my application in the background to the acutally running application in the foreground?
I would prefer a way that works similar at Maemo5 and MeeGo Tablet / Handset. It should feel for the target application like a normal hardware keyboard press.
What is the mostly common linux way to do this?
Please DONATE if you like my work!