diff --git a/QtScrcpy/device/device.cpp b/QtScrcpy/device/device.cpp index 6f4609b..bbc5c3b 100644 --- a/QtScrcpy/device/device.cpp +++ b/QtScrcpy/device/device.cpp @@ -215,18 +215,21 @@ void Device::initSignals() // update ui if (m_videoForm) { + // must be show before updateShowSize + m_videoForm->show(); + m_videoForm->setWindowTitle(deviceName); m_videoForm->updateShowSize(size); + bool deviceVer = size.height() > size.width(); QRect rc = Config::getInstance().getRect(getSerial()); - if (rc.isValid()) { - m_videoForm->move(rc.topLeft()); + bool rcVer = rc.height() > rc.width(); + // same width/height rate + if (rc.isValid() && (deviceVer == rcVer)) { + // mark: resize is for fix setGeometry magneticwidget bug m_videoForm->resize(rc.size()); - // TODO: setGeometry magneticwidget bug - //m_videoForm->setGeometry(rc); + m_videoForm->setGeometry(rc); } - // videoForm delay show - m_videoForm->show(); } // init recorder diff --git a/QtScrcpy/device/ui/videoform.cpp b/QtScrcpy/device/ui/videoform.cpp index 5f41be0..57aaf09 100644 --- a/QtScrcpy/device/ui/videoform.cpp +++ b/QtScrcpy/device/ui/videoform.cpp @@ -88,14 +88,14 @@ QRect VideoForm::getGrabCursorRect() { QRect rc; #if defined(Q_OS_WIN32) - rc = QRect(m_videoWidget->mapToGlobal(m_videoWidget->pos()), m_videoWidget->size()); + rc = QRect(ui->keepRadioWidget->mapToGlobal(m_videoWidget->pos()), m_videoWidget->size()); // high dpi support rc.setTopLeft(rc.topLeft() * m_videoWidget->devicePixelRatio()); rc.setBottomRight(rc.bottomRight() * m_videoWidget->devicePixelRatio()); #elif defined(Q_OS_OSX) rc = m_videoWidget->geometry(); - rc.setTopLeft(m_videoWidget->mapToGlobal(rc.topLeft())); - rc.setBottomRight(m_videoWidget->mapToGlobal(rc.bottomRight())); + rc.setTopLeft(ui->keepRadioWidget->mapToGlobal(rc.topLeft())); + rc.setBottomRight(ui->keepRadioWidget->mapToGlobal(rc.bottomRight())); rc.setX(rc.x() + 100); rc.setY(rc.y() + 30); rc.setWidth(rc.width() - 180);