Smithay / client-toolkit

Smithay's toolkit for writing wayland clients
MIT License
286 stars 80 forks source link

"invalid width, height, or strid (0x24, 0)" error when calling `draw` on FallbackFrame #446

Open tmccombs opened 7 months ago

tmccombs commented 7 months ago

When I call FallbackFrame::draw I get this error in the title.

More context from the wayland debug output:

[4029484.720] xdg_surface@20.configure(11489)
[4029486.062]  -> xdg_surface@20.ack_configure(11489)
[4029486.230]  -> xdg_toplevel@21.set_title("zsh")
[4029486.252]  -> wl_shm_pool@22.create_buffer(new id wl_buffer@38, 0, 0, 24, 0, 0)
[4029486.268]  -> wl_surface@23.set_buffer_scale(1)
[4029486.272]  -> wl_subsurface@24.set_sync()
[4029486.277]  -> wl_subsurface@24.set_position(0, -24)
[4029486.282]  -> wl_surface@23.attach(wl_buffer@38, 0, 0)
[4029486.287]  -> wl_surface@23.damage_buffer(0, 0, 2147483647, 2147483647)
[4029486.290]  -> wl_surface@23.commit()
[4029486.296]  -> wl_shm_pool@22.create_buffer(new id wl_buffer@40, 0, 0, 4, 0, 0)
[4029486.301]  -> wl_surface@25.set_buffer_scale(1)
[4029486.304]  -> wl_subsurface@26.set_sync()
[4029486.307]  -> wl_subsurface@26.set_position(-4, -28)
[4029486.311]  -> wl_surface@25.attach(wl_buffer@40, 0, 0)
[4029486.315]  -> wl_surface@25.damage_buffer(0, 0, 2147483647, 2147483647)
[4029486.318]  -> wl_surface@25.commit()
[4029486.322]  -> wl_shm_pool@22.create_buffer(new id wl_buffer@41, 0, 4, 0, 16, 0)
[4029486.327]  -> wl_surface@27.set_buffer_scale(1)
[4029486.330]  -> wl_subsurface@28.set_sync()
[4029486.333]  -> wl_subsurface@28.set_position(0, -24)
[4029486.337]  -> wl_surface@27.attach(wl_buffer@41, 0, 0)
[4029486.340]  -> wl_surface@27.damage_buffer(0, 0, 2147483647, 2147483647)
[4029486.343]  -> wl_surface@27.commit()
[4029486.347]  -> wl_shm_pool@22.create_buffer(new id wl_buffer@42, 0, 0, 4, 0, 0)
[4029486.352]  -> wl_surface@29.set_buffer_scale(1)
[4029486.355]  -> wl_subsurface@30.set_sync()
[4029486.358]  -> wl_subsurface@30.set_position(-4, 0)
[4029486.361]  -> wl_surface@29.attach(wl_buffer@42, 0, 0)
[4029486.365]  -> wl_surface@29.damage_buffer(0, 0, 2147483647, 2147483647)
[4029486.367]  -> wl_surface@29.commit()
[4029486.372]  -> wl_shm_pool@22.create_buffer(new id wl_buffer@43, 0, 4, 0, 16, 0)
[4029486.376]  -> wl_surface@31.set_buffer_scale(1)
[4029486.379]  -> wl_subsurface@32.set_sync()
[4029486.382]  -> wl_subsurface@32.set_position(-4, -24)
[4029486.392]  -> wl_surface@31.attach(wl_buffer@43, 0, 0)
[4029486.396]  -> wl_surface@31.damage_buffer(0, 0, 2147483647, 2147483647)
[4029486.399]  -> wl_surface@31.commit()
[4029486.467] wl_display@1.error(wl_shm_pool@22, 1, "invalid width, height or stride (0x24, 0)")
wl_shm_pool@22: error 1: invalid width, height or stride (0x24, 0)
Protocol error 1 on object wl_shm_pool@22: 
00:00:22.569  ERROR  wezterm_gui > running message loop: Protocol error 1 on object wl_shm_pool@22: ; terminating

Maybe this is user error, and I there is some step I am missing in setting up the client side decorations (which by the way is remarkably complicated to do). But it seems like the library should avoid creating a buffer with invalid parameters.

I think it should either use a minimum size of 1 for the buffers, avoid drawing altogether if the widht and height are zero.

See https://github.com/wez/wezterm/pull/5044