image-copy: Don't send 0x0 buffer params for cursor capture
Fixes panics in `xdg-desktop-portal-cosmic` when it tries to use cursor capture, and an application hides the cursor.
This commit is contained in:
parent
4a8931896f
commit
82dcd9a46a
2 changed files with 18 additions and 4 deletions
|
|
@ -753,11 +753,15 @@ pub fn render_cursor_to_buffer(
|
|||
seat: &Seat<State>,
|
||||
) {
|
||||
let buffer = frame.buffer();
|
||||
let cursor_size = seat
|
||||
let mut cursor_size = seat
|
||||
.cursor_geometry((0.0, 0.0), state.common.clock.now())
|
||||
.map(|(geo, _hotspot)| geo.size)
|
||||
.unwrap_or_else(|| Size::from((64, 64)));
|
||||
let buffer_size = buffer_dimensions(&buffer).unwrap();
|
||||
// Client shouldn't try to allocate 0x0 buffer
|
||||
if cursor_size == Size::new(0, 0) {
|
||||
cursor_size = Size::new(1, 1);
|
||||
}
|
||||
if buffer_size != cursor_size {
|
||||
let constraints = BufferConstraints {
|
||||
size: cursor_size,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue