about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--code/cli.rb65
1 files changed, 39 insertions, 26 deletions
diff --git a/code/cli.rb b/code/cli.rb
index 8a18f33f..c5ad48a1 100644
--- a/code/cli.rb
+++ b/code/cli.rb
@@ -66,12 +66,16 @@ module CLI
 		@@colortable = []
 	end
 
+	MOUSE_MASK_ON = Ncurses::ALL_MOUSE_EVENTS | Ncurses::REPORT_MOUSE_POSITION
+	MOUSE_MASK_OFF = 0
+
 	def init_mouse
-		Ncurses.mousemask(Ncurses::ALL_MOUSE_EVENTS | Ncurses::REPORT_MOUSE_POSITION, [])
+		Ncurses.mouseinterval( 0 )
+		Ncurses.mousemask( MOUSE_MASK_ON, [] )
 	end
 
 	def stop_mouse
-		Ncurses.mousemask(0, [])
+		Ncurses.mousemask( MOUSE_MASK_OFF, [] )
 	end
 
 	def self.refresh
@@ -163,54 +167,63 @@ module CLI
 		def press2?() 0 != @bstate & Ncurses::BUTTON2_PRESSED end
 		def press3?() 0 != @bstate & Ncurses::BUTTON3_PRESSED end
 		def press4?() 0 != @bstate & Ncurses::BUTTON4_PRESSED end
+
+		## this does not work. BUTTON5_* is not defined
 		def press5?() 0 != @bstate & Ncurses::BUTTON5_PRESSED end
-		def press6?() 0 != @bstate & Ncurses::BUTTON6_PRESSED end
-		def press7?() 0 != @bstate & Ncurses::BUTTON7_PRESSED end
-		def press8?() 0 != @bstate & Ncurses::BUTTON8_PRESSED end
-		def press9?() 0 != @bstate & Ncurses::BUTTON9_PRESSED end
+
+		## this is an EVIL fix but I don't know better
+		def press5?() 0 != ( @bstate & 128 ) + ( @bstate & 134217728 ) end
+
 
 		def release1?() 0 != @bstate & Ncurses::BUTTON1_RELEASED end
 		def release2?() 0 != @bstate & Ncurses::BUTTON2_RELEASED end
 		def release3?() 0 != @bstate & Ncurses::BUTTON3_RELEASED end
 		def release4?() 0 != @bstate & Ncurses::BUTTON4_RELEASED end
-		def release5?() 0 != @bstate & Ncurses::BUTTON5_RELEASED end
-		def release6?() 0 != @bstate & Ncurses::BUTTON6_RELEASED end
-		def release7?() 0 != @bstate & Ncurses::BUTTON7_RELEASED end
-		def release8?() 0 != @bstate & Ncurses::BUTTON8_RELEASED end
-		def release9?() 0 != @bstate & Ncurses::BUTTON9_RELEASED end
+#		def release5?() 0 != @bstate & Ncurses::BUTTON5_RELEASED end
 
 		def click1?() 0 != @bstate & Ncurses::BUTTON1_CLICKED end
 		def click2?() 0 != @bstate & Ncurses::BUTTON2_CLICKED end
 		def click3?() 0 != @bstate & Ncurses::BUTTON3_CLICKED end
 		def click4?() 0 != @bstate & Ncurses::BUTTON4_CLICKED end
-		def click5?() 0 != @bstate & Ncurses::BUTTON5_CLICKED end
-		def click6?() 0 != @bstate & Ncurses::BUTTON6_CLICKED end
-		def click7?() 0 != @bstate & Ncurses::BUTTON7_CLICKED end
-		def click8?() 0 != @bstate & Ncurses::BUTTON8_CLICKED end
-		def click9?() 0 != @bstate & Ncurses::BUTTON9_CLICKED end
+#		def click5?() 0 != @bstate & Ncurses::BUTTON5_CLICKED end
 
 		def doubleclick1?() 0 != @bstate & Ncurses::BUTTON1_DOUBLE_CLICKED end
 		def doubleclick2?() 0 != @bstate & Ncurses::BUTTON2_DOUBLE_CLICKED end
 		def doubleclick3?() 0 != @bstate & Ncurses::BUTTON3_DOUBLE_CLICKED end
 		def doubleclick4?() 0 != @bstate & Ncurses::BUTTON4_DOUBLE_CLICKED end
-		def doubleclick5?() 0 != @bstate & Ncurses::BUTTON5_DOUBLE_CLICKED end
-		def doubleclick6?() 0 != @bstate & Ncurses::BUTTON6_DOUBLE_CLICKED end
-		def doubleclick7?() 0 != @bstate & Ncurses::BUTTON7_DOUBLE_CLICKED end
-		def doubleclick8?() 0 != @bstate & Ncurses::BUTTON8_DOUBLE_CLICKED end
-		def doubleclick9?() 0 != @bstate & Ncurses::BUTTON9_DOUBLE_CLICKED end
+#		def doubleclick5?() 0 != @bstate & Ncurses::BUTTON5_DOUBLE_CLICKED end
 
 		def tripleclick1?() 0 != @bstate & Ncurses::BUTTON1_TRIPLE_CLICKED end
 		def tripleclick2?() 0 != @bstate & Ncurses::BUTTON2_TRIPLE_CLICKED end
 		def tripleclick3?() 0 != @bstate & Ncurses::BUTTON3_TRIPLE_CLICKED end
 		def tripleclick4?() 0 != @bstate & Ncurses::BUTTON4_TRIPLE_CLICKED end
-		def tripleclick5?() 0 != @bstate & Ncurses::BUTTON5_TRIPLE_CLICKED end
-		def tripleclick6?() 0 != @bstate & Ncurses::BUTTON6_TRIPLE_CLICKED end
-		def tripleclick7?() 0 != @bstate & Ncurses::BUTTON7_TRIPLE_CLICKED end
-		def tripleclick8?() 0 != @bstate & Ncurses::BUTTON8_TRIPLE_CLICKED end
-		def tripleclick9?() 0 != @bstate & Ncurses::BUTTON9_TRIPLE_CLICKED end
+#		def tripleclick5?() 0 != @bstate & Ncurses::BUTTON5_TRIPLE_CLICKED end
 
 		def alt?() 0 != @bstate & Ncurses::BUTTON_ALT end
 		def shift?() 0 != @bstate & Ncurses::BUTTON_SHIFT end
 		def ctrl?() 0 != @bstate & Ncurses::BUTTON_CTRL end
+
+		## too many keys {{{
+#		def press6?() 0 != @bstate & Ncurses::BUTTON6_PRESSED end
+#		def press7?() 0 != @bstate & Ncurses::BUTTON7_PRESSED end
+#		def press8?() 0 != @bstate & Ncurses::BUTTON8_PRESSED end
+#		def press9?() 0 != @bstate & Ncurses::BUTTON9_PRESSED end
+#		def release6?() 0 != @bstate & Ncurses::BUTTON6_RELEASED end
+#		def release7?() 0 != @bstate & Ncurses::BUTTON7_RELEASED end
+#		def release8?() 0 != @bstate & Ncurses::BUTTON8_RELEASED end
+#		def release9?() 0 != @bstate & Ncurses::BUTTON9_RELEASED end
+#		def click6?() 0 != @bstate & Ncurses::BUTTON6_CLICKED end
+#		def click7?() 0 != @bstate & Ncurses::BUTTON7_CLICKED end
+#		def click8?() 0 != @bstate & Ncurses::BUTTON8_CLICKED end
+#		def click9?() 0 != @bstate & Ncurses::BUTTON9_CLICKED end
+#		def doubleclick6?() 0 != @bstate & Ncurses::BUTTON6_DOUBLE_CLICKED end
+#		def doubleclick7?() 0 != @bstate & Ncurses::BUTTON7_DOUBLE_CLICKED end
+#		def doubleclick8?() 0 != @bstate & Ncurses::BUTTON8_DOUBLE_CLICKED end
+#		def doubleclick9?() 0 != @bstate & Ncurses::BUTTON9_DOUBLE_CLICKED end
+#		def tripleclick6?() 0 != @bstate & Ncurses::BUTTON6_TRIPLE_CLICKED end
+#		def tripleclick7?() 0 != @bstate & Ncurses::BUTTON7_TRIPLE_CLICKED end
+#		def tripleclick8?() 0 != @bstate & Ncurses::BUTTON8_TRIPLE_CLICKED end
+#		def tripleclick9?() 0 != @bstate & Ncurses::BUTTON9_TRIPLE_CLICKED end
+		# }}}
 	end # }}}
 end
committer Kartik K. Agaram <vc@akkartik.com> 2015-11-29 14:18:52 -0800 2611' href='/akkartik/mu/commit/html/021check_instruction.cc.html?h=hlt&id=db1f56c8449d2ea3d158753fe37bac5a750a2566'>db1f56c8 ^
76755b28 ^


4690ce81 ^
76755b28 ^
76755b28 ^
d059fe74 ^
76755b28 ^
4690ce81 ^

76755b28 ^
4690ce81 ^

c842d90b ^
76755b28 ^

d059fe74 ^
4690ce81 ^
2f02189d ^
76755b28 ^





4690ce81 ^
76755b28 ^



4690ce81 ^
76755b28 ^




3e1349d2 ^
f344b250 ^
76755b28 ^
f344b250 ^
76755b28 ^


3e1349d2 ^
f344b250 ^
76755b28 ^
f344b250 ^
76755b28 ^


3e1349d2 ^
f344b250 ^
76755b28 ^
f344b250 ^
76755b28 ^


3e1349d2 ^
f344b250 ^
76755b28 ^
f344b250 ^
76755b28 ^
db1f56c8 ^
3e1349d2 ^
f344b250 ^

db1f56c8 ^



b2566a84 ^
3e1349d2 ^
f344b250 ^

b2566a84 ^



4690ce81 ^
3e1349d2 ^
f344b250 ^

4690ce81 ^



76755b28 ^
db1f56c8 ^
4690ce81 ^




db1f56c8 ^


4690ce81 ^
db1f56c8 ^

4690ce81 ^


b2566a84 ^
db1f56c8 ^
4690ce81 ^

44c1aeef ^

b2566a84 ^
db1f56c8 ^
b2566a84 ^
db1f56c8 ^

db1f56c8 ^

2f02189d ^

4690ce81 ^
db1f56c8 ^

4690ce81 ^
76755b28 ^
4690ce81 ^

b2566a84 ^
d2bd40bf ^

76755b28 ^

2f02189d ^
44c1aeef ^







b2566a84 ^
76755b28 ^

32b8fac2 ^











f344b250 ^

4690ce81 ^
db1f56c8 ^


2f02189d ^

44c1aeef ^

44c1aeef ^





76755b28 ^

2f02189d ^

44c1aeef ^

44c1aeef ^





76755b28 ^

2f02189d ^

4690ce81 ^

44c1aeef ^
b2566a84 ^


2f02189d ^

4690ce81 ^
44c1aeef ^
4690ce81 ^
dcc060c7 ^

d009e158 ^
4690ce81 ^
76755b28 ^


d990e8f0 ^

44c1aeef ^






d990e8f0 ^

2f02189d ^
44c1aeef ^

44c1aeef ^






76755b28 ^



a654e4ec ^
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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275