2 * Copyright (C) 2017-2018 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
12 #include "input/touch/ITouchInputHandler.h"
17 #include <wayland-client-protocol.hpp>
27 * Touch input processor
29 * Events go directly to \ref CGenericTouchInputHandler, so no callbacks here
31 class CInputProcessorTouch final
: public IRawInputHandlerTouch
34 CInputProcessorTouch(wayland::surface_t
const& surface
);
35 ~CInputProcessorTouch() noexcept
;
36 void SetCoordinateScale(std::int32_t scale
) { m_coordinateScale
= scale
; }
38 void OnTouchDown(CSeat
* seat
,
41 const wayland::surface_t
& surface
,
45 void OnTouchUp(CSeat
* seat
, std::uint32_t serial
, std::uint32_t time
, std::int32_t id
) override
;
46 void OnTouchMotion(CSeat
* seat
, std::uint32_t time
, std::int32_t id
, double x
, double y
) override
;
47 void OnTouchCancel(CSeat
* seat
) override
;
48 void OnTouchShape(CSeat
* seat
, std::int32_t id
, double major
, double minor
) override
;
51 CInputProcessorTouch(CInputProcessorTouch
const& other
) = delete;
52 CInputProcessorTouch
& operator=(CInputProcessorTouch
const& other
) = delete;
56 std::uint32_t lastEventTime
;
57 /// Pointer number passed to \ref ITouchInputHandler
58 std::int32_t kodiPointerNumber
;
60 * Last coordinates - needed for TouchInputUp events where Wayland does not
61 * send new coordinates but Kodi needs them anyway
64 TouchPoint(std::uint32_t initialEventTime
, std::int32_t kodiPointerNumber
, float x
, float y
, float size
)
65 : lastEventTime
{initialEventTime
}, kodiPointerNumber
{kodiPointerNumber
}, x
{x
}, y
{y
}, size
{size
}
69 void SendTouchPointEvent(TouchInput event
, TouchPoint
const& point
);
70 void UpdateTouchPoint(TouchPoint
const& point
);
73 wayland::surface_t m_surface
;
74 std::int32_t m_coordinateScale
{1};
76 /// Map of wl_touch point id to data
77 std::map
<std::int32_t, TouchPoint
> m_touchPoints
;