Harry Cutts | b57f170 | 2022-11-28 15:34:22 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2022 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #pragma once |
| 18 | |
| 19 | #include <PointerControllerInterface.h> |
| 20 | #include <gui/constants.h> |
| 21 | #include <input/DisplayViewport.h> |
| 22 | #include <input/Input.h> |
| 23 | #include <utils/BitSet.h> |
| 24 | |
| 25 | namespace android { |
| 26 | |
| 27 | class FakePointerController : public PointerControllerInterface { |
| 28 | public: |
| 29 | virtual ~FakePointerController() {} |
| 30 | |
| 31 | void setBounds(float minX, float minY, float maxX, float maxY); |
| 32 | const std::map<int32_t, std::vector<int32_t>>& getSpots(); |
| 33 | |
| 34 | void setPosition(float x, float y) override; |
| 35 | void setButtonState(int32_t buttonState) override; |
| 36 | int32_t getButtonState() const override; |
| 37 | void getPosition(float* outX, float* outY) const override; |
| 38 | int32_t getDisplayId() const override; |
| 39 | void setDisplayViewport(const DisplayViewport& viewport) override; |
| 40 | |
Harry Cutts | ce86cc3 | 2022-12-14 20:36:33 +0000 | [diff] [blame^] | 41 | void assertPosition(float x, float y); |
| 42 | |
Harry Cutts | b57f170 | 2022-11-28 15:34:22 +0000 | [diff] [blame] | 43 | private: |
| 44 | bool getBounds(float* outMinX, float* outMinY, float* outMaxX, float* outMaxY) const override; |
| 45 | void move(float deltaX, float deltaY) override; |
| 46 | void fade(Transition) override {} |
| 47 | void unfade(Transition) override {} |
| 48 | void setPresentation(Presentation) override {} |
| 49 | void setSpots(const PointerCoords*, const uint32_t*, BitSet32 spotIdBits, |
| 50 | int32_t displayId) override; |
| 51 | void clearSpots() override; |
| 52 | |
| 53 | bool mHaveBounds{false}; |
| 54 | float mMinX{0}, mMinY{0}, mMaxX{0}, mMaxY{0}; |
| 55 | float mX{0}, mY{0}; |
| 56 | int32_t mButtonState{0}; |
| 57 | int32_t mDisplayId{ADISPLAY_ID_DEFAULT}; |
| 58 | |
| 59 | std::map<int32_t, std::vector<int32_t>> mSpotsByDisplay; |
| 60 | }; |
| 61 | |
| 62 | } // namespace android |