Skip to content

Commit

Permalink
gui: avoid a flashing window blink during startup
Browse files Browse the repository at this point in the history
The very first paint events cause a bright flash of unstyled shell
content to appear before the configured colors are applied.

Defer displaying the shell widget until the default colors have been
provided by nvim.
  • Loading branch information
davvid committed Mar 6, 2024
1 parent ef1bec6 commit 1e34716
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/gui/shell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,9 @@ void Shell::init()
return;
}

if (!m_shown) { // Defer displaying the shell until colors have been set.
setVisible(false);
}
connect(m_nvim->api0(), &NeovimApi0::neovimNotification,
this, &Shell::handleNeovimNotification);
connect(m_nvim->api0(), &NeovimApi0::on_ui_try_resize,
Expand Down Expand Up @@ -1127,8 +1130,11 @@ void Shell::handleDefaultColorsSet(const QVariantList& opargs)
setBackground(backgroundColor);
setSpecial(specialColor);

// Cells drawn with the default colors require a re-paint
update();
// Display the shell now that the default colors have been set.
if (!m_shown) {
setVisible(true);
m_shown = true;
}
emit colorsChanged();
}

Expand Down
1 change: 1 addition & 0 deletions src/gui/shell.h
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ private slots:
private:
bool m_init_called{ false };
bool m_attached{ false };
bool m_shown { false };
NeovimConnector* m_nvim{ nullptr };

QList<QUrl> m_deferredOpen;
Expand Down

0 comments on commit 1e34716

Please sign in to comment.