mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-07 18:35:34 +00:00
ui/app: scale touch events by surface scale
Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
@@ -451,7 +451,10 @@ func gio_onRegistryGlobalRemove(data unsafe.Pointer, reg *C.struct_wl_registry,
|
|||||||
func gio_onTouchDown(data unsafe.Pointer, touch *C.struct_wl_touch, serial, t C.uint32_t, surf *C.struct_wl_surface, id C.int32_t, x, y C.wl_fixed_t) {
|
func gio_onTouchDown(data unsafe.Pointer, touch *C.struct_wl_touch, serial, t C.uint32_t, surf *C.struct_wl_surface, id C.int32_t, x, y C.wl_fixed_t) {
|
||||||
w := winMap[surf]
|
w := winMap[surf]
|
||||||
winMap[touch] = w
|
winMap[touch] = w
|
||||||
w.lastTouch = f32.Point{X: fromFixed(x), Y: fromFixed(y)}
|
w.lastTouch = f32.Point{
|
||||||
|
X: fromFixed(x) * float32(w.scale),
|
||||||
|
Y: fromFixed(y) * float32(w.scale),
|
||||||
|
}
|
||||||
w.w.event(pointer.Event{
|
w.w.event(pointer.Event{
|
||||||
Type: pointer.Press,
|
Type: pointer.Press,
|
||||||
Source: pointer.Touch,
|
Source: pointer.Touch,
|
||||||
@@ -476,7 +479,10 @@ func gio_onTouchUp(data unsafe.Pointer, touch *C.struct_wl_touch, serial, t C.ui
|
|||||||
//export gio_onTouchMotion
|
//export gio_onTouchMotion
|
||||||
func gio_onTouchMotion(data unsafe.Pointer, touch *C.struct_wl_touch, t C.uint32_t, id C.int32_t, x, y C.wl_fixed_t) {
|
func gio_onTouchMotion(data unsafe.Pointer, touch *C.struct_wl_touch, t C.uint32_t, id C.int32_t, x, y C.wl_fixed_t) {
|
||||||
w := winMap[touch]
|
w := winMap[touch]
|
||||||
w.lastTouch = f32.Point{X: fromFixed(x), Y: fromFixed(y)}
|
w.lastTouch = f32.Point{
|
||||||
|
X: fromFixed(x) * float32(w.scale),
|
||||||
|
Y: fromFixed(y) * float32(w.scale),
|
||||||
|
}
|
||||||
w.w.event(pointer.Event{
|
w.w.event(pointer.Event{
|
||||||
Type: pointer.Move,
|
Type: pointer.Move,
|
||||||
Position: w.lastTouch,
|
Position: w.lastTouch,
|
||||||
|
|||||||
Reference in New Issue
Block a user