Skip to content

Commit

Permalink
Initialize WindowHelper before the eventloop starts
Browse files Browse the repository at this point in the history
This closes #161 but I honestly don't know why.

With this applied, the render loop on iOS stops when there are no updates so it should improve battery life considerably.
  • Loading branch information
MartinBriza committed Jan 14, 2024
1 parent 60de3cd commit 166501e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ int main(int argc, char* argv[]) {
engine.addImportPath(QStringLiteral("../modules"));

// Initialize UI helpers and fonts
WindowHelper::instance();
Settings::instance();
WindowHelper::instance(); // Needs to happen after Settings
Lith::instance();
auto fontFamilyFromSettings = Lith::settingsGet()->baseFontFamilyGet();
#if defined(Q_OS_IOS) || defined(Q_OS_MACOS)
Expand Down
3 changes: 1 addition & 2 deletions modules/Lith/Core/windowhelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,13 @@ WindowHelper::WindowHelper()
m_changeSchemeTimer->setInterval(50);
m_changeSchemeTimer->setSingleShot(true);
connect(m_changeSchemeTimer, &QTimer::timeout, this, &WindowHelper::changeScheme);

QTimer::singleShot(0, this, &WindowHelper::init);
}

WindowHelper* WindowHelper::instance() {
static WindowHelper* self = nullptr;
if (!self) {
self = new WindowHelper();
self->init();
}
return self;
}
Expand Down

0 comments on commit 166501e

Please sign in to comment.