mirror of
https://github.com/bspeice/libcvautomation
synced 2025-04-21 00:41:29 -04:00
Continue fleshing out the XTest functions for keyboards
This commit is contained in:
parent
ca39bd90be
commit
8c1ab45c26
@ -82,16 +82,17 @@ void xte_mouseUp ( Display *displayLocation, int mouseButton );
|
|||||||
/* Move the mouse a little bit */
|
/* Move the mouse a little bit */
|
||||||
void xte_mouseJiggle ( Display *displayLocation );
|
void xte_mouseJiggle ( Display *displayLocation );
|
||||||
|
|
||||||
/* Press and release a single key */
|
/* Press and release a key
|
||||||
void xte_clickKey ( Display *displayLocation, char key );
|
* Note that we use a string for *key, since keys like "space" are still valid. */
|
||||||
|
void xte_clickKey ( Display *displayLocation, char *key );
|
||||||
|
|
||||||
/* Press and release keys in a string */
|
/* Press and release keys in a string */
|
||||||
void xte_clickKeyStr ( Display *displayLocation, const char *string );
|
void xte_clickKeyStr ( Display *displayLocation, const char *string );
|
||||||
|
|
||||||
/* Press a key down */
|
/* Press a key down */
|
||||||
void xte_keyDown ( Display *displayLocation, char key );
|
void xte_keyDown ( Display *displayLocation, char *key );
|
||||||
|
|
||||||
/* Release a key */
|
/* Release a key */
|
||||||
void xte_keyUp ( Display *displayLocation, char key );
|
void xte_keyUp ( Display *displayLocation, char *key );
|
||||||
|
|
||||||
#endif /* LIBCVAUTOMATION_XTEST_H */
|
#endif /* LIBCVAUTOMATION_XTEST_H */
|
||||||
|
@ -357,7 +357,7 @@ void xte_mouseDown ( Display *displayLocation, int mouseButton )
|
|||||||
*/
|
*/
|
||||||
void xte_mouseUp ( Display *displayLocation, int mouseButton )
|
void xte_mouseUp ( Display *displayLocation, int mouseButton )
|
||||||
{
|
{
|
||||||
XTestFakeButtonEvent( displayLocation, mouseButton, 0, CurrentTime );
|
XTestFakeButtonEvent( displayLocation, mouseButton, False, CurrentTime );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -378,9 +378,21 @@ void xte_mouseJiggle ( Display *displayLocation )
|
|||||||
* Description: Press and release a single key
|
* Description: Press and release a single key
|
||||||
* =====================================================================================
|
* =====================================================================================
|
||||||
*/
|
*/
|
||||||
void xte_clickKey ( Display *displayLocation, char key )
|
void xte_clickKey ( Display *displayLocation, char *key )
|
||||||
{
|
{
|
||||||
|
/* Part of this code based on xte from the xautomation source
|
||||||
|
* available at http://hoopajoo.net/projects/xautomation.html */
|
||||||
|
KeyCode kc;
|
||||||
|
KeySym ks;
|
||||||
|
|
||||||
|
ks = XStringToKeysym( key );
|
||||||
|
if ( ks == NoSymbol )
|
||||||
|
return;
|
||||||
|
|
||||||
|
kc = XKeysymToKeycode( displayLocation, ks );
|
||||||
|
|
||||||
|
XTestFakeKeyEvent( displayLocation, kc, True, CurrentTime );
|
||||||
|
XTestFakeKeyEvent( displayLocation, kc, False, CurrentTime );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -391,6 +403,7 @@ void xte_clickKey ( Display *displayLocation, char key )
|
|||||||
*/
|
*/
|
||||||
void xte_clickKeyStr ( Display *displayLocation, const char *string )
|
void xte_clickKeyStr ( Display *displayLocation, const char *string )
|
||||||
{
|
{
|
||||||
|
/* TODO: Code the function to convert a string to key presses */
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -400,9 +413,18 @@ void xte_clickKeyStr ( Display *displayLocation, const char *string )
|
|||||||
* Description: Press a key down
|
* Description: Press a key down
|
||||||
* =====================================================================================
|
* =====================================================================================
|
||||||
*/
|
*/
|
||||||
void xte_keyDown ( Display *displayLocation, char key )
|
void xte_keyDown ( Display *displayLocation, char *key )
|
||||||
{
|
{
|
||||||
|
KeyCode kc;
|
||||||
|
KeySym ks;
|
||||||
|
|
||||||
|
ks = XStringToKeysym( key );
|
||||||
|
if ( ks == NoSymbol )
|
||||||
|
return;
|
||||||
|
|
||||||
|
kc = XKeysymToKeycode( displayLocation, ks );
|
||||||
|
|
||||||
|
XTestFakeKeyEvent( displayLocation, kc, True, CurrentTime );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -411,7 +433,16 @@ void xte_keyDown ( Display *displayLocation, char key )
|
|||||||
* Description: Release a key
|
* Description: Release a key
|
||||||
* =====================================================================================
|
* =====================================================================================
|
||||||
*/
|
*/
|
||||||
void xte_keyUp ( Display *displayLocation, char key )
|
void xte_keyUp ( Display *displayLocation, char *key )
|
||||||
{
|
{
|
||||||
|
KeyCode kc;
|
||||||
|
KeySym ks;
|
||||||
|
|
||||||
|
ks = XStringToKeysym( key );
|
||||||
|
if ( ks == NoSymbol )
|
||||||
|
return;
|
||||||
|
|
||||||
|
kc = XKeysymToKeycode( displayLocation, ks );
|
||||||
|
|
||||||
|
XTestFakeKeyEvent( displayLocation, kc, True, CurrentTime );
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user