about summary refs log tree commit diff stats
path: root/html/077mouse.cc.html
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-06-12 22:34:45 -0700
committerKartik K. Agaram <vc@akkartik.com>2015-06-12 22:34:45 -0700
commitd44123cabaa730c778a0e2644c75dbfba6a7ab30 (patch)
treea24e90f9fc864ea5b1c5e1f13433f55ad7acd30b /html/077mouse.cc.html
parent1ae4e0d95f7e37dc7d0b146542fc39b4aed491de (diff)
downloadmu-d44123cabaa730c778a0e2644c75dbfba6a7ab30.tar.gz
1556
Diffstat (limited to 'html/077mouse.cc.html')
-rw-r--r--html/077mouse.cc.html68
1 files changed, 68 insertions, 0 deletions
diff --git a/html/077mouse.cc.html b/html/077mouse.cc.html
new file mode 100644
index 00000000..0c3f775e
--- /dev/null
+++ b/html/077mouse.cc.html
@@ -0,0 +1,68 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=UTF-8">
+<title>Mu - 077mouse.cc</title>
+<meta name="Generator" content="Vim/7.4">
+<meta name="plugin-version" content="vim7.4_v1">
+<meta name="syntax" content="cpp">
+<meta name="settings" content="use_css,pre_wrap,no_foldcolumn,expand_tabs,prevent_copy=">
+<meta name="colorscheme" content="minimal">
+<style type="text/css">
+<!--
+pre { white-space: pre-wrap; font-family: monospace; color: #eeeeee; background-color: #080808; }
+body { font-family: monospace; color: #eeeeee; background-color: #080808; }
+* { font-size: 1em; }
+.Constant { color: #008080; }
+.Comment { color: #8080ff; }
+.Delimiter { color: #c000c0; }
+.Identifier { color: #804000; }
+.CommentedCode { color: #6c6c6c; }
+-->
+</style>
+
+<script type='text/javascript'>
+<!--
+
+-->
+</script>
+</head>
+<body>
+<pre id='vimCodeElement'>
+<span class="Delimiter">:(before &quot;End Primitive Recipe Declarations&quot;)</span>
+READ_KEYBOARD_OR_MOUSE_EVENT<span class="Delimiter">,</span>
+<span class="Delimiter">:(before &quot;End Primitive Recipe Numbers&quot;)</span>
+Recipe_number[<span class="Constant">&quot;read-keyboard-or-mouse-event&quot;</span>] = READ_KEYBOARD_OR_MOUSE_EVENT<span class="Delimiter">;</span>
+<span class="Delimiter">:(before &quot;End Primitive Recipe Implementations&quot;)</span>
+case READ_KEYBOARD_OR_MOUSE_EVENT: <span class="Delimiter">{</span>
+  products<span class="Delimiter">.</span>resize<span class="Delimiter">(</span><span class="Constant">2</span><span class="Delimiter">);</span>  <span class="Comment">// result and status</span>
+  tb_event event<span class="Delimiter">;</span>
+  int event_type = tb_peek_event<span class="Delimiter">(</span>&amp;event<span class="Delimiter">,</span> <span class="Constant">5</span><span class="Comment">/*</span><span class="Comment">ms</span><span class="Comment">*/</span><span class="Delimiter">);</span>
+  if <span class="Delimiter">(</span>event_type == TB_EVENT_KEY<span class="Delimiter">)</span> <span class="Delimiter">{</span>
+    products<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>push_back<span class="Delimiter">(</span><span class="Comment">/*</span><span class="Comment">keyboard event</span><span class="Comment">*/</span><span class="Constant">0</span><span class="Delimiter">);</span>
+    long long key = event<span class="Delimiter">.</span>key ? event<span class="Delimiter">.</span>key : event<span class="Delimiter">.</span>ch<span class="Delimiter">;</span>
+    if <span class="Delimiter">(</span>key == TB_KEY_CTRL_C<span class="Delimiter">)</span> tb_shutdown<span class="Delimiter">(),</span> exit<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">);</span>
+    if <span class="Delimiter">(</span>key == TB_KEY_BACKSPACE2<span class="Delimiter">)</span> key = TB_KEY_BACKSPACE<span class="Delimiter">;</span>
+    if <span class="Delimiter">(</span>key == TB_KEY_CARRIAGE_RETURN<span class="Delimiter">)</span> key = TB_KEY_NEWLINE<span class="Delimiter">;</span>
+    products<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>push_back<span class="Delimiter">(</span>key<span class="Delimiter">);</span>
+    products<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">).</span>push_back<span class="Delimiter">(</span><span class="Comment">/*</span><span class="Comment">found</span><span class="Comment">*/</span><span class="Constant">true</span><span class="Delimiter">);</span>
+    <span class="Identifier">break</span><span class="Delimiter">;</span>
+  <span class="Delimiter">}</span>
+  if <span class="Delimiter">(</span>event_type == TB_EVENT_MOUSE<span class="Delimiter">)</span> <span class="Delimiter">{</span>
+    products<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>push_back<span class="Delimiter">(</span><span class="Comment">/*</span><span class="Comment">mouse event</span><span class="Comment">*/</span><span class="Constant">1</span><span class="Delimiter">);</span>
+<span class="CommentedCode">//?     tb_shutdown(); //? 1</span>
+<span class="CommentedCode">//?     cerr &lt;&lt; event_type &lt;&lt; ' ' &lt;&lt; event.key &lt;&lt; ' ' &lt;&lt; event.y &lt;&lt; ' ' &lt;&lt; event.x &lt;&lt; '\n'; //? 1</span>
+<span class="CommentedCode">//?     exit(0); //? 1</span>
+    products<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>push_back<span class="Delimiter">(</span>event<span class="Delimiter">.</span>key<span class="Delimiter">);</span>  <span class="Comment">// which button, etc.</span>
+    products<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>push_back<span class="Delimiter">(</span>event<span class="Delimiter">.</span>y<span class="Delimiter">);</span>  <span class="Comment">// row</span>
+    products<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>push_back<span class="Delimiter">(</span>event<span class="Delimiter">.</span>x<span class="Delimiter">);</span>  <span class="Comment">// column</span>
+    products<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">).</span>push_back<span class="Delimiter">(</span><span class="Comment">/*</span><span class="Comment">found</span><span class="Comment">*/</span><span class="Constant">true</span><span class="Delimiter">);</span>
+    <span class="Identifier">break</span><span class="Delimiter">;</span>
+  <span class="Delimiter">}</span>
+  products<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">).</span>push_back<span class="Delimiter">(</span><span class="Comment">/*</span><span class="Comment">found</span><span class="Comment">*/</span><span class="Constant">false</span><span class="Delimiter">);</span>
+  <span class="Identifier">break</span><span class="Delimiter">;</span>
+<span class="Delimiter">}</span>
+</pre>
+</body>
+</html>
+<!-- vim: set foldmethod=manual : -->
'>
76755b28 ^
9570363a ^
672e3e50 ^
672e3e50 ^

c5ffb6e1 ^
76755b28 ^
90560d71 ^
76755b28 ^
4fe9f5e8 ^



76755b28 ^

4fe9f5e8 ^




76755b28 ^
672e3e50 ^

76755b28 ^




672e3e50 ^

76755b28 ^


9542bb11 ^
672e3e50 ^
90560d71 ^
76755b28 ^
9542bb11 ^
76755b28 ^










































672e3e50 ^
76755b28 ^







672e3e50 ^
76755b28 ^
672e3e50 ^




9570363a ^



672e3e50 ^
672e3e50 ^

76755b28 ^









9570363a ^
672e3e50 ^
9570363a ^



672e3e50 ^
672e3e50 ^

76755b28 ^





672e3e50 ^



9570363a ^


76755b28 ^
672e3e50 ^
c5ffb6e1 ^
672e3e50 ^
76755b28 ^





672e3e50 ^
9570363a ^
672e3e50 ^
9570363a ^

76755b28 ^
9570363a ^


76755b28 ^
9570363a ^
672e3e50 ^
9570363a ^

90560d71 ^
9570363a ^
76755b28 ^
9570363a ^
90560d71 ^
76755b28 ^

9542bb11 ^

9570363a ^
9542bb11 ^



76755b28 ^
9542bb11 ^
90560d71 ^
76755b28 ^


9542bb11 ^



9570363a ^
9542bb11 ^
90560d71 ^
9542bb11 ^


76755b28 ^
9542bb11 ^
90560d71 ^

76755b28 ^
90560d71 ^
9542bb11 ^
90560d71 ^
76755b28 ^


672e3e50 ^
9542bb11 ^
672e3e50 ^




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