I’m trying to make an extension to hide the screen (turning it black) on command, and I do this using a clutter effect, the code can be found here. In the past weeks, I’ve asked here and on matrix for help and made good progress, but a few issues remain. I’m starting this thread to avoid getting stuck on the XY problem.
Two major issues:
- When I plug two monitors I get heavy glitching, doesn’t happen with just one monitor.
- With two monitor in join mode, one of the screens doesn’t turn fully black when the effect is activated.
Secondly, I have no idea of how to make a preference GUI as this is my first extension, and the example on the guide doesn’t work. I posted a thread about that before, but nobody answered and it got auto closed. This is a secondary optional goal.
I’m planning to publish the extension eventually, so I need to first fix these issues first. More detail below:
Glitching problem
I turn the screen black using a Clutter.BrightnessContrastEffect effect with the brightness turned to -1. To minimise latency, I want to have the effect always enabled, and toggle the value between -1 and 0 to hide/show the screen.
With multiple monitors plugged and the effect active at 0 brightness, moving a window causes several (compositor?) glitches, making it almost unusable. This happens for any non--1 value – at -1 it’s not evident because the screen is black.
Adding and removing the effect instead of just changing the uniform works as a workaround, but only because I need to make the screen black. If I wanted to do anything else this wouldn’t cut it.
“Incomplete” blacking problem
Regardless of the first issue, when the screen is blackened, the “unfocused” one doesn’t refresh completely, only the dash and the top-bar turn black. Doing anything on that monitor (moving the mouse, opening the overview) fixes it.
It only redraws the shell but not the entire screen, even though I changed an effect on the global stage. Can I queue a compositor-wide repaint?