[Windows] Fix driver version detection of AMD RDNA+ GPU on Windows 10
[xbmc.git] / xbmc / windowing / wayland / InputProcessorTouch.h
blobfa6f60697674cc2227e86c706783ec414f3dc7cb
1 /*
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.
7 */
9 #pragma once
11 #include "Seat.h"
12 #include "input/touch/ITouchInputHandler.h"
14 #include <cstdint>
15 #include <map>
17 #include <wayland-client-protocol.hpp>
19 namespace KODI
21 namespace WINDOWING
23 namespace WAYLAND
26 /**
27 * Touch input processor
29 * Events go directly to \ref CGenericTouchInputHandler, so no callbacks here
31 class CInputProcessorTouch final : public IRawInputHandlerTouch
33 public:
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,
39 std::uint32_t serial,
40 std::uint32_t time,
41 const wayland::surface_t& surface,
42 std::int32_t id,
43 double x,
44 double y) override;
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;
50 private:
51 CInputProcessorTouch(CInputProcessorTouch const& other) = delete;
52 CInputProcessorTouch& operator=(CInputProcessorTouch const& other) = delete;
54 struct TouchPoint
56 std::uint32_t lastEventTime;
57 /// Pointer number passed to \ref ITouchInputHandler
58 std::int32_t kodiPointerNumber;
59 /**
60 * Last coordinates - needed for TouchInputUp events where Wayland does not
61 * send new coordinates but Kodi needs them anyway
63 float x, y, size;
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);
71 void AbortTouches();
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;