From 4f2f73d893731b345f6f5824eccd2d05d22099f9 Mon Sep 17 00:00:00 2001 From: epitchi Date: Sun, 5 May 2024 20:35:04 +0700 Subject: [PATCH] use touch port to update resolution --- smemory.h | 8 ++++++++ src/main.cpp | 16 ++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/smemory.h b/smemory.h index 3d5ea39f..d4bcfe3b 100644 --- a/smemory.h +++ b/smemory.h @@ -34,6 +34,14 @@ typedef struct { int active; char display[64]; int codec; + + int env_width, env_height; + int width, height; + // Offset x and y coordinates of the client + float client_offsetX, client_offsetY; + float offsetX, offsetY; + + float scalar_inv; }QueueMetadata; typedef struct { diff --git a/src/main.cpp b/src/main.cpp index fa16a376..f6511138 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -212,6 +212,7 @@ main(int argc, char *argv[]) { auto framerate = mail->event(mail::framerate); auto idr = mail->event(mail::idr); auto local_shutdown= mail->event(mail::shutdown); + auto touch_port = mail->event(mail::touch_port); #ifdef _WIN32 if (queue_type == QueueType::Video0 || queue_type == QueueType::Video1) @@ -247,6 +248,21 @@ main(int argc, char *argv[]) { if(peek_event(queue,EventType::Idr)) { pop_event(queue,EventType::Idr); idr->raise(1); + } + if(touch_port->peek()) { + auto touch = touch_port->pop(); + if (touch.has_value()) { + auto value = touch.value(); + queue->metadata.client_offsetX = value.client_offsetX; + queue->metadata.client_offsetY = value.client_offsetY; + queue->metadata.offsetX= value.offset_x; + queue->metadata.offsetY = value.offset_y; + queue->metadata.env_height = value.env_height; + queue->metadata.env_width = value.env_width; + queue->metadata.height = value.height; + queue->metadata.width = value.width; + queue->metadata.scalar_inv = value.scalar_inv; + } } }