It seems we allocate a new `GlesRenderbuffer` every time we screencopy
to an shm buffer.
We probably should use a more complicated approach to do proper damage
tracking without any unnecessary copies, and re-using the GPU buffer,
but as long as this allocates a buffer the age of that buffer should be
treated as `0`.
Fixes corruption in cosmic-workspaces when shm screencopy is used. (For
instance, when Cosmic is run with software rendering.)
If the surface under the pointer has changed, we should send an `enter`
event immediately, instead of waiting for the next motion event. This
seems to fix that, without producing unnecessary events.
Instead of `time: 0`, this and other synthesized events should probably
use `CLOCK_MONOTONIC`. It seems libinput does document that it uses
that.
Previously, alt-tab wouldn't actually focus a window if it was on
another output, since the active output/workspace was unchanged.
We need to move the cursor if we activate a window on another output.
Using `lto = "thin"` seems to increase incremental build time when a file
is `touch`ed from about 3 seconds to almost 30.
I'm not sure if this helped with anything, but there are probably better
ways to improve `dev` performance than enabling LTO.
Previously, screenshots and screencopy panicked if no DRM render nodes
are present.
Instead, create a `GlowRenderer` using llvmpipe, if available. This
should work as a fallback until pixman is integrated.
Avoids a little duplication (matching two variants, instead of three
backends).
The behavior, including errors and panics, should be unchanged for now.
Performance should also not be impacted.
This should help for adding llvmpipe rendering without a device node on
the kms backend, or for adding a variant for pixman.
It would make sense to have a bound like
`for<'frame> R::Frame<'frame>: AsGlowFrame<'frame>`. But that appears to
not behave properly due to current limitations of the borrow checker:
https://blog.rust-lang.org/2022/10/28/gats-stabilization.html#implied-static-requirement-from-higher-ranked-trait-bounds
Instead, this makes `glow_frame` and `glow_frame_mut` associated
functions of the `AsGlowRenderer` trait. Then it is pretty
straightforward to make the `RenderElement` implementations generic
using that and `FromGlesError`.
It would make sense to make `Self::Error: FromGlessError` a requirement
of the `AsGlowRenderer` trait, but due to the lack of implied bounds
support, that produces a bunch of errors about missing bounds. If Rustc
improves that eventually, some bounds could be cleaned up a bit:
https://github.com/rust-lang/rust/issues/44491
This fixes an issue with `cosmic-panel` where, when a workspace is moved
back to an output after a monitor is disconnected and reconnected, the
panel doesn't hide because `cosmic-panel` thinks no toplevel is open on
that monitor.
After some testing, it seems `output_enter` isn't being sent here. In
particular, the `output_leave` call happens before the client binds the
`wl_output`, so there is no `wl_output` to send in an event yet.
This is addressed by keeping track of a set of `wl_output`s that we have
sent the event to. So if an output is bound, `refresh` can add it to
this list and send the event.
This is not needed for workspaces (though it could be done similarly)
since the handle objects are created by server events. So no race should
occur as long as the workspaces global is bound before the toplevel info
one.