Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove getApp and getSettings calls from Message-Rendering #4535

Merged
merged 13 commits into from
Jul 30, 2023

Conversation

Nerixyz
Copy link
Contributor

@Nerixyz Nerixyz commented Apr 11, 2023

Description

Motivation

I wanted to try and experiment if #1618 would be possible to implement. My idea was to have a hotkey similar to CTRL+N that brings up the current channel in a transparent window (⇒ this wouldn't support splits yet (?)). This window would be essentially a channel-view-wrapping widget. The wrapped channel-view would then be considered "transparent" and it wouldn't draw a background. But it turns out that a lot of places throughout the rendering pipeline draw some sort of background. From the ChannelView there are two locations that draw a background:

Changes

I added a MessagePaintContext struct which encapsulates all current rendering settings/colors as well as state from the ChannelView (e.g. the message index or y-position). This context gets passed to all rendering methods and supplies e.g. colors (instead of going through the global Application singleton). This is only done for painting currently. In the future, this could be done for layout as well, which could open up possibilities to test the rendering without mocking Application and Settings (there are probably some more locations using these singletons).

@pajlada pajlada added this to the Post 2.4.4 milestone May 8, 2023
@pajlada pajlada added the Waiting for review PR bounced back to reviewer label May 8, 2023
@pajlada pajlada removed the Waiting for review PR bounced back to reviewer label Jul 30, 2023
@pajlada pajlada enabled auto-merge July 30, 2023 12:11
@pajlada pajlada added this pull request to the merge queue Jul 30, 2023
Merged via the queue into Chatterino:master with commit 71594ad Jul 30, 2023
16 of 17 checks passed
@Nerixyz Nerixyz deleted the refactor/message-painting branch July 30, 2023 13:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants