Add functions to scroll the mouse up and down

Release_1.3_Bugfix
Bradlee Speice 2012-07-12 10:04:57 -04:00
parent 5150b2d7e4
commit e436323d7a
3 changed files with 68 additions and 0 deletions

View File

@ -84,6 +84,12 @@ void xte_mouseUp ( Display *displayLocation, int mouseButton );
/* Move the mouse a little bit */
void xte_mouseJiggle ( Display *displayLocation );
/* Scroll the mouse up */
void xte_mouseScrollUp ( Display *displayLocation );
/* Scroll the mouse down */
void xte_mouseScrollDown ( Display *displayLocation );
/* Press and release a key
* Note that we use a string for *key, since keys like "space" are still valid. */
void xte_clickKey ( Display *displayLocation, char *key );
@ -404,6 +410,16 @@ Release mouse button \c <button_number>
\code 'mousejiggle' \endcode
Jiggle the mouse (helps to activate some widgets). Moves the mouse right and down 1 pixel, and then back.
\section mousescrolld Mouse Scroll Down
\code 'mousescrolld' \endcode
Scroll the mouse down 1 time - depending on window manager settings, etc., this may be multiple lines.
\note This is a wrapper function for clicking button 4 on the mouse
\section mousescrollu Mouse Scroll Up
\code 'mousescrollu' \endcode
Scroll the mouse up 1 time - depending on window manager settings, etc., this may be multiple lines.
\note This is a wrapper function for clicking button 5 on the mouse
\section keyclick Key Button Click
\code 'keyclick <key_name>' \endcode
Push and release a keyboard key. This can be a key like \c 'a', \c 'b', or something fancy like \c 'Space'. Please see \ref XTest_key_strings for a full list of special keys.

View File

@ -85,6 +85,12 @@ void xte_mouseUp ( Display *displayLocation, int mouseButton );
/* Move the mouse a little bit */
void xte_mouseJiggle ( Display *displayLocation );
/* Scroll the mouse up */
void xte_mouseScrollUp ( Display *displayLocation );
/* Scroll the mouse down */
void xte_mouseScrollDown ( Display *displayLocation );
/* Press and release a key
* Note that we use a string for *key, since keys like "space" are still valid. */
void xte_clickKey ( Display *displayLocation, char *key );
@ -405,6 +411,16 @@ Release mouse button \c <button_number>
\code 'mousejiggle' \endcode
Jiggle the mouse (helps to activate some widgets). Moves the mouse right and down 1 pixel, and then back.
\section mousescrolld Mouse Scroll Down
\code 'mousescrolld' \endcode
Scroll the mouse down 1 time - depending on window manager settings, etc., this may be multiple lines.
\note This is a wrapper function for clicking button 4 on the mouse
\section mousescrollu Mouse Scroll Up
\code 'mousescrollu' \endcode
Scroll the mouse up 1 time - depending on window manager settings, etc., this may be multiple lines.
\note This is a wrapper function for clicking button 5 on the mouse
\section keyclick Key Button Click
\code 'keyclick <key_name>' \endcode
Push and release a keyboard key. This can be a key like \c 'a', \c 'b', or something fancy like \c 'Space'. Please see \ref XTest_key_strings for a full list of special keys.

View File

@ -486,6 +486,34 @@ void xte_mouseJiggle ( Display *displayLocation )
XFlush( displayLocation );
}
/*
* === FUNCTION ======================================================================
* Name: xte_mouseScrollUp
* Description: Scroll the mouse up
* =====================================================================================
*/
void xte_mouseScrollUp ( Display *displayLocation )
{
XTestFakeButtonEvent( displayLocation, 4, True, CurrentTime );
XTestFakeButtonEvent( displayLocation, 4, False, CurrentTime );
XFlush( displayLocation );
} /* ----- end of function xte_mouseScrollUp ----- */
/*
* === FUNCTION ======================================================================
* Name: xte_mouseScrollDown
* Description: Scroll the mouse down
* =====================================================================================
*/
void xte_mouseScrollDown ( Display *displayLocation )
{
XTestFakeButtonEvent( displayLocation, 5, True, CurrentTime );
XTestFakeButtonEvent( displayLocation, 5, False, CurrentTime );
XFlush( displayLocation );
} /* ----- end of function xte_mouseScrollDown ----- */
/*
* === FUNCTION ======================================================================
* Name: xte_clickKey
@ -688,6 +716,14 @@ cvaPoint xte_commandString ( Display *displayLocation, char *commandString, int
{
xte_mouseJiggle( displayLocation );
}
else if (IS_CMD( s_commandString, "mousescrollu" ))
{
xte_mouseScrollUp( displayLocation );
}
else if (IS_CMD( s_commandString, "mousescrolld" ))
{
xte_mouseScrollDown( displayLocation );
}
else if (IS_CMD( s_commandString, "keyclick" ))
{
char *key;