Fix keyboard input: don't forward keys to seat without focused surface
wlr_seat_keyboard_notify_key was being called unconditionally, which caused re-entrancy that consumed WINGs events from the queue before the modal loop could fetch them. Now only forwards to the seat when there's an actual focused client surface. Also use 16ms timeout in wl_flush so keyboard events from the nested compositor are actually received during modal loop dispatch.
This commit is contained in:
parent
ace0585ec3
commit
8f0ec30759
|
|
@ -155,7 +155,7 @@ wl_flush(void *ectx, Bool discard)
|
|||
/* Pump the wlroots event loop so pointer/key events arrive in our queue.
|
||||
* This is called from waitForEvent/WMMaskEvent when the queue is empty. */
|
||||
if (ctx->dispatch_fn)
|
||||
ctx->dispatch_fn(0, ctx->dispatch_ud);
|
||||
ctx->dispatch_fn(16, ctx->dispatch_ud);
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
|
|||
|
|
@ -39,8 +39,10 @@ W_View *W_GetViewForWindow(Window id)
|
|||
unsigned slot = (idx + i) % VIEW_TABLE_SIZE;
|
||||
if (view_table[slot].id == id)
|
||||
return view_table[slot].view;
|
||||
if (view_table[slot].id == 0)
|
||||
if (view_table[slot].id == 0) {
|
||||
wwarning("W_GetViewForWindow: id=0x%lx NOT FOUND (slot %u empty)", (unsigned long)id, slot);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1658,9 +1658,10 @@ handle_keyboard_key(struct wl_listener *listener, void *data)
|
|||
W_WL_EnqueueEvent(wmscr, &ev, NULL);
|
||||
}
|
||||
|
||||
/* Forward non-shortcut key events to focused client */
|
||||
wlr_seat_keyboard_notify_key(wl_state.seat,
|
||||
event->time_msec, event->keycode, event->state);
|
||||
/* Forward non-shortcut key events to focused Wayland client (if any) */
|
||||
if (wl_state.seat->keyboard_state.focused_surface)
|
||||
wlr_seat_keyboard_notify_key(wl_state.seat,
|
||||
event->time_msec, event->keycode, event->state);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
|||
Loading…
Reference in New Issue