Check-in [3f4c5dad66]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:more fixes in SDL evdev for resistive touch screens plus touch calibration tool
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 3f4c5dad668080f80c854f9d910cc56e5daf516b
User & Date: chw 2019-02-03 07:35:36
References
2019-02-03
07:49 Ticket [2e8db45a2c] EVDEV KeyCode 330 status still Review with 3 other changes artifact: 0a488dae37 user: chw
Context
2019-02-03
12:39
SDL evdev again: simple vs. multi-touch touchscreens check-in: 169c48d32d user: chw tags: trunk
07:38
merge with trunk check-in: 781e068959 user: chw tags: wtf-8-experiment
07:35
more fixes in SDL evdev for resistive touch screens plus touch calibration tool check-in: 3f4c5dad66 user: chw tags: trunk
2019-02-01
20:07
once more an attempt to fix SDL2 evdev for touchy screenery check-in: 1f91dcde15 user: chw tags: trunk
Changes

Added assets/touchcal0.1/pkgIndex.tcl.





>
>
1
2
package ifneeded touchcal 0.1 \
    [list source [file join $dir touchcal.tcl]]

Added assets/touchcal0.1/touchcal.tcl.











































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
# Module to calibrate resistive EVDEV touchscreens in SDL based Tk
# currently supports video drivers KSMDRM and RPI. Note that the
# calibration only covers simple touchscreens which report EV_ABS
# ABS_X and ABS_Y events. Multi-touch capable devices report event
# types ABS_MT_* which are assumed to be properly aligned with the
# display.
#
# chw February 2019

namespace eval touchcal {

    if {[info command "sdltk"] eq ""} {
	error "no SDL2 aware Tk version loaded"
    }

    variable scrw
    variable scrh
    variable thresh 100
    variable size 100
    variable csize 20
    variable lsize 50
    variable MSG1
    variable MSG2
    variable RESULT
    variable cdata
    variable lastcal

    proc draw_pad {name x y} {
	variable size
	variable csize
	variable lsize
	variable scrw
	variable scrh

	set cx [expr {$size / 2 - $csize / 2}]
	set cy $cx
	set ccx [expr {$cx + $csize}]
	set ccy $ccx
	set vx [expr {$size / 2}]
	set voy [expr {($size -$lsize) / 2}]
	set vcy [expr {$voy + $lsize}]
	set hox [expr {($size - $lsize) / 2}]
	set hcx [expr {$hox + $lsize}]
	set hy [expr {$size / 2}]
	frame $name
	set anchor ""
	if {$y > 0} {
	    set y 0
	    append anchor n
	} elseif {$y < 0} {
	    set y [expr {$scrh - 0.5}]
	    append anchor s
	} else {
	    set y [expr {$scrh / 2}]
	}
	if {$x > 0} {
	    set x 0
	    append anchor w
	} elseif {$x < 0} {
	    set x [expr {$scrw - 0.5}]
	    append anchor e
	} else {
	    set x [expr {$scrw / 2}]
	    set anchor center
	}
	place $name -x $x -y $y -anchor $anchor -width $size -height $size
	canvas $name.m -height $size -width $size -bg "#505075"
	$name.m create oval $cx $cy $ccx $ccy -outline white
	$name.m create line $vx $voy $vx $vcy -fill white
	$name.m create line $hox $hy $hcx $hy -fill white
	pack $name.m
    }

    proc show_calib {varname} {
	upvar #0 $varname msg

	set data {? ? ? ? ?}
	catch {set data [sdltk touchcalib]}
	append msg "MinX:   [lindex $data 0]\n"
	append msg "MaxX:   [lindex $data 1]\n"
	append msg "MinY:   [lindex $data 2]\n"
	append msg "MaxY:   [lindex $data 3]\n"
	append msg "SwapXY: [lindex $data 4]"
    }

    proc calib_seq {top which xdev ydev} {
	variable thresh
	variable size
	variable scrw
	variable scrh
	variable MSG1
	variable MSG2
	variable RESULT
	variable cdata
	variable lastcal

	set cal {0 0 0 0 0}
	catch {set cal [sdltk touchcalib]}
	lassign $cal xmin xmax ymin ymax
	set rx [expr {$xmax - $xmin}]
	set ry [expr {$ymax - $ymin}]
	set xdev [expr {$xmin + $xdev * $rx / 10000.0}]
	set ydev [expr {$ymin + $ydev * $ry / 10000.0}]

	set cdata(xdev,$which) $xdev
	set cdata(ydev,$which) $ydev
	if {$which == 0} {
	    $top.topleft.m configure -background "#505075"
	    $top.topright.m configure -background "#df94df"
	    bind $top <<FingerUp>> [subst {
		if {%s == 1} {
		    [namespace current]::calib_seq $top 1 %x %y
		}
	    }]
	} elseif {$which == 1} {
	    $top.topright.m configure -background "#505075"
	    $top.bottomright.m configure -background "#df94df"
	    bind $top <<FingerUp>> [subst {
		if {%s == 1} {
		    [namespace current]::calib_seq $top 2 %x %y
		}
	    }]
	} elseif {$which == 2} {
	    $top.bottomright.m configure -background "#505075"
	    $top.bottomleft.m configure -background "#df94df"
	    bind $top <<FingerUp>> [subst {
		if {%s == 1} {
		    [namespace current]::calib_seq $top 3 %x %y
		}
	    }]
	} elseif {$which == 3} {
	    $top.bottomleft.m configure -background "#505075"
	    bind $top <<FingerUp>> {}

	    set swapxy 0
	    if {$cdata(xdev,0) < [expr {$cdata(xdev,3) - $thresh}] ||
		$cdata(xdev,0) > [expr {$cdata(xdev,3) + $thresh}] ||
		$cdata(xdev,1) < [expr {$cdata(xdev,2) - $thresh}] ||
		$cdata(xdev,1) > [expr {$cdata(xdev,2) + $thresh}]} {
		set swapxy 1
		set tmp $cdata(xdev,0)
		set cdata(xdev,0) $cdata(ydev,0)
		set cdata(ydev,0) $tmp
		set tmp $cdata(xdev,1)
		set cdata(xdev,1) $cdata(ydev,1)
		set cdata(ydev,1) $tmp
		set tmp $cdata(xdev,2)
		set cdata(xdev,2) $cdata(ydev,2)
		set cdata(ydev,2) $tmp
		set tmp $cdata(xdev,3)
		set cdata(xdev,3) $cdata(ydev,3)
		set cdata(ydev,3) $tmp
	    }

	    set boff [expr {double(($size / 2) + 1)}]
	    set wdev [expr {$cdata(xdev,1) - $cdata(xdev,0)}]
	    set wdev2 [expr {$cdata(xdev,2) - $cdata(xdev,3)}]
	    set wdev [expr {($wdev + $wdev2) / 2.0}]
	    set hdev [expr {$cdata(ydev,3) - $cdata(ydev,0)}]
	    set hdev2 [expr {$cdata(ydev,2) - $cdata(ydev,1)}]
	    set hdev [expr {($hdev + $hdev2) / 2.0}]
	    set wx [expr {1.0 * $scrw - (2 * $boff)}]
	    set hx [expr {1.0 * $scrh - (2 * $boff)}]

	    set xdevmin [expr {$cdata(xdev,0) - ($boff * $wdev / $wx)}]
	    set xdevmin2 [expr {$cdata(xdev,3) - ($boff * $wdev / $wx)}]
	    set xdevmin [expr {($xdevmin + $xdevmin2) / 2.0}]
	    set xdevmax [expr {$cdata(xdev,1) + ($boff * $wdev / $wx)}]
	    set xdevmax2 [expr {$cdata(xdev,2) + ($boff * $wdev / $wx)}]
	    set xdevmax [expr {($xdevmax + $xdevmax2) / 2.0}]

	    set ydevmin [expr {$cdata(ydev,0) - ($boff * $hdev / $hx)}]
	    set ydevmin2 [expr {$cdata(ydev,1) - ($boff * $hdev / $hx)}]
	    set ydevmin [expr {($ydevmin + $ydevmin2) / 2.0}]
	    set ydevmax [expr {$cdata(ydev,3) + ($boff * $hdev / $hx)}]
	    set ydevmax2 [expr {$cdata(ydev,2) + ($boff * $hdev / $hx)}]
	    set ydevmax [expr {($ydevmax + $ydevmax2) / 2.0}]

	    set data [list [expr {round($xdevmin)}] \
		[expr {round($xdevmax)}] \
		[expr {round($ydevmin)}] \
		[expr {round($ydevmax)}]]
	    if {$swapxy} {
		lappend data 1
	    }

	    $top.cal.doit configure -state normal
	    destroy $top.topleft $top.bottomleft \
		$top.topright $top.bottomright

	    catch {sdltk touchcalib {*}$lastcal}
	    set MSG1 "Old Calibration\n\n"
	    show_calib [namespace current]::MSG1
	    catch {sdltk touchcalib {*}$data}
	    if {![catch {set lastcal [sdltk touchcalib]}]} {
		set RESULT $lastcal
	    }
	    $top configure -cursor {}
	    set MSG2 "New Calibration\n\n"
	    show_calib [namespace current]::MSG2
	}
    }

    proc start_calib {top} {
	variable lastcal
	$top.cal.doit configure -state disabled
	draw_pad $top.topleft 1 1
	draw_pad $top.bottomleft 1 -1
	draw_pad $top.topright -1 1
	draw_pad $top.bottomright -1 -1
	update
	# Start calib sequence
	$top.topleft.m configure -background "#df94df"
	bind $top <<FingerUp>> [subst {
	    if {%s == 1} {
		[namespace current]::calib_seq $top 0 %x %y
	    }
	}]
	set lastcal {0 0 0 0 0}
	catch {set lastcal [sdltk touchcalib]}
	# reset to device defaults
	catch {sdltk touchcalib 0 0 0 0}
    }

    proc do_quit {top} {
	variable lastcal
	destroy $top
	catch {sdltk touchcalib {*}$lastcal}
    }

    proc calibrate {top} {
	variable scrw
	variable scrh
	variable thresh
	variable MSG1
	variable MSG2
	variable RESULT

	toplevel $top
	wm attributes $top -fullscreen 1
	set scrw [winfo screenwidth $top]
	set scrh [winfo screenheight $top]
	set thresh [expr {round($scrw * 0.2)}]
	$top configure -cursor {} -background black

	frame $top.msg -cursor {} -background black
	label $top.msg.m1 -textvariable [namespace current]::MSG1 \
	    -background black -foreground yellow \
	    -height 8 -width 40 -font {{DejaVu Sans Mono} 18} \
	    -padx 20 -pady 20 -justify left
	label $top.msg.m2 -textvariable [namespace current]::MSG2 \
	    -background black -foreground yellow \
	    -height 8 -width 40 -font {{DejaVu Sans Mono} 18} \
	    -padx 20 -pady 20 -justify left
	pack $top.msg -side bottom -fill x
	pack $top.msg.m1 $top.msg.m2 -side left -padx 20 -pady 60 -expand 1

	frame $top.cal -cursor {} -background black
	button $top.cal.doit -text "Calibrate Touchscreen" -underline 0 \
	    -command [list [namespace current]::start_calib $top] -width 22 \
	    -font {{DejaVu Sans} 24} -padx 20 -pady 20
	button $top.cal.quit -text "Quit" -underline 0 \
	    -command [list [namespace current]::do_quit $top] -width 22 \
	    -font {{DejaVu Sans} 24} -padx 20 -pady 20
	pack $top.cal -side bottom -fill both
	pack $top.cal.doit $top.cal.quit -side left -padx 20 -pady 20 -expand 1

	set MSG1 "Old Calibration\n\n"
	set MSG2 ""
	show_calib [namespace current]::MSG1

	bind $top <Escape> [list [namespace current]::do_quit %W]
	bind $top <q> [list [namespace current]::do_quit %W]
	bind $top <Q> [list [namespace current]::do_quit %W]
	bind $top <x> [list [namespace current]::do_quit %W]
	bind $top <X> [list [namespace current]::do_quit %W]
	bind $top <c> [list [namespace current]::start_calib %W]
	bind $top <C> [list [namespace current]::start_calib %W]

	update idletasks
	grab $top
	focus $top
	raise $top
	set RESULT {}
	while {[winfo exists $top]} {
	    tkwait window $top
	}
	return $RESULT
    }

}

package provide touchcal 0.1

Changes to jni/SDL2/include/SDL_touch.h.

70
71
72
73
74
75
76









77
78
79
80
81
82
83
84
85
86
 */
extern DECLSPEC int SDLCALL SDL_GetNumTouchFingers(SDL_TouchID touchID);

/**
 *  \brief Get the finger object of the given touch, with the given index.
 */
extern DECLSPEC SDL_Finger * SDLCALL SDL_GetTouchFinger(SDL_TouchID touchID, int index);










/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif
#include "close_code.h"

#endif /* SDL_touch_h_ */

/* vi: set ts=4 sw=4 expandtab: */







>
>
>
>
>
>
>
>
>










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
 */
extern DECLSPEC int SDLCALL SDL_GetNumTouchFingers(SDL_TouchID touchID);

/**
 *  \brief Get the finger object of the given touch, with the given index.
 */
extern DECLSPEC SDL_Finger * SDLCALL SDL_GetTouchFinger(SDL_TouchID touchID, int index);

#define SDL_EVDEV_TOUCHCALIBRATION 1

#ifdef SDL_EVDEV_TOUCHCALIBRATION
/**
 *  \brief Get/set calibration of first EVDEV touchscreen.
 */
extern DECLSPEC int SDLCALL SDL_EVDEV_TouchCalibration(int op, int *calib);
#endif

/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif
#include "close_code.h"

#endif /* SDL_touch_h_ */

/* vi: set ts=4 sw=4 expandtab: */

Changes to jni/SDL2/src/core/linux/SDL_evdev.c.

89
90
91
92
93
94
95

96
97



98
99
100
101
102
103
104
...
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
...
277
278
279
280
281
282
283
284

285


286
287
288
289
290
291
292
...
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
...
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
...
499
500
501
502
503
504
505
506
507



508
509







510
511
512
513
514
515
516
...
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
...
860
861
862
863
864
865
866

867




868

869








































870
            int tracking_id;
            int x, y, pressure;
        } * slots;

        int pointerFingerID;
    } * touchscreen_data;


    int min_x, max_x, range_x;
    int min_y, max_y, range_y;




    struct SDL_evdevlist_item *next;
} SDL_evdevlist_item;

typedef struct SDL_EVDEV_PrivateData
{
    int ref_count;
................................................................................
    struct input_event events[32];
    int i, j, len;
    SDL_evdevlist_item *item;
    SDL_Scancode scan_code;
    int mouse_button;
    SDL_Mouse *mouse;
    float norm_x, norm_y, norm_pressure;
    int abs_x, abs_y, w, h, mt_x, mt_y, mt_id;
    SDL_MouseID mouseID;

    if (!_this) {
        return;
    }

#if SDL_USE_LIBUDEV
................................................................................
    SDL_UDEV_Poll();
#endif

    mouse = SDL_GetMouse();

    for (item = _this->first; item != NULL; item = item->next) {
        while ((len = read(item->fd, events, (sizeof events))) > 0) {
            mt_x = mt_y = mt_id = 0;
            len /= sizeof(events[0]);
            for (i = 0; i < len; ++i) {
                /* special handling for touchscreen, that should eventually be
                   used for all devices */
                if (item->out_of_sync && item->is_touchscreen &&
                    events[i].type == EV_SYN && events[i].code != SYN_REPORT) {
                    break;
................................................................................
                    /* BTN_TOUCH event value 1 indicates there is contact with
                       a touchscreen or trackpad (earliest finger's current
                       position is sent in EV_ABS ABS_X/ABS_Y, switching to
                       next finger after earliest is released) however using it
                       for virtual mouse SDL_TOUCH_MOUSEID would differ from
                       other SDL backends which require a new finger touch. */
                    if (events[i].code == BTN_TOUCH) {
                        if (mt_id == 0) {

                            mt_id = (events[i].value == 0) ? -2 : -1;


                        }
                        break;
                    }

                    /* Probably keyboard */
                    scan_code = SDL_EVDEV_translate_keycode(events[i].code);
                    if (scan_code != SDL_SCANCODE_UNKNOWN) {
................................................................................
                        if (!item->is_touchscreen) /* FIXME: temp hack */
                            break;
                        item->touchscreen_data->current_slot = events[i].value;
                        break;
                    case ABS_MT_TRACKING_ID:
                        if (!item->is_touchscreen) /* FIXME: temp hack */
                            break;
                        mt_id = 1;
                        if (events[i].value >= 0) {
                            item->touchscreen_data->slots[item->touchscreen_data->current_slot].tracking_id = events[i].value;
                            item->touchscreen_data->slots[item->touchscreen_data->current_slot].delta = EVDEV_TOUCH_SLOTDELTA_DOWN;
                        } else {
                            item->touchscreen_data->slots[item->touchscreen_data->current_slot].delta = EVDEV_TOUCH_SLOTDELTA_UP;
                        }
                        break;
                    case ABS_MT_POSITION_X:
                        if (!item->is_touchscreen) /* FIXME: temp hack */
                            break;
                        mt_x = 1;
                        item->touchscreen_data->slots[item->touchscreen_data->current_slot].x = events[i].value;
                        if (item->touchscreen_data->slots[item->touchscreen_data->current_slot].delta == EVDEV_TOUCH_SLOTDELTA_NONE) {
                            item->touchscreen_data->slots[item->touchscreen_data->current_slot].delta = EVDEV_TOUCH_SLOTDELTA_MOVE;
                        }
                        break;
                    case ABS_MT_POSITION_Y:
                        if (!item->is_touchscreen) /* FIXME: temp hack */
                            break;
                        mt_y = 1;
                        item->touchscreen_data->slots[item->touchscreen_data->current_slot].y = events[i].value;
                        if (item->touchscreen_data->slots[item->touchscreen_data->current_slot].delta == EVDEV_TOUCH_SLOTDELTA_NONE) {
                            item->touchscreen_data->slots[item->touchscreen_data->current_slot].delta = EVDEV_TOUCH_SLOTDELTA_MOVE;
                        }
                        break;
                    case ABS_MT_PRESSURE:
                        if (!item->is_touchscreen) /* FIXME: temp hack */
................................................................................
                            break;
                        item->touchscreen_data->slots[item->touchscreen_data->current_slot].pressure = events[i].value;
                        if (item->touchscreen_data->slots[item->touchscreen_data->current_slot].delta == EVDEV_TOUCH_SLOTDELTA_NONE) {
                            item->touchscreen_data->slots[item->touchscreen_data->current_slot].delta = EVDEV_TOUCH_SLOTDELTA_MOVE;
                        }
                        break;
                    case ABS_X:
                        if (item->is_touchscreen && mt_x) /* FIXME: temp hack */
                            break;




                        abs_x = events[i].value;
                        if (item->range_x > 0) {
                            SDL_GetWindowSize(mouse->focus, &w, &h);
                            norm_x = (float)(abs_x - item->min_x) / (float)item->range_x;
                            abs_x = (w + mouse->add_w) * norm_x - mouse->off_x;
                            if (abs_x < 0) {
                                abs_x = 0;
                            } else if (abs_x > w) {
                                abs_x = w;
                            }







                            mouseID = SDL_TOUCH_MOUSEID;
                        } else {
                            mouseID = mouse->mouseID;
                        }
                        SDL_SendMouseMotion(mouse->focus, mouseID, SDL_FALSE, abs_x, mouse->y);
                        break;
                    case ABS_Y:
                        if (item->is_touchscreen && mt_y) /* FIXME: temp hack */
                            break;




                        abs_y = events[i].value;
                        if (item->range_y > 0) {
                            SDL_GetWindowSize(mouse->focus, &w, &h);
                            norm_y = (float)(abs_y - item->min_y) / (float)item->range_y;
                            abs_y = (h + mouse->add_h) * norm_y - mouse->off_y;
                            if (abs_y < 0) {
                                abs_y = 0;
                            } else if (abs_y > h) {
                                abs_y = h;
                            }







                            mouseID = SDL_TOUCH_MOUSEID;
                        } else {
                            mouseID = mouse->mouseID;
                        }
                        SDL_SendMouseMotion(mouse->focus, mouseID, SDL_FALSE, mouse->x, abs_y);
                        break;
                    default:
................................................................................
                            case EVDEV_TOUCH_SLOTDELTA_DOWN:
                            case EVDEV_TOUCH_SLOTDELTA_MOVE:
                                SDL_GetWindowSize(mouse->focus, &w, &h);
                                if (item->touchscreen_data->range_x > w + mouse->add_w) {
                                    abs_x = (w + mouse->add_w) * norm_x - mouse->off_x;
                                    if (abs_x < 0) {
                                        abs_x = 0;
                                    } else if (abs_x > w) {
                                        abs_x = w;
                                    }
                                }
                                if (item->touchscreen_data->range_x > h + mouse->add_h) {
                                    abs_y = (h + mouse->add_h) * norm_y - mouse->off_y;
                                    if (abs_y < 0) {
                                        abs_y = 0;
                                    } else if (abs_y > h) {
                                        abs_y = h;
                                    }
                                }
                                break;
                            default:
                                break;
                            }

................................................................................
                        break;
                    default:
                        break;
                    }
                    break;
                }
            }
            if (mt_id < -1) {
                SDL_SendMouseButton(mouse->focus, SDL_TOUCH_MOUSEID, SDL_RELEASED, SDL_BUTTON_LEFT);



            } else if (mt_id < 0) {
                SDL_SendMouseButton(mouse->focus, SDL_TOUCH_MOUSEID, SDL_PRESSED, SDL_BUTTON_LEFT);







            }
        }
    }
}

static SDL_Scancode
SDL_EVDEV_translate_keycode(int keycode)
................................................................................
            close(item->fd);
            SDL_free(item);
            return ret;
        }
    }

    if (ioctl(item->fd, EVIOCGABS(ABS_X), &abs_info) >= 0) {
        item->min_x = abs_info.minimum;
        item->max_x = abs_info.maximum;
        item->range_x = abs_info.maximum - abs_info.minimum;
    }
    if (ioctl(item->fd, EVIOCGABS(ABS_Y), &abs_info) >= 0) {
        item->min_y = abs_info.minimum;
        item->max_y = abs_info.maximum;
        item->range_y = abs_info.maximum - abs_info.minimum;
    }

    if (_this->last == NULL) {
        _this->first = _this->last = item;
    } else {
        _this->last->next = item;
................................................................................
        }
        prev = item;
    }

    return -1;
}







#endif /* SDL_INPUT_LINUXEV */










































/* vi: set ts=4 sw=4 expandtab: */







>


>
>
>







 







|







 







|







 







|
>
|
>
>







 







|










|








|







 







|

<
>
>
>

|





|
|

>
>
>
>
>
>
>







|

<
>
>
>

|





|
|

>
>
>
>
>
>
>







 







|
|






|
|







 







|
|
>
>
>
|
|
>
>
>
>
>
>
>







 







|
|



|
|







 







>

>
>
>
>
|
>

>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
...
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
...
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
...
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
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
...
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
...
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
...
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
...
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
            int tracking_id;
            int x, y, pressure;
        } * slots;

        int pointerFingerID;
    } * touchscreen_data;

    int dev_min_x, dev_max_x, dev_min_y, dev_max_y;
    int min_x, max_x, range_x;
    int min_y, max_y, range_y;
    int swap_xy;

    float norm_x, norm_y;

    struct SDL_evdevlist_item *next;
} SDL_evdevlist_item;

typedef struct SDL_EVDEV_PrivateData
{
    int ref_count;
................................................................................
    struct input_event events[32];
    int i, j, len;
    SDL_evdevlist_item *item;
    SDL_Scancode scan_code;
    int mouse_button;
    SDL_Mouse *mouse;
    float norm_x, norm_y, norm_pressure;
    int abs_x, abs_y, w, h, flags;
    SDL_MouseID mouseID;

    if (!_this) {
        return;
    }

#if SDL_USE_LIBUDEV
................................................................................
    SDL_UDEV_Poll();
#endif

    mouse = SDL_GetMouse();

    for (item = _this->first; item != NULL; item = item->next) {
        while ((len = read(item->fd, events, (sizeof events))) > 0) {
            flags = 0;
            len /= sizeof(events[0]);
            for (i = 0; i < len; ++i) {
                /* special handling for touchscreen, that should eventually be
                   used for all devices */
                if (item->out_of_sync && item->is_touchscreen &&
                    events[i].type == EV_SYN && events[i].code != SYN_REPORT) {
                    break;
................................................................................
                    /* BTN_TOUCH event value 1 indicates there is contact with
                       a touchscreen or trackpad (earliest finger's current
                       position is sent in EV_ABS ABS_X/ABS_Y, switching to
                       next finger after earliest is released) however using it
                       for virtual mouse SDL_TOUCH_MOUSEID would differ from
                       other SDL backends which require a new finger touch. */
                    if (events[i].code == BTN_TOUCH) {
                        if ((flags & 0x04) == 0x00) {
                            flags |= 0x08;
                            if (events[i].value) {
                                flags |= 0x10;
                            }
                        }
                        break;
                    }

                    /* Probably keyboard */
                    scan_code = SDL_EVDEV_translate_keycode(events[i].code);
                    if (scan_code != SDL_SCANCODE_UNKNOWN) {
................................................................................
                        if (!item->is_touchscreen) /* FIXME: temp hack */
                            break;
                        item->touchscreen_data->current_slot = events[i].value;
                        break;
                    case ABS_MT_TRACKING_ID:
                        if (!item->is_touchscreen) /* FIXME: temp hack */
                            break;
                        flags |= 0x04;
                        if (events[i].value >= 0) {
                            item->touchscreen_data->slots[item->touchscreen_data->current_slot].tracking_id = events[i].value;
                            item->touchscreen_data->slots[item->touchscreen_data->current_slot].delta = EVDEV_TOUCH_SLOTDELTA_DOWN;
                        } else {
                            item->touchscreen_data->slots[item->touchscreen_data->current_slot].delta = EVDEV_TOUCH_SLOTDELTA_UP;
                        }
                        break;
                    case ABS_MT_POSITION_X:
                        if (!item->is_touchscreen) /* FIXME: temp hack */
                            break;
                        flags |= 0x01;
                        item->touchscreen_data->slots[item->touchscreen_data->current_slot].x = events[i].value;
                        if (item->touchscreen_data->slots[item->touchscreen_data->current_slot].delta == EVDEV_TOUCH_SLOTDELTA_NONE) {
                            item->touchscreen_data->slots[item->touchscreen_data->current_slot].delta = EVDEV_TOUCH_SLOTDELTA_MOVE;
                        }
                        break;
                    case ABS_MT_POSITION_Y:
                        if (!item->is_touchscreen) /* FIXME: temp hack */
                            break;
                        flags |= 0x02;
                        item->touchscreen_data->slots[item->touchscreen_data->current_slot].y = events[i].value;
                        if (item->touchscreen_data->slots[item->touchscreen_data->current_slot].delta == EVDEV_TOUCH_SLOTDELTA_NONE) {
                            item->touchscreen_data->slots[item->touchscreen_data->current_slot].delta = EVDEV_TOUCH_SLOTDELTA_MOVE;
                        }
                        break;
                    case ABS_MT_PRESSURE:
                        if (!item->is_touchscreen) /* FIXME: temp hack */
................................................................................
                            break;
                        item->touchscreen_data->slots[item->touchscreen_data->current_slot].pressure = events[i].value;
                        if (item->touchscreen_data->slots[item->touchscreen_data->current_slot].delta == EVDEV_TOUCH_SLOTDELTA_NONE) {
                            item->touchscreen_data->slots[item->touchscreen_data->current_slot].delta = EVDEV_TOUCH_SLOTDELTA_MOVE;
                        }
                        break;
                    case ABS_X:
                        if (item->is_touchscreen && (flags & 0x01)) /* FIXME: temp hack */
                            break;

                        if (item->swap_xy)
                            goto do_abs_y;
                    do_abs_x:
                        abs_x = events[i].value;
                        if (item->range_x != 0) {
                            SDL_GetWindowSize(mouse->focus, &w, &h);
                            norm_x = (float)(abs_x - item->min_x) / (float)item->range_x;
                            abs_x = (w + mouse->add_w) * norm_x - mouse->off_x;
                            if (abs_x < 0) {
                                abs_x = 0;
                            } else if (abs_x >= w) {
                                abs_x = w - 1;
                            }
                            item->norm_x = norm_x;
                            if (item->norm_x < 0.0) {
                                item->norm_x = 0.0;
                            } else if (item->norm_x > 1.0) {
                                item->norm_x = 1.0;
                            }
                            flags |= 0x20;
                            mouseID = SDL_TOUCH_MOUSEID;
                        } else {
                            mouseID = mouse->mouseID;
                        }
                        SDL_SendMouseMotion(mouse->focus, mouseID, SDL_FALSE, abs_x, mouse->y);
                        break;
                    case ABS_Y:
                        if (item->is_touchscreen && (flags & 0x02)) /* FIXME: temp hack */
                            break;

                        if (item->swap_xy)
                            goto do_abs_x;
                    do_abs_y:
                        abs_y = events[i].value;
                        if (item->range_y != 0) {
                            SDL_GetWindowSize(mouse->focus, &w, &h);
                            norm_y = (float)(abs_y - item->min_y) / (float)item->range_y;
                            abs_y = (h + mouse->add_h) * norm_y - mouse->off_y;
                            if (abs_y < 0) {
                                abs_y = 0;
                            } else if (abs_y >= h) {
                                abs_y = h - 1;
                            }
                            item->norm_y = norm_y;
                            if (item->norm_y < 0.0) {
                                item->norm_y = 0.0;
                            } else if (item->norm_y > 1.0) {
                                item->norm_y = 1.0;
                            }
                            flags |= 0x20;
                            mouseID = SDL_TOUCH_MOUSEID;
                        } else {
                            mouseID = mouse->mouseID;
                        }
                        SDL_SendMouseMotion(mouse->focus, mouseID, SDL_FALSE, mouse->x, abs_y);
                        break;
                    default:
................................................................................
                            case EVDEV_TOUCH_SLOTDELTA_DOWN:
                            case EVDEV_TOUCH_SLOTDELTA_MOVE:
                                SDL_GetWindowSize(mouse->focus, &w, &h);
                                if (item->touchscreen_data->range_x > w + mouse->add_w) {
                                    abs_x = (w + mouse->add_w) * norm_x - mouse->off_x;
                                    if (abs_x < 0) {
                                        abs_x = 0;
                                    } else if (abs_x >= w) {
                                        abs_x = w - 1;
                                    }
                                }
                                if (item->touchscreen_data->range_x > h + mouse->add_h) {
                                    abs_y = (h + mouse->add_h) * norm_y - mouse->off_y;
                                    if (abs_y < 0) {
                                        abs_y = 0;
                                    } else if (abs_y >= h) {
                                        abs_y = h - 1;
                                    }
                                }
                                break;
                            default:
                                break;
                            }

................................................................................
                        break;
                    default:
                        break;
                    }
                    break;
                }
            }
            if (flags & 0x10) {
                SDL_SendMouseButton(mouse->focus, SDL_TOUCH_MOUSEID, SDL_PRESSED, SDL_BUTTON_LEFT);
                if (item->is_touchscreen) {
                    SDL_SendTouch(item->fd, 0, SDL_TRUE, item->norm_x, item->norm_y, 1.0f);
                }
            } else if (flags & 0x08) {
                SDL_SendMouseButton(mouse->focus, SDL_TOUCH_MOUSEID, SDL_RELEASED, SDL_BUTTON_LEFT);
                if (item->is_touchscreen) {
                    SDL_SendTouch(item->fd, 0, SDL_FALSE, item->norm_x, item->norm_y, 1.0f);
                }
            } else if (flags & 0x20) {
                if (item->is_touchscreen) {
                    SDL_SendTouchMotion(item->fd, 0, item->norm_x, item->norm_y, 1.0f);
                }
            }
        }
    }
}

static SDL_Scancode
SDL_EVDEV_translate_keycode(int keycode)
................................................................................
            close(item->fd);
            SDL_free(item);
            return ret;
        }
    }

    if (ioctl(item->fd, EVIOCGABS(ABS_X), &abs_info) >= 0) {
        item->dev_min_x = item->min_x = abs_info.minimum;
        item->dev_max_x = item->max_x = abs_info.maximum;
        item->range_x = abs_info.maximum - abs_info.minimum;
    }
    if (ioctl(item->fd, EVIOCGABS(ABS_Y), &abs_info) >= 0) {
        item->dev_min_y = item->min_y = abs_info.minimum;
        item->dev_max_y = item->max_y = abs_info.maximum;
        item->range_y = abs_info.maximum - abs_info.minimum;
    }

    if (_this->last == NULL) {
        _this->first = _this->last = item;
    } else {
        _this->last->next = item;
................................................................................
        }
        prev = item;
    }

    return -1;
}

#endif /* SDL_INPUT_LINUXEV */

#ifdef SDL_EVDEV_TOUCHCALIBRATION
int
SDL_EVDEV_TouchCalibration(int op, int *calib)
{
#ifdef SDL_INPUT_LINUXEV
    SDL_evdevlist_item *item;

    /* Support one (first) touchscreen only */
    for (item = _this->first; item != NULL; item = item->next) {
        if (item->is_touchscreen) {
            if (op > 0) {
                /* set */
                if (calib[0] == calib[1] || calib[2] == calib[3]) {
                    return -1;
                }
                item->min_x = calib[0];
                item->max_x = calib[1];
                item->min_y = calib[2];
                item->max_y = calib[3];
                item->swap_xy = calib[4] != 0;
                item->range_x = item->max_x - item->min_x;
                item->range_y = item->max_y - item->min_y;
            } else if (op < 0) {
                /* reset */
                item->swap_xy = 0;
                item->min_x = item->dev_min_x;
                item->max_x = item->dev_max_x;
                item->min_y = item->dev_min_y;
                item->max_y = item->dev_max_y;
                item->range_x = item->max_x - item->min_x;
                item->range_y = item->max_y - item->min_y;
            } else {
                /* get */
                calib[4] = item->swap_xy;
                calib[0] = calib[4] ? item->min_y : item->min_x;
                calib[1] = calib[4] ? item->max_y : item->max_x;
                calib[2] = calib[4] ? item->min_x : item->min_y;
                calib[3] = calib[4] ? item->max_x : item->max_y;
            }
            return 0;
        }
    }
#endif
    return -1;
}
#endif /* SDL_EVDEV_TOUCHCALIBRATION */

/* vi: set ts=4 sw=4 expandtab: */

Changes to jni/sdl2tk/sdl/SdlTkInt.c.

1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
....
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
....
4525
4526
4527
4528
4529
4530
4531


















































4532
4533
4534
4535
4536
4537
4538
....
4774
4775
4776
4777
4778
4779
4780

4781
4782
4783
4784
4785
4786
4787
	evname = "FingerUp";
	goto doFingerEvent;
    case SDL_FINGERMOTION:
	evname = "FingerMotion";
    doFingerEvent: {
	_Window *_w;
	Tk_Window tkwin = NULL;
#if defined(_WIN32) || defined(_WIN64)
	static char fbits[20];
	static SDL_FingerID fids[20];
	int i, b = -1, fingerId = -1;

	/* This snippet cannot handle more than one touch screen! */
	for (i = 0; i < sizeof (fbits); i++) {
	    if (fbits[i]) {
................................................................................
	    pressure = sdl_event->tfinger.pressure * 10000;
	    if (pressure >= 10000) {
		pressure = 9999;
	    } else if (pressure < 0) {
		pressure = 0;
	    }
	    event->xbutton.time = pressure;
#if defined(_WIN32) || defined(_WIN64)
	    event->xbutton.state = fingerId + 1;
#else
	    event->xbutton.state = sdl_event->tfinger.fingerId + 1;
#endif
	    ((XVirtualEvent *) event)->name = (Tk_Uid) evname;
	    return 1;
	}
................................................................................
    if (SDL_HasScreenKeyboardSupport()) {
	flag = SDL_IsScreenKeyboardShown(SdlTkX.sdlscreen);
    }
    SdlTkUnlock(NULL);
    Tcl_SetBooleanObj(Tcl_GetObjResult(interp), flag);
    return ret;
}



















































static int
TouchtranslateObjCmd(ClientData clientData, Tcl_Interp *interp,
		     int objc, Tcl_Obj *const objv[])
{
#ifdef ANDROID
    int flag = TranslateInfo.enabled;
................................................................................
    { "pointer", PointerObjCmd, NULL },
    { "powerinfo", PowerinfoObjCmd, NULL },
    { "restore", RestoreObjCmd, NULL },
    { "root", RootObjCmd, NULL },
    { "screensaver", ScreensaverObjCmd, NULL },
    { "stat", StatObjCmd, NULL },
    { "textinput", TextinputObjCmd, NULL },

    { "touchtranslate", TouchtranslateObjCmd, NULL },
    { "viewport", ViewportObjCmd, NULL },
    { "vrmode", VRModeObjCmd, NULL },
    { "vsync", VsyncObjCmd, NULL },
    { "withdraw", WithdrawObjCmd, NULL },
    { NULL, NULL, NULL }
};







|







 







|







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







>







1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
....
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
....
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
....
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
	evname = "FingerUp";
	goto doFingerEvent;
    case SDL_FINGERMOTION:
	evname = "FingerMotion";
    doFingerEvent: {
	_Window *_w;
	Tk_Window tkwin = NULL;
#ifndef ANDROID
	static char fbits[20];
	static SDL_FingerID fids[20];
	int i, b = -1, fingerId = -1;

	/* This snippet cannot handle more than one touch screen! */
	for (i = 0; i < sizeof (fbits); i++) {
	    if (fbits[i]) {
................................................................................
	    pressure = sdl_event->tfinger.pressure * 10000;
	    if (pressure >= 10000) {
		pressure = 9999;
	    } else if (pressure < 0) {
		pressure = 0;
	    }
	    event->xbutton.time = pressure;
#ifndef ANDROID
	    event->xbutton.state = fingerId + 1;
#else
	    event->xbutton.state = sdl_event->tfinger.fingerId + 1;
#endif
	    ((XVirtualEvent *) event)->name = (Tk_Uid) evname;
	    return 1;
	}
................................................................................
    if (SDL_HasScreenKeyboardSupport()) {
	flag = SDL_IsScreenKeyboardShown(SdlTkX.sdlscreen);
    }
    SdlTkUnlock(NULL);
    Tcl_SetBooleanObj(Tcl_GetObjResult(interp), flag);
    return ret;
}

static int
TouchcalibObjCmd(ClientData clientData, Tcl_Interp *interp,
		 int objc, Tcl_Obj *const objv[])
{
    int i, calib[5];

    if (objc != 1 && objc != 5 && objc != 6) {
	Tcl_WrongNumArgs(interp, 1, objv, "?minx maxx miny maxy ?swapxy??");
	return TCL_ERROR;
    }
    if (objc > 1) {
	calib[4] = 0;
	for (i = 0; i < 4; i++) {
	    if (Tcl_GetIntFromObj(interp, objv[i + 1], calib + i) != TCL_OK) {
		return TCL_ERROR;
	    }
	}
	if (objc > 5) {
	    if (Tcl_GetBooleanFromObj(interp, objv[5], calib + 4) != TCL_OK) {
		return TCL_ERROR;
	    }
	}
#if defined(linux) && !defined(ANDROID) && defined(SDL_EVDEV_TOUCHCALIBRATION)
	if ((calib[0] == 0) && (calib[1] == 0) &&
	    (calib[2] == 0) && (calib[3] == 0)) {
	    i = -1;	/* reset to device defaults */
	} else {
	    i = 1;	/* set to new bounds */
	}
	SdlTkLock(NULL);
	SDL_EVDEV_TouchCalibration(i, calib);
	SdlTkUnlock(NULL);
#endif
    } else {
	Tcl_Obj *objs[5];

	calib[0] = calib[1] = calib[2] = calib[3] = calib[4] = 0;
#if defined(linux) && !defined(ANDROID) && defined(SDL_EVDEV_TOUCHCALIBRATION)
	SdlTkLock(NULL);
	SDL_EVDEV_TouchCalibration(0, calib);
	SdlTkUnlock(NULL);
#endif
	for (i = 0; i < 5; i++) {
	    objs[i] = Tcl_NewIntObj(calib[i]);
	}
	Tcl_SetObjResult(interp, Tcl_NewListObj(5, objs));
    }
    return TCL_OK;
}

static int
TouchtranslateObjCmd(ClientData clientData, Tcl_Interp *interp,
		     int objc, Tcl_Obj *const objv[])
{
#ifdef ANDROID
    int flag = TranslateInfo.enabled;
................................................................................
    { "pointer", PointerObjCmd, NULL },
    { "powerinfo", PowerinfoObjCmd, NULL },
    { "restore", RestoreObjCmd, NULL },
    { "root", RootObjCmd, NULL },
    { "screensaver", ScreensaverObjCmd, NULL },
    { "stat", StatObjCmd, NULL },
    { "textinput", TextinputObjCmd, NULL },
    { "touchcalibration", TouchcalibObjCmd, NULL },
    { "touchtranslate", TouchtranslateObjCmd, NULL },
    { "viewport", ViewportObjCmd, NULL },
    { "vrmode", VRModeObjCmd, NULL },
    { "vsync", VsyncObjCmd, NULL },
    { "withdraw", WithdrawObjCmd, NULL },
    { NULL, NULL, NULL }
};

Changes to undroid/build-undroidwish-generic.sh.

1723
1724
1725
1726
1727
1728
1729

1730
1731
1732
1733
1734
1735
1736
  cp -rp ${PFX_HERE}/lib/topcua* assets
  cp -rp ${PFX_HERE}/lib/parse_args* assets
  if test -d ${PFX_HERE}/lib/tkvlc* ; then
    cp -rp ${PFX_HERE}/lib/tkvlc* assets
  fi
  if test "$(uname -o)" = "GNU/Linux" ; then
    cp -rp ${AWDIR}/undroid/mkappimg assets

  fi 
  # add shortcuts providing builtin:widget, builtin:tksqlite, etc.
  (
    cd assets
    echo > widget \
      'source [file dirname [info script]]/'$(echo sdl2tk*)'/demos/widget'
    echo > tksqlite \







>







1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
  cp -rp ${PFX_HERE}/lib/topcua* assets
  cp -rp ${PFX_HERE}/lib/parse_args* assets
  if test -d ${PFX_HERE}/lib/tkvlc* ; then
    cp -rp ${PFX_HERE}/lib/tkvlc* assets
  fi
  if test "$(uname -o)" = "GNU/Linux" ; then
    cp -rp ${AWDIR}/undroid/mkappimg assets
    cp -rp ${AWDIR}/assets/touchcal* assets
  fi 
  # add shortcuts providing builtin:widget, builtin:tksqlite, etc.
  (
    cd assets
    echo > widget \
      'source [file dirname [info script]]/'$(echo sdl2tk*)'/demos/widget'
    echo > tksqlite \

Changes to undroid/build-undroidwish-kmsdrm.sh.

1659
1660
1661
1662
1663
1664
1665

1666
1667
1668
1669
1670
1671
1672
  cp -rp ${PFX_HERE}/lib/tclcompiler* assets
  cp -rp ${PFX_HERE}/lib/fswatch* assets
  cp -rp ${PFX_HERE}/lib/tserialport* assets
  cp -rp ${PFX_HERE}/lib/topcua* assets
  cp -rp ${PFX_HERE}/lib/parse_args* assets
  cp -rp ${PFX_HERE}/lib/tkvlc* assets
  cp -rp ${AWDIR}/undroid/mkappimg assets

  # add shortcuts providing builtin:widget, builtin:tksqlite, etc.
  (
    cd assets
    echo > widget \
      'source [file dirname [info script]]/'$(echo sdl2tk*)'/demos/widget'
    echo > tksqlite \
      'source [file dirname [info script]]/'$(echo tksqlite*)'/tksqlite.tcl'







>







1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
  cp -rp ${PFX_HERE}/lib/tclcompiler* assets
  cp -rp ${PFX_HERE}/lib/fswatch* assets
  cp -rp ${PFX_HERE}/lib/tserialport* assets
  cp -rp ${PFX_HERE}/lib/topcua* assets
  cp -rp ${PFX_HERE}/lib/parse_args* assets
  cp -rp ${PFX_HERE}/lib/tkvlc* assets
  cp -rp ${AWDIR}/undroid/mkappimg assets
  cp -rp ${AWDIR}/assets/touchcal* assets
  # add shortcuts providing builtin:widget, builtin:tksqlite, etc.
  (
    cd assets
    echo > widget \
      'source [file dirname [info script]]/'$(echo sdl2tk*)'/demos/widget'
    echo > tksqlite \
      'source [file dirname [info script]]/'$(echo tksqlite*)'/tksqlite.tcl'

Changes to undroid/build-undroidwish-linux32.sh.

1685
1686
1687
1688
1689
1690
1691

1692
1693
1694
1695
1696
1697
1698
  cp -rp ${PFX_HERE}/lib/tclcompiler* assets
  cp -rp ${PFX_HERE}/lib/fswatch* assets
  cp -rp ${PFX_HERE}/lib/tserialport* assets
  cp -rp ${PFX_HERE}/lib/topcua* assets
  cp -rp ${PFX_HERE}/lib/parse_args* assets
  cp -rp ${PFX_HERE}/lib/tkvlc* assets
  cp -rp ${AWDIR}/undroid/mkappimg assets

  # add shortcuts providing builtin:widget, builtin:tksqlite, etc.
  (
    cd assets
    echo > widget \
      'source [file dirname [info script]]/'$(echo sdl2tk*)'/demos/widget'
    echo > tksqlite \
      'source [file dirname [info script]]/'$(echo tksqlite*)'/tksqlite.tcl'







>







1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
  cp -rp ${PFX_HERE}/lib/tclcompiler* assets
  cp -rp ${PFX_HERE}/lib/fswatch* assets
  cp -rp ${PFX_HERE}/lib/tserialport* assets
  cp -rp ${PFX_HERE}/lib/topcua* assets
  cp -rp ${PFX_HERE}/lib/parse_args* assets
  cp -rp ${PFX_HERE}/lib/tkvlc* assets
  cp -rp ${AWDIR}/undroid/mkappimg assets
  cp -rp ${AWDIR}/assets/touchcal* assets
  # add shortcuts providing builtin:widget, builtin:tksqlite, etc.
  (
    cd assets
    echo > widget \
      'source [file dirname [info script]]/'$(echo sdl2tk*)'/demos/widget'
    echo > tksqlite \
      'source [file dirname [info script]]/'$(echo tksqlite*)'/tksqlite.tcl'

Changes to undroid/build-undroidwish-linux64.sh.

1684
1685
1686
1687
1688
1689
1690

1691
1692
1693
1694
1695
1696
1697
  cp -rp ${PFX_HERE}/lib/tclcompiler* assets
  cp -rp ${PFX_HERE}/lib/fswatch* assets
  cp -rp ${PFX_HERE}/lib/tserialport* assets
  cp -rp ${PFX_HERE}/lib/topcua* assets
  cp -rp ${PFX_HERE}/lib/parse_args* assets
  cp -rp ${PFX_HERE}/lib/tkvlc* assets
  cp -rp ${AWDIR}/undroid/mkappimg assets

  # add shortcuts providing builtin:widget, builtin:tksqlite, etc.
  (
    cd assets
    echo > widget \
      'source [file dirname [info script]]/'$(echo sdl2tk*)'/demos/widget'
    echo > tksqlite \
      'source [file dirname [info script]]/'$(echo tksqlite*)'/tksqlite.tcl'







>







1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
  cp -rp ${PFX_HERE}/lib/tclcompiler* assets
  cp -rp ${PFX_HERE}/lib/fswatch* assets
  cp -rp ${PFX_HERE}/lib/tserialport* assets
  cp -rp ${PFX_HERE}/lib/topcua* assets
  cp -rp ${PFX_HERE}/lib/parse_args* assets
  cp -rp ${PFX_HERE}/lib/tkvlc* assets
  cp -rp ${AWDIR}/undroid/mkappimg assets
  cp -rp ${AWDIR}/assets/touchcal* assets
  # add shortcuts providing builtin:widget, builtin:tksqlite, etc.
  (
    cd assets
    echo > widget \
      'source [file dirname [info script]]/'$(echo sdl2tk*)'/demos/widget'
    echo > tksqlite \
      'source [file dirname [info script]]/'$(echo tksqlite*)'/tksqlite.tcl'

Changes to undroid/build-undroidwish-wayland.sh.

1659
1660
1661
1662
1663
1664
1665

1666
1667
1668
1669
1670
1671
1672
  cp -rp ${PFX_HERE}/lib/tclcompiler* assets
  cp -rp ${PFX_HERE}/lib/fswatch* assets
  cp -rp ${PFX_HERE}/lib/tserialport* assets
  cp -rp ${PFX_HERE}/lib/topcua* assets
  cp -rp ${PFX_HERE}/lib/parse_args* assets
  cp -rp ${PFX_HERE}/lib/tkvlc* assets
  cp -rp ${AWDIR}/undroid/mkappimg assets

  # add shortcuts providing builtin:widget, builtin:tksqlite, etc.
  (
    cd assets
    echo > widget \
      'source [file dirname [info script]]/'$(echo sdl2tk*)'/demos/widget'
    echo > tksqlite \
      'source [file dirname [info script]]/'$(echo tksqlite*)'/tksqlite.tcl'







>







1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
  cp -rp ${PFX_HERE}/lib/tclcompiler* assets
  cp -rp ${PFX_HERE}/lib/fswatch* assets
  cp -rp ${PFX_HERE}/lib/tserialport* assets
  cp -rp ${PFX_HERE}/lib/topcua* assets
  cp -rp ${PFX_HERE}/lib/parse_args* assets
  cp -rp ${PFX_HERE}/lib/tkvlc* assets
  cp -rp ${AWDIR}/undroid/mkappimg assets
  cp -rp ${AWDIR}/assets/touchcal* assets
  # add shortcuts providing builtin:widget, builtin:tksqlite, etc.
  (
    cd assets
    echo > widget \
      'source [file dirname [info script]]/'$(echo sdl2tk*)'/demos/widget'
    echo > tksqlite \
      'source [file dirname [info script]]/'$(echo tksqlite*)'/tksqlite.tcl'