summaryrefslogtreecommitdiff
path: root/src/protocols
diff options
context:
space:
mode:
Diffstat (limited to 'src/protocols')
-rw-r--r--src/protocols/ToplevelExport.cpp25
1 files changed, 24 insertions, 1 deletions
diff --git a/src/protocols/ToplevelExport.cpp b/src/protocols/ToplevelExport.cpp
index 8b835b50..a9009aa4 100644
--- a/src/protocols/ToplevelExport.cpp
+++ b/src/protocols/ToplevelExport.cpp
@@ -11,6 +11,7 @@
#include "../render/Renderer.hpp"
#include <algorithm>
+#include <hyprutils/math/Vector2D.hpp>
CToplevelExportClient::CToplevelExportClient(SP<CHyprlandToplevelExportManagerV1> resource_) : resource(resource_) {
if UNLIKELY (!good())
@@ -289,7 +290,29 @@ bool CToplevelExportFrame::copyShm(timespec* now) {
glPixelStorei(GL_PACK_ALIGNMENT, 1);
auto glFormat = PFORMAT->flipRB ? GL_BGRA_EXT : GL_RGBA;
- glReadPixels(0, 0, box.width, box.height, glFormat, PFORMAT->glType, pixelData);
+
+ auto origin = Vector2D(0, 0);
+ switch (PMONITOR->transform) {
+ case WL_OUTPUT_TRANSFORM_FLIPPED_180:
+ case WL_OUTPUT_TRANSFORM_90: {
+ origin.y = PMONITOR->vecPixelSize.y - box.height;
+ break;
+ }
+ case WL_OUTPUT_TRANSFORM_FLIPPED_270:
+ case WL_OUTPUT_TRANSFORM_180: {
+ origin.x = PMONITOR->vecPixelSize.x - box.width;
+ origin.y = PMONITOR->vecPixelSize.y - box.height;
+ break;
+ }
+ case WL_OUTPUT_TRANSFORM_FLIPPED:
+ case WL_OUTPUT_TRANSFORM_270: {
+ origin.x = PMONITOR->vecPixelSize.x - box.width;
+ break;
+ }
+ default: break;
+ }
+
+ glReadPixels(origin.x, origin.y, box.width, box.height, glFormat, PFORMAT->glType, pixelData);
if (overlayCursor) {
g_pPointerManager->unlockSoftwareForMonitor(PMONITOR->self.lock());