summaryrefslogtreecommitdiff
path: root/include/input/DisplayViewport.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/input/DisplayViewport.h')
-rw-r--r--include/input/DisplayViewport.h34
1 files changed, 23 insertions, 11 deletions
diff --git a/include/input/DisplayViewport.h b/include/input/DisplayViewport.h
index 5e40ca7ece..2427a075a1 100644
--- a/include/input/DisplayViewport.h
+++ b/include/input/DisplayViewport.h
@@ -17,13 +17,12 @@
#ifndef _LIBINPUT_DISPLAY_VIEWPORT_H
#define _LIBINPUT_DISPLAY_VIEWPORT_H
-#include <android-base/stringprintf.h>
-#include <input/Input.h>
-#include <input/NamedEnum.h>
-
#include <cinttypes>
#include <optional>
+#include <android-base/stringprintf.h>
+#include <input/Input.h>
+
using android::base::StringPrintf;
namespace android {
@@ -40,11 +39,24 @@ enum {
* Keep in sync with values in InputManagerService.java.
*/
enum class ViewportType : int32_t {
- INTERNAL = 1,
- EXTERNAL = 2,
- VIRTUAL = 3,
+ VIEWPORT_INTERNAL = 1,
+ VIEWPORT_EXTERNAL = 2,
+ VIEWPORT_VIRTUAL = 3,
};
+static const char* viewportTypeToString(ViewportType type) {
+ switch(type) {
+ case ViewportType::VIEWPORT_INTERNAL:
+ return "INTERNAL";
+ case ViewportType::VIEWPORT_EXTERNAL:
+ return "EXTERNAL";
+ case ViewportType::VIEWPORT_VIRTUAL:
+ return "VIRTUAL";
+ default:
+ return "UNKNOWN";
+ }
+}
+
/*
* Describes how coordinates are mapped on a physical display.
* See com.android.server.display.DisplayViewport.
@@ -85,7 +97,7 @@ struct DisplayViewport {
isActive(false),
uniqueId(),
physicalPort(std::nullopt),
- type(ViewportType::INTERNAL) {}
+ type(ViewportType::VIEWPORT_INTERNAL) {}
bool operator==(const DisplayViewport& other) const {
return displayId == other.displayId && orientation == other.orientation &&
@@ -119,10 +131,10 @@ struct DisplayViewport {
physicalBottom = height;
deviceWidth = width;
deviceHeight = height;
- isActive = true;
+ isActive = false;
uniqueId.clear();
physicalPort = std::nullopt;
- type = ViewportType::INTERNAL;
+ type = ViewportType::VIEWPORT_INTERNAL;
}
std::string toString() const {
@@ -131,7 +143,7 @@ struct DisplayViewport {
"physicalFrame=[%d, %d, %d, %d], "
"deviceSize=[%d, %d], "
"isActive=[%d]",
- NamedEnum::string(type).c_str(), displayId, uniqueId.c_str(),
+ viewportTypeToString(type), displayId, uniqueId.c_str(),
physicalPort ? StringPrintf("%" PRIu8, *physicalPort).c_str()
: "<none>",
orientation, logicalLeft, logicalTop, logicalRight, logicalBottom,