Fix unexpected devdraw crashes on sway
I found sway 1.10 and wlroots 0.18.2 will occasionally generate wl_keyboard::keymap events with an empty keymap. I do not have a reliable reproduction for this, but it seems to occur when switching back and forth between workspaces with the keyboard. This also fixes the issue where devdraw can go into a busy loop if the compositor goes away and wl_display_dispatch() returns -1.
This commit is contained in:
parent
5636471dff
commit
3fdc76f128
1 changed files with 8 additions and 2 deletions
|
|
@ -616,8 +616,13 @@ static const struct wl_pointer_listener pointer_listener = {
|
||||||
|
|
||||||
void wl_keyboard_keymap(void *data, struct wl_keyboard *wl_keyboard,
|
void wl_keyboard_keymap(void *data, struct wl_keyboard *wl_keyboard,
|
||||||
uint32_t format, int32_t fd, uint32_t size) {
|
uint32_t format, int32_t fd, uint32_t size) {
|
||||||
DEBUG("wl_keyboard_keymap\n");
|
DEBUG("wl_keyboard_keymap(format=%d, fd=%d, size=%d)\n", format, fd, size);
|
||||||
char *keymap = mmap(NULL, size, PROT_READ, MAP_PRIVATE, fd, 0);
|
char *keymap = mmap(NULL, size, PROT_READ, MAP_PRIVATE, fd, 0);
|
||||||
|
if (keymap == MAP_FAILED) {
|
||||||
|
DEBUG("wl_keyboard_keymap: %s", strerror(errno));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Client* c = data;
|
Client* c = data;
|
||||||
WaylandClient *wl = (WaylandClient*) c->view;
|
WaylandClient *wl = (WaylandClient*) c->view;
|
||||||
qlock(&wayland_lock);
|
qlock(&wayland_lock);
|
||||||
|
|
@ -852,8 +857,9 @@ void gfx_main(void) {
|
||||||
entered_gfx_loop = 1;
|
entered_gfx_loop = 1;
|
||||||
gfx_started();
|
gfx_started();
|
||||||
DEBUG("gfx_main: entering loop\n");
|
DEBUG("gfx_main: entering loop\n");
|
||||||
while (wl_display_dispatch(wl_display))
|
while (wl_display_dispatch(wl_display) > 0 || errno == EAGAIN)
|
||||||
;
|
;
|
||||||
|
sysfatal("wl_display_dispatch: %r");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rpc_resizeimg(Client*) {
|
static void rpc_resizeimg(Client*) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue