aboutsummaryrefslogtreecommitdiff
path: root/minui
diff options
context:
space:
mode:
Diffstat (limited to 'minui')
-rw-r--r--minui/graphics.cpp21
-rw-r--r--minui/include/minui/minui.h4
2 files changed, 25 insertions, 0 deletions
diff --git a/minui/graphics.cpp b/minui/graphics.cpp
index cd01768a..67de5cc0 100644
--- a/minui/graphics.cpp
+++ b/minui/graphics.cpp
@@ -41,6 +41,7 @@ static uint32_t gr_current = ~0;
// gr_draw is owned by backends.
static GRSurface* gr_draw = nullptr;
static GRRotation rotation = GRRotation::NONE;
+static GRRotation touch_rotation = GRRotation::NONE;
static PixelFormat pixel_format = PixelFormat::UNKNOWN;
// The graphics backend list that provides fallback options for the default backend selection.
// For example, it will fist try DRM, then try FBDEV if DRM is unavailable.
@@ -474,6 +475,18 @@ int gr_init(std::initializer_list<GraphicsBackend> backends) {
gr_rotate(GRRotation::NONE);
}
+ std::string touch_rotation_str =
+ android::base::GetProperty("ro.minui.default_touch_rotation", "ROTATION_NONE");
+ if (touch_rotation_str == "ROTATION_RIGHT") {
+ gr_rotate_touch(GRRotation::RIGHT);
+ } else if (touch_rotation_str == "ROTATION_DOWN") {
+ gr_rotate_touch(GRRotation::DOWN);
+ } else if (touch_rotation_str == "ROTATION_LEFT") {
+ gr_rotate_touch(GRRotation::LEFT);
+ } else { // "ROTATION_NONE" or unknown string
+ gr_rotate_touch(GRRotation::NONE);
+ }
+
if (gr_draw->pixel_bytes != 4) {
printf("gr_init: Only 4-byte pixel formats supported\n");
}
@@ -519,6 +532,10 @@ int gr_overscan_offset_y() {
return overscan_offset_y;
}
+GRRotation gr_touch_rotation() {
+ return touch_rotation;
+}
+
void gr_fb_blank(bool blank) {
gr_backend->Blank(blank);
}
@@ -531,6 +548,10 @@ void gr_rotate(GRRotation rot) {
rotation = rot;
}
+void gr_rotate_touch(GRRotation rot) {
+ touch_rotation = rot;
+}
+
bool gr_has_multiple_connectors() {
return gr_backend->HasMultipleConnectors();
}
diff --git a/minui/include/minui/minui.h b/minui/include/minui/minui.h
index 76d6cd78..19022bbd 100644
--- a/minui/include/minui/minui.h
+++ b/minui/include/minui/minui.h
@@ -129,6 +129,7 @@ int gr_fb_width_real();
int gr_fb_height_real();
int gr_overscan_offset_x();
int gr_overscan_offset_y();
+GRRotation gr_touch_rotation();
void gr_flip();
void gr_fb_blank(bool blank);
@@ -158,6 +159,9 @@ unsigned int gr_get_height(const GRSurface* surface);
// Sets rotation, flips gr_fb_width/height if 90 degree rotation difference
void gr_rotate(GRRotation rotation);
+// Sets touch rotation
+void gr_rotate_touch(GRRotation rotation);
+
// Returns the current PixelFormat being used.
PixelFormat gr_pixel_format();