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 | |
Byoungho Jung | 9932645 | 2023-11-03 20:19:17 +0900 | [diff] [blame] | 27 | struct SpriteIcon { |
| 28 | PointerIconStyle style; |
| 29 | }; |
| 30 | |
Harry Cutts | b57f170 | 2022-11-28 15:34:22 +0000 | [diff] [blame] | 31 | class FakePointerController : public PointerControllerInterface { |
| 32 | public: |
| 33 | virtual ~FakePointerController() {} |
| 34 | |
| 35 | void setBounds(float minX, float minY, float maxX, float maxY); |
| 36 | const std::map<int32_t, std::vector<int32_t>>& getSpots(); |
| 37 | |
| 38 | void setPosition(float x, float y) override; |
Prabir Pradhan | 2719e82 | 2023-02-28 17:39:36 +0000 | [diff] [blame] | 39 | FloatPoint getPosition() const override; |
Harry Cutts | b57f170 | 2022-11-28 15:34:22 +0000 | [diff] [blame] | 40 | int32_t getDisplayId() const override; |
| 41 | void setDisplayViewport(const DisplayViewport& viewport) override; |
Byoungho Jung | 9932645 | 2023-11-03 20:19:17 +0900 | [diff] [blame] | 42 | void updatePointerIcon(PointerIconStyle iconId) override; |
| 43 | void setCustomPointerIcon(const SpriteIcon& icon) override; |
Prabir Pradhan | 6506f6f | 2023-12-11 20:48:39 +0000 | [diff] [blame^] | 44 | void fade(Transition) override; |
Harry Cutts | b57f170 | 2022-11-28 15:34:22 +0000 | [diff] [blame] | 45 | |
Byoungho Jung | ee6268f | 2023-10-30 17:27:26 +0900 | [diff] [blame] | 46 | void assertViewportSet(int32_t displayId); |
| 47 | void assertViewportNotSet(); |
Harry Cutts | ce86cc3 | 2022-12-14 20:36:33 +0000 | [diff] [blame] | 48 | void assertPosition(float x, float y); |
Prabir Pradhan | 1678879 | 2023-11-08 21:07:21 +0000 | [diff] [blame] | 49 | void assertSpotCount(int32_t displayId, int32_t count); |
Byoungho Jung | 9932645 | 2023-11-03 20:19:17 +0900 | [diff] [blame] | 50 | void assertPointerIconSet(PointerIconStyle iconId); |
| 51 | void assertPointerIconNotSet(); |
| 52 | void assertCustomPointerIconSet(PointerIconStyle iconId); |
| 53 | void assertCustomPointerIconNotSet(); |
Seunghwan Choi | 356026c | 2023-02-01 14:37:25 +0900 | [diff] [blame] | 54 | bool isPointerShown(); |
Harry Cutts | ce86cc3 | 2022-12-14 20:36:33 +0000 | [diff] [blame] | 55 | |
Harry Cutts | b57f170 | 2022-11-28 15:34:22 +0000 | [diff] [blame] | 56 | private: |
Byoungho Jung | da10dd3 | 2023-10-06 17:03:45 +0900 | [diff] [blame] | 57 | std::string dump() override { return ""; } |
Prabir Pradhan | 2719e82 | 2023-02-28 17:39:36 +0000 | [diff] [blame] | 58 | std::optional<FloatRect> getBounds() const override; |
Harry Cutts | b57f170 | 2022-11-28 15:34:22 +0000 | [diff] [blame] | 59 | void move(float deltaX, float deltaY) override; |
Seunghwan Choi | 356026c | 2023-02-01 14:37:25 +0900 | [diff] [blame] | 60 | void unfade(Transition) override; |
Harry Cutts | b57f170 | 2022-11-28 15:34:22 +0000 | [diff] [blame] | 61 | void setPresentation(Presentation) override {} |
| 62 | void setSpots(const PointerCoords*, const uint32_t*, BitSet32 spotIdBits, |
| 63 | int32_t displayId) override; |
| 64 | void clearSpots() override; |
| 65 | |
| 66 | bool mHaveBounds{false}; |
| 67 | float mMinX{0}, mMinY{0}, mMaxX{0}, mMaxY{0}; |
| 68 | float mX{0}, mY{0}; |
Byoungho Jung | ee6268f | 2023-10-30 17:27:26 +0900 | [diff] [blame] | 69 | std::optional<int32_t> mDisplayId; |
Seunghwan Choi | 356026c | 2023-02-01 14:37:25 +0900 | [diff] [blame] | 70 | bool mIsPointerShown{false}; |
Byoungho Jung | 9932645 | 2023-11-03 20:19:17 +0900 | [diff] [blame] | 71 | std::optional<PointerIconStyle> mIconStyle; |
| 72 | std::optional<PointerIconStyle> mCustomIconStyle; |
Harry Cutts | b57f170 | 2022-11-28 15:34:22 +0000 | [diff] [blame] | 73 | |
| 74 | std::map<int32_t, std::vector<int32_t>> mSpotsByDisplay; |
| 75 | }; |
| 76 | |
| 77 | } // namespace android |