Home | History | Annotate | Download | only in extensions
      1 /*
      2  * xtestext1.h
      3  *
      4  * X11 Input Synthesis Extension include file
      5  */
      6 
      7 /*
      8 
      9 
     10 Copyright 1986, 1987, 1988, 1998  The Open Group
     11 
     12 Permission to use, copy, modify, distribute, and sell this software and its
     13 documentation for any purpose is hereby granted without fee, provided that
     14 the above copyright notice appear in all copies and that both that
     15 copyright notice and this permission notice appear in supporting
     16 documentation.
     17 
     18 The above copyright notice and this permission notice shall be included in
     19 all copies or substantial portions of the Software.
     20 
     21 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     22 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     23 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
     24 OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
     25 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
     26 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
     27 
     28 Except as contained in this notice, the name of The Open Group shall not be
     29 used in advertising or otherwise to promote the sale, use or other dealings
     30 in this Software without prior written authorization from The Open Group.
     31 
     32 
     33 Copyright 1986, 1987, 1988 by Hewlett-Packard Corporation
     34 
     35 Permission to use, copy, modify, and distribute this
     36 software and its documentation for any purpose and without
     37 fee is hereby granted, provided that the above copyright
     38 notice appear in all copies and that both that copyright
     39 notice and this permission notice appear in supporting
     40 documentation, and that the name of Hewlett-Packard not be used in
     41 advertising or publicity pertaining to distribution of the
     42 software without specific, written prior permission.
     43 
     44 Hewlett-Packard makes no representations about the
     45 suitability of this software for any purpose.  It is provided
     46 "as is" without express or implied warranty.
     47 
     48 This software is not subject to any license of the American
     49 Telephone and Telegraph Company or of the Regents of the
     50 University of California.
     51 
     52 */
     53 
     54 #ifndef _XTESTEXT1CONST_H
     55 #define _XTESTEXT1CONST_H 1
     56 
     57 #define XTestMAX_ACTION_LIST_SIZE       64
     58 #define XTestACTIONS_SIZE	28
     59 
     60 
     61 /*
     62  * used in the XTestPressButton and XTestPressKey functions
     63  */
     64 #define XTestPRESS                      1 << 0
     65 #define XTestRELEASE                    1 << 1
     66 #define XTestSTROKE                     1 << 2
     67 
     68 /*
     69  * When doing a key or button stroke, the number of milliseconds
     70  * to delay between the press and the release of a key or button
     71  * in the XTestPressButton and XTestPressKey functions.
     72  */
     73 
     74 #define XTestSTROKE_DELAY_TIME		10
     75 
     76 /*
     77  * used in the XTestGetInput function
     78  */
     79 #define XTestEXCLUSIVE                  1 << 0
     80 #define XTestPACKED_ACTIONS             1 << 1
     81 #define XTestPACKED_MOTION              1 << 2
     82 
     83 /*
     84  * used in the XTestFakeInput function
     85  */
     86 #define XTestFAKE_ACK_NOT_NEEDED        0
     87 #define XTestFAKE_ACK_REQUEST           1
     88 
     89 /*
     90  * used in the XTest extension initialization routine
     91  */
     92 #define XTestEXTENSION_NAME             "XTestExtension1"
     93 #define XTestEVENT_COUNT                2
     94 
     95 /*
     96  * This is the definition for the format of the header byte
     97  * in the input action structures.
     98  */
     99 #define XTestACTION_TYPE_MASK   0x03    /* bits 0 and 1          */
    100 #define XTestKEY_STATE_MASK     0x04    /* bit 2 (key action)    */
    101 #define XTestX_SIGN_BIT_MASK    0x04    /* bit 2 (motion action) */
    102 #define XTestY_SIGN_BIT_MASK    0x08    /* bit 3 (motion action) */
    103 #define XTestDEVICE_ID_MASK     0xf0    /* bits 4 through 7      */
    104 
    105 #define XTestMAX_DEVICE_ID	0x0f
    106 #define XTestPackDeviceID(x)	(((x) & XTestMAX_DEVICE_ID) << 4)
    107 #define XTestUnpackDeviceID(x)	(((x) & XTestDEVICE_ID_MASK) >> 4)
    108 
    109 /*
    110  * These are the possible action types.
    111  */
    112 #define XTestDELAY_ACTION       0
    113 #define XTestKEY_ACTION         1
    114 #define XTestMOTION_ACTION      2
    115 #define XTestJUMP_ACTION        3
    116 
    117 /*
    118  * These are the definitions for key/button motion input actions.
    119  */
    120 #define XTestKEY_UP             0x04
    121 #define XTestKEY_DOWN           0x00
    122 
    123 /*
    124  * These are the definitions for pointer relative motion input
    125  * actions.
    126  *
    127  * The sign bits for the x and y relative motions are contained
    128  * in the header byte.  The x and y relative motions are packed
    129  * into one byte to make things fit in 32 bits.  If the relative
    130  * motion range is larger than +/-15, use the pointer jump action.
    131  */
    132 #define XTestMOTION_MAX            15
    133 #define XTestMOTION_MIN            -15
    134 
    135 #define XTestX_NEGATIVE            0x04
    136 #define XTestY_NEGATIVE            0x08
    137 
    138 #define XTestX_MOTION_MASK         0x0f
    139 #define XTestY_MOTION_MASK         0xf0
    140 
    141 #define XTestPackXMotionValue(x)   ((x) & XTestX_MOTION_MASK)
    142 #define XTestPackYMotionValue(x)   (((x) << 4) & XTestY_MOTION_MASK)
    143 
    144 #define XTestUnpackXMotionValue(x) ((x) & XTestX_MOTION_MASK)
    145 #define XTestUnpackYMotionValue(x) (((x) & XTestY_MOTION_MASK) >> 4)
    146 /*
    147  * These are the definitions for a long delay input action.  It is
    148  * used when more than XTestSHORT_DELAY_TIME milliseconds of delay
    149  * (approximately one minute) is needed.
    150  *
    151  * The device ID for a delay is always set to XTestDELAY_DEVICE_ID.
    152  * This guarantees that a header byte with a value of 0 is not
    153  * a valid header, so it can be used as a flag to indicate that
    154  * there are no more input actions in an XTestInputAction event.
    155  */
    156 
    157 #define XTestSHORT_DELAY_TIME	0xffff
    158 #define XTestDELAY_DEVICE_ID    0x0f
    159 
    160 #endif /* _XTESTEXT1CONST_H */
    161