Chatterino / chatterino2

Chat client for https://twitch.tv
MIT License
1.97k stars 442 forks source link

fix: get rid of duplicate scale events #5404

Closed Nerixyz closed 1 month ago

Nerixyz commented 1 month ago

Previously, two scale events were emitted to fix #1266. This PR fixes #1266 by introducing NotebookTab::normalTabWidthForHeight which computes the width for the height after scaling (in NotebookTab::updateSize). This would previously require two invocations (first one to set the height and second one the width). Furthermore, it gets rid of refreshing the notebook too often (~> performing layout for every tab).

As a next step, this PR checks if the scale has changed at all in BaseWidget::setScale. This will probably introduce some bugs, but I think it's better to address these individually instead of spamming scale events (like I did for SplitHeader).