-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathxfunc.cpp
More file actions
executable file
·33 lines (25 loc) · 801 Bytes
/
xfunc.cpp
File metadata and controls
executable file
·33 lines (25 loc) · 801 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include "xfunc.h"
void sendKey(unsigned long k)
{
Display* pDisplay = XOpenDisplay( NULL );
XTestFakeKeyEvent( pDisplay, XKeysymToKeycode( pDisplay, k ), true, CurrentTime );
XTestFakeKeyEvent( pDisplay, XKeysymToKeycode( pDisplay, k ), false, CurrentTime );
//if( pDisplay == NULL ) return 1;
XCloseDisplay(pDisplay);
}
/*
event.display = display;
event.window = destination of the event;
event.root = the root window;
event.subwindow = None;
event.time = CurrentTime;
event.x = 1;
event.y = 1;
event.x_root = 1;
event.y_root = 1;
event.same_screen = TRUE;
event.type = KeyPress; or event.type = KeyRelease;
event.keycode = keycode;
event.state = modifiers;
XSendEvent(event.display, event.window, TRUE, KeyPressMask, (XEvent *)event);
*/