From 11cd9123c15f9b9e76c359a8ac672c21f299811a Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Tue, 6 May 2025 13:41:31 -0700 Subject: plumb through all supported args in LÖVE handlers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I just noticed that the is_touch arg in mouse handlers is extremely useful for arbitrating between events on a mobile device. And I'd totally forgotten about its existence X-( --- source_edit.lua | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'source_edit.lua') diff --git a/source_edit.lua b/source_edit.lua index 91bcb58..77487ea 100644 --- a/source_edit.lua +++ b/source_edit.lua @@ -232,7 +232,7 @@ function edit.quit(State) end end -function edit.mouse_press(State, x,y, mouse_button) +function edit.mouse_press(State, x,y, mouse_button, is_touch, presses) if State.search_term then return end State.mouse_down = mouse_button --? print_and_log(('edit.mouse_press: cursor at %d,%d'):format(State.cursor1.line, State.cursor1.pos)) @@ -279,7 +279,7 @@ function edit.mouse_press(State, x,y, mouse_button) State.lines.current_drawing_index = line_index State.lines.current_drawing = line Drawing.before = snapshot(State, line_index) - Drawing.mouse_press(State, line_index, x,y, mouse_button) + Drawing.mouse_press(State, line_index, x,y, mouse_button, is_touch, presses) return end end @@ -292,12 +292,12 @@ function edit.mouse_press(State, x,y, mouse_button) State.selection1 = Text.final_text_loc_on_screen(State) end -function edit.mouse_release(State, x,y, mouse_button) +function edit.mouse_release(State, x,y, mouse_button, is_touch, presses) if State.search_term then return end --? print_and_log(('edit.mouse_release: cursor at %d,%d'):format(State.cursor1.line, State.cursor1.pos)) State.mouse_down = nil if State.lines.current_drawing then - Drawing.mouse_release(State, x,y, mouse_button) + Drawing.mouse_release(State, x,y, mouse_button, is_touch, presses) if Drawing.before then record_undo_event(State, {before=Drawing.before, after=snapshot(State, State.lines.current_drawing_index)}) Drawing.before = nil @@ -383,7 +383,7 @@ function edit.text_input(State, t) schedule_save(State) end -function edit.keychord_press(State, chord, key) +function edit.keychord_press(State, chord, key, scancode, is_repeat) if State.selection1.line and not State.lines.current_drawing and -- printable character created using shift key => delete selection @@ -502,7 +502,7 @@ function edit.keychord_press(State, chord, key) local drawing_index, drawing = Drawing.current_drawing(State) if drawing_index then local before = snapshot(State, drawing_index) - Drawing.keychord_press(State, chord) + Drawing.keychord_press(State, chord, key, scancode, is_repeat) record_undo_event(State, {before=before, after=snapshot(State, drawing_index)}) schedule_save(State) end @@ -535,7 +535,7 @@ function edit.keychord_press(State, chord, key) end schedule_save(State) else - Text.keychord_press(State, chord) + Text.keychord_press(State, chord, key, scancode, is_repeat) end end -- cgit 1.4.1-2-gfad0 194f0c80ebe161'>439e15d ^
adaa28a ^
439e15d ^
439e15d ^
3399650 ^
439e15d ^
a73a882 ^
bcaf6a7 ^







a73a882 ^
2b5553b ^
ee31e38 ^
29355bd ^
c09bf8d ^


c09bf8d ^


dc5d967 ^
c09bf8d ^
1173723 ^

77f8c07 ^
dc5d967 ^
c09bf8d ^


77f8c07 ^
c09bf8d ^





e6cbe9c ^
1173723 ^

c53980c ^
c09bf8d ^










c09bf8d ^
95766d6 ^
c53980c ^
dc5d967 ^
c09bf8d ^
1173723 ^

77f8c07 ^
c09bf8d ^

1173723 ^
c09bf8d ^
77f8c07 ^
c09bf8d ^





e6cbe9c ^
95766d6 ^



1173723 ^

8af1d97 ^



c53980c ^
c09bf8d ^






29355bd ^

b9da4b0 ^

29355bd ^

b9da4b0 ^
dc5d967 ^
b9da4b0 ^
29355bd ^
4cb78a1 ^



3e06ede ^
4cb78a1 ^
3e06ede ^

4cb78a1 ^
29355bd ^


6458d72 ^
7b5638f ^
b9da4b0 ^



d4b7a9a ^

4bd0d33 ^
d4b7a9a ^
4bd0d33 ^

9fce821 ^
b9da4b0 ^

d4b7a9a ^

c53980c ^
d4b7a9a ^
b9da4b0 ^





439e15d ^

4ad20ff ^
dc5d967 ^
439e15d ^
95e8d12 ^
439e15d ^
439e15d ^
b9da4b0 ^
2e836ec ^
6a39a49 ^







2e836ec ^
95e8d12 ^
2e836ec ^
95e8d12 ^




















6a39a49 ^
b098c94 ^



95e8d12 ^









6a39a49 ^
95e8d12 ^
439e15d ^




439e15d ^


26e134b ^

439e15d ^




439e15d ^
dc5d967 ^
439e15d ^
b79b5fa ^
439e15d ^

1d85225 ^
3399650 ^
fde45eb ^
da2bbd3 ^
fde45eb ^


439e15d ^


439e15d ^

83d2390 ^
dc5d967 ^
439e15d ^

59b4a5e ^
c0705ee ^
dba2306 ^
c0705ee ^
439e15d ^



adaa28a ^

0464e42 ^
adaa28a ^

dc5d967 ^
adaa28a ^

2ffdc19 ^
3af6434 ^
2ffdc19 ^

adaa28a ^



2ffdc19 ^
adaa28a ^






fde45eb ^



adaa28a ^


0f3acce ^









439e15d ^

439e15d ^
dc5d967 ^
439e15d ^









0053620 ^

439e15d ^




439e15d ^
dc5d967 ^

439e15d ^



3399650 ^
c09bf8d ^
dba2306 ^
b1701ad ^

3399650 ^


66da153 ^
901b3ed ^
66da153 ^
3399650 ^

c0705ee ^
3399650 ^

c09bf8d ^
c0705ee ^

3399650 ^

439e15d ^




439e15d ^


0053620 ^

439e15d ^
adaa28a ^
bf35794 ^
adaa28a ^








0f3acce ^
adaa28a ^







0464e42 ^
adaa28a ^


0f3acce ^
adaa28a ^

adaa28a ^

3af6434 ^

ee31e38 ^
a73a882 ^
ee31e38 ^
a73a882 ^
adaa28a ^

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
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386