display window. this actually fixes the skipped frame issues

pull/34892/head
Trey Moen 6 months ago
parent 73365d7851
commit 951250d86c
  1. 12
      tools/clip/application.cc

@ -74,12 +74,18 @@ Application::Application(int argc, char *argv[], QObject *parent) : QObject(pare
QObject::connect(recorderThread, &QThread::finished, recorder, &QObject::deleteLater); QObject::connect(recorderThread, &QThread::finished, recorder, &QObject::deleteLater);
QObject::connect(window, &OnroadWindow::redrew, this, [&]() { QObject::connect(window, &OnroadWindow::redrew, this, [&]() {
recorder->saveFrame(std::make_shared<QPixmap>(std::move(window->grab()))); QElapsedTimer timer;
}, Qt::DirectConnection); timer.start();
QPixmap pixmap = window->grab();
// qDebug() << "pixmap took " << timer.elapsed() << " ms";
timer.restart();
recorder->saveFrame(std::make_shared<QPixmap>(std::move(pixmap)));
// qDebug() << "save frame took" << timer.elapsed() << " ms";
}, Qt::QueuedConnection);
QObject::connect(app, &QCoreApplication::aboutToQuit, recorderThread, &QThread::quit); QObject::connect(app, &QCoreApplication::aboutToQuit, recorderThread, &QThread::quit);
window->setAttribute(Qt::WA_DontShowOnScreen); // window->setAttribute(Qt::WA_DontShowOnScreen);
window->setAttribute(Qt::WA_Mapped); window->setAttribute(Qt::WA_Mapped);
window->setAttribute(Qt::WA_NoSystemBackground); window->setAttribute(Qt::WA_NoSystemBackground);
recorderThread->start(); recorderThread->start();

Loading…
Cancel
Save