From 3b4e2c77c5d9d861b2cfca2877071a643c0f4401 Mon Sep 17 00:00:00 2001 From: YangWu Date: Thu, 18 Aug 2022 10:07:45 +0800 Subject: [PATCH] feat: enable back to original size after exit fullscreen. After exit fullscreen, it still show as fullscreen with title, this make user feel unwell. Record the normal size and then recover will be beter. Log: support recover size. --- QtScrcpy/ui/videoform.cpp | 5 +++++ QtScrcpy/ui/videoform.h | 1 + 2 files changed, 6 insertions(+) diff --git a/QtScrcpy/ui/videoform.cpp b/QtScrcpy/ui/videoform.cpp index 839f11a..64772c7 100644 --- a/QtScrcpy/ui/videoform.cpp +++ b/QtScrcpy/ui/videoform.cpp @@ -467,6 +467,8 @@ void VideoForm::switchFullScreen() } showNormal(); + // back to normal size. + resize(m_normalSize); // fullscreen window will move (0,0). qt bug? move(m_fullScreenBeforePos); @@ -487,6 +489,9 @@ void VideoForm::switchFullScreen() ui->keepRatioWidget->setWidthHeightRatio(-1.0f); } + // record current size before fullscreen, it will be used to rollback size after exit fullscreen. + m_normalSize = size(); + m_fullScreenBeforePos = pos(); // 这种临时增加标题栏再全屏的方案会导致收不到mousemove事件,导致setmousetrack失效 // mac fullscreen must show title bar diff --git a/QtScrcpy/ui/videoform.h b/QtScrcpy/ui/videoform.h index 9f79aef..acda4e6 100644 --- a/QtScrcpy/ui/videoform.h +++ b/QtScrcpy/ui/videoform.h @@ -79,6 +79,7 @@ private: //inside member QSize m_frameSize; + QSize m_normalSize; QPoint m_dragPosition; float m_widthHeightRatio = 0.5f; bool m_skin = true;