I need help to generate keystrokes in my existing application in LINUX environment. I am fully aware that there are libraries in Dev C++ which do exactly what I want but in Wind
What you want is create and initialize XKeyEvent
struct and send it with XSendEvent
.
Be sure to check man xkeyevent
and man xsendevent
From man xkeyevent
:
typedef struct {
int type; /* KeyPress or KeyRelease */
unsigned long serial; /* # of last request processed by server */
Bool send_event; /* true if this came from a SendEvent request */
Display *display; /* Display the event was read from */
Window window; /* ``event'' window it is reported relative to */
Window root; /* root window that the event occurred on */
Window subwindow; /* child window */
Time time; /* milliseconds */
int x, y; /* pointer x, y coordinates in event window */
int x_root, y_root; /* coordinates relative to root */
unsigned int state; /* key or button mask */
unsigned int keycode; /* detail */
Bool same_screen; /* same screen flag */
} XKeyEvent;
To get key keycodes, check /usr/include/X11/keysymdef.h
ur just use xev
I found a brief introduction for you.
(Edit: It seems someone solved it already :))