home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 5 / FreshFish_July-August1994.bin / bbs / util / jade-3.0.lha / Jade / src / keys.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-04-16  |  2.6 KB  |  112 lines

  1. /* keys.h -- Event structures
  2.    Copyright (C) 1993, 1994 John Harper <jsh@ukc.ac.uk>
  3.  
  4. This file is part of Jade.
  5.  
  6. Jade is free software; you can redistribute it and/or modify it
  7. under the terms of the GNU General Public License as published by
  8. the Free Software Foundation; either version 2, or (at your option)
  9. any later version.
  10.  
  11. Jade is distributed in the hope that it will be useful, but
  12. WITHOUT ANY WARRANTY; without even the implied warranty of
  13. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. GNU General Public License for more details.
  15.  
  16. You should have received a copy of the GNU General Public License
  17. along with Jade; see the file COPYING.  If not, write to
  18. the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  19.  
  20. /*
  21.  * definition of an event
  22.  */
  23. typedef struct {
  24.     u_short    evd_Type;
  25.     u_short    evd_Mods;
  26.     u_long     evd_Code;
  27. } EventDef;
  28.  
  29. /*
  30.  * actual event read from window.
  31.  */
  32. typedef struct {
  33.     struct _VW *ev_Window;
  34.     EventDef    ev_EventDef;
  35.     u_long    ev_Data1;
  36.     u_long    ev_Data2;
  37. #define        ev_Data_MouseX ev_Data1
  38. #define        ev_Data_MouseY ev_Data2
  39. } Event;
  40.  
  41. #define EV_TYPE_KEYBD    1
  42. #define EV_TYPE_MOUSE    2
  43.  
  44. #define EV_MOD_SHIFT    0x0001
  45. #define EV_MOD_CTRL    0x0002
  46. #define EV_MOD_MOD1    0x0004
  47. #define EV_MOD_MOD2    0x0008
  48. #define EV_MOD_MOD3    0x0010
  49. #define EV_MOD_MOD4    0x0020
  50. #define EV_MOD_MOD5    0x0040
  51. #define EV_MOD_BUTTON1    0x0080
  52. #define EV_MOD_BUTTON2    0x0100
  53. #define EV_MOD_BUTTON3    0x0200
  54. #define EV_MOD_BUTTON4    0x0400
  55. #define EV_MOD_BUTTON5    0x0800
  56.  
  57. #define EV_MOD_META EV_MOD_MOD1
  58.  
  59. #define EV_MOD_LMB EV_MOD_BUTTON1
  60. #define EV_MOD_MMB EV_MOD_BUTTON2
  61. #define EV_MOD_RMB EV_MOD_BUTTON3
  62.  
  63. /*
  64.  * When putting events into a KEYTABLE the low 7 bits of iev_Code are used to
  65.  * get the offset into the table
  66.  */
  67. #define EV_HASH_MASK  0x7f
  68.  
  69. /*
  70.  * For EV_TYPE_KEYBD the code is like this,
  71.  * X11:
  72.  *  Standard Keysym's
  73.  * Amiga:
  74.  *  Normal *raw* keycodes
  75.  */
  76.  
  77. /*
  78.  * EV_CODE for EV_TYPE_MOUSE events
  79.  */
  80. #define EV_CODE_MOUSE_CLICK1 1
  81. #define EV_CODE_MOUSE_CLICK2 2
  82. #define EV_CODE_MOUSE_MOVE   3
  83. #define EV_CODE_MOUSE_UP     4
  84.  
  85. /*
  86.  * Physical structures for key storage,
  87.  */
  88. typedef struct _Key {
  89.     union {
  90.     struct _Key    *next;
  91.     struct MinNode node;
  92.     }            ky_Link;
  93.     /*
  94.      * unevaluated object to be evaluated when key is pressed
  95.      */
  96.     VALUE        ky_Form;
  97.     EventDef        ky_Event;
  98. } Key;
  99.  
  100. typedef struct _Keytab {
  101.     u_char        kt_Type;
  102.     struct _Keytab *kt_Next;        /* next allocated Keytab */
  103.     Key           *kt_Keys[128];   /* events are hashed off low 7 bits */
  104. } Keytab;
  105.  
  106. typedef struct _Keylist {
  107.     u_char        kl_Type;
  108.     struct _Keylist *kl_Next;        /* next allocated Keylist */
  109.     struct MinList  kl_List;
  110. } Keylist;
  111.  
  112.