File: keys.h

package info (click to toggle)
sawfish 1:1.5.3-2.4
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 18,160 kB
  • ctags: 1,428
  • sloc: lisp: 23,542; ansic: 15,824; sh: 10,268; makefile: 615; perl: 19
file content (133 lines) | stat: -rw-r--r-- 3,839 bytes parent folder | download | duplicates (2)
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
/* keys.h -- Event structures
   $Id$

   Copyright (C) 1999 John Harper <john@dcs.warwick.ac.uk>

   This file is part of sawfish.

   sawfish is free software; you can redistribute it and/or modify it
   under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 2, or (at your option)
   any later version.

   sawfish is distributed in the hope that it will be useful, but
   WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with sawfish; see the file COPYING.   If not, write to
   the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */

#ifndef SAWFISH_KEYS_H
#define SAWFISH_KEYS_H

/* An event object is (CODE . MODS) */

#define EVENTP(v)	(rep_CONSP(v) && rep_INTP(rep_CAR(v)) && rep_INTP(rep_CDR(v)))
#define MAKE_EVENT(c, m) Fcons(c, m)
#define EVENT_CODE(v)	rep_CAR(v)
#define EVENT_MODS(v)	rep_CDR(v)

/* For keys, the CODE is the standard Keysym value of the key. For mouse
   events CODE is one of the following: */

enum {
    EV_CODE_MOUSE_CLICK1 = 1,
    EV_CODE_MOUSE_CLICK2,
    EV_CODE_MOUSE_MOVE,
    EV_CODE_MOUSE_UP1,
    EV_CODE_MOUSE_CLICK3,
    EV_CODE_MOUSE_UP2,
    EV_CODE_MOUSE_UP3
};

/* The low 16 bits of the MODS is the standard X modifier mask. Bits
   16 to 20 define the type of the event. One of the following: */

enum {
    EV_TYPE_KEY   = 0x00010000,
    EV_TYPE_MOUSE = 0x00020000,

    /* this is used as a placeholder when translating events<->strings,
       it's replaced by the actual meta value */
    EV_MOD_META   = 0x00100000,
    EV_MOD_ALT    = 0x00200000,
    EV_MOD_HYPER  = 0x01000000,
    EV_MOD_SUPER  = 0x02000000,

    /* this is a customizable modifier; it allows the user to move
       all predefined wm key bindings to a different modifier */
    EV_MOD_WM     = 0x04000000,

    /* Matches any of the modifiers */
    EV_MOD_ANY    = 0x00400000,

    /* a KeyRelease event */
    EV_MOD_RELEASE= 0x00800000,

    EV_TYPE_MASK  = 0x000f0000,
    EV_MOD_MASK   = 0x0ff0ffff,
    EV_VIRT_MOD_MASK = 0x0ff00000
};

/* Support for buttons 6, 7, 8 and 9.

   <X11/X.h> doesn't define these, even though XFree supports them.. */

#ifndef Button6
# define Button6 6
#endif
#ifndef Button6Mask
# define Button6Mask (1<<13)
#endif

#ifndef Button7
# define Button7 7
#endif
#ifndef Button7Mask
# define Button7Mask (1<<14)
#endif

#ifndef Button8
# define Button8 8
#endif
#ifndef Button8Mask
# define Button8Mask (1<<15)
#endif

#ifndef Button9
# define Button9 9
#endif
#ifndef Button9Mask
# define Button9Mask (1<<16)
#endif

#if !defined (Button6)
# define EV_MOD_BUTTON_MASK (Button1Mask | Button2Mask | Button3Mask \
			     | Button4Mask | Button5Mask)
#elif !defined (Button7)
# define EV_MOD_BUTTON_MASK (Button1Mask | Button2Mask | Button3Mask \
			     | Button4Mask | Button5Mask | Button6Mask)
#elif !defined (Button8)
# define EV_MOD_BUTTON_MASK (Button1Mask | Button2Mask | Button3Mask \
			     | Button4Mask | Button5Mask | Button6Mask \
			     | Button7Mask)
#elif !defined (Button9)
# define EV_MOD_BUTTON_MASK (Button1Mask | Button2Mask | Button3Mask \
			     | Button4Mask | Button5Mask | Button6Mask \
                             | Button7Mask | Button8Mask)
#else
# define EV_MOD_BUTTON_MASK (Button1Mask | Button2Mask | Button3Mask \
			     | Button4Mask | Button5Mask | Button6Mask \
			     | Button7Mask | Button8Mask | Button9Mask)
#endif

/* In key maps, a `key' is (COMMAND . EVENT) */

#define KEYP(v)		(rep_CONSP(v) && rep_CONSP(rep_CDR(v)))
#define KEY_COMMAND(v)	rep_CAR(v)
#define KEY_EVENT(v)	rep_CDR(v)
#define MAKE_KEY(e, c)	Fcons(c, e)

#endif /* SAWFISH_KEYS_H */