-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
renderer: add windowrule type suppressvrr #10300
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
base: main
Are you sure you want to change the base?
Conversation
- `suppressvrr` is a type of `windowrule` - whenever a matching window is visible on-screen in the current workspace of a monitor, that particular monitor will necessarily prevent VRR from being enabled. - this rule works in conjunction with misc:vrr and per-monitor vrr settings and gets applied last in the vrr logic - example usage: `windowrule = suppressvrr, class:nemo` will prevent VRR on any monitors that currently display a nemo window - as a small optimization, a workspace that has a fullscreen window will either necessarily suppress VRR or not depending on whether that particular window was matched for `suppressvrr`. Whether other windows in that workspace match for `suppressvrr` is irrelevant to this logic.
@@ -710,6 +715,9 @@ void Events::listener_mapWindow(void* owner, void* data) { | |||
|
|||
if (PMONITOR && PWINDOW->isX11OverrideRedirect()) | |||
PWINDOW->m_X11SurfaceScaledBy = PMONITOR->m_scale; | |||
|
|||
// VRR should update | |||
g_pConfigManager->ensureVRR(PWINDOW->m_monitor.lock()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
redundant
@@ -847,6 +855,9 @@ void Events::listener_unmapWindow(void* owner, void* data) { | |||
|
|||
// update lastwindow after focus | |||
PWINDOW->onUnmap(); | |||
|
|||
// VRR should update | |||
g_pConfigManager->ensureVRR(PMONITOR); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
redundant
const auto PWORKSPACE = m->m_activeWorkspace; | ||
if (PWORKSPACE) { | ||
auto vrrSuppressingWindows = 0; | ||
std::optional<bool> fullscreenWindowSuppressing = std::nullopt; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can just be a bool = false and set to true in the loop if a matching window is found
m->m_output->state->setAdaptiveSync(false); | ||
} | ||
for (auto const& w : g_pCompositor->m_windows) { | ||
if (w->m_isMapped && w->workspaceID() == PWORKSPACE->m_id && !w->isHidden()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
prefer guards
} | ||
for (auto const& w : g_pCompositor->m_windows) { | ||
if (w->m_isMapped && w->workspaceID() == PWORKSPACE->m_id && !w->isHidden()) { | ||
if (w->m_suppressVrr) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
other windows dont matter, only the fs one
vrrSuppressingWindows++; | ||
|
||
if (w->isFullscreen()) | ||
fullscreenWindowSuppressing = w->m_suppressVrr; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can break afterwards
// whether that window is `suppressvrr` or not; | ||
// * if there doesn't exist one, then disable VRR for at least one visible window that is `suppressvrr` | ||
|
||
if (fullscreenWindowSuppressing == true || (fullscreenWindowSuppressing == std::nullopt && vrrSuppressingWindows > 0)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no {}
Describe your PR, what does it fix/add?
Aims to enable functionality described in #10147 .
From commit message:
suppressvrr
is a type ofwindowrule
misc:vrr
and per-monitor VRR settings and gets applied last in the vrr logicwindowrule = suppressvrr, class:nemo
will prevent VRR on any monitors that currently display a nemo windowsuppressvrr
. Whether other windows in that workspace match forsuppressvrr
or not is irrelevant to this logic.Is there anything you want to mention? (unchecked code, possible bugs, found problems, breaking compatibility, etc.)
As this is my first contribution to the project, I am not sure whether I put the additional calls to
ensureVRR
in the correct, canonical places. For now, I added the calls inside the listeners for mapping/unmapping.Is it ready for merging, or does it need work?
Should be good to go afaik, aside from the question raised above.