+static void *VoutDisplayEventKeyDispatch(void *data)
+{
+ vout_display_t *vd = data;
+ vout_display_owner_sys_t *osys = vd->owner.sys;
+
+ for (;;) {
+ block_t *event = block_FifoGet(osys->event.fifo);
+ if (!event)
+ return NULL;
+
+ int key;
+ memcpy(&key, event->p_buffer, sizeof(key));
+ vout_SendEventKey(osys->vout, key);
+ block_Release(event);
+ }
+}
+
+static void VoutDisplayEventKey(vout_display_t *vd, int key)
+{
+ vout_display_owner_sys_t *osys = vd->owner.sys;
+
+ if (!osys->event.fifo) {
+ osys->event.fifo = block_FifoNew();
+ if (!osys->event.fifo)
+ return;
+ if (vlc_clone(&osys->event.thread, VoutDisplayEventKeyDispatch,
+ vd, VLC_THREAD_PRIORITY_LOW)) {
+ block_FifoRelease(osys->event.fifo);
+ osys->event.fifo = NULL;
+ return;
+ }
+ }
+ block_t *event = block_Alloc(sizeof(key));
+ if (event) {
+ memcpy(event->p_buffer, &key, sizeof(key));
+ block_FifoPut(osys->event.fifo, event);
+ }
+}
+