+ if (is_ignored) {
+ vlc_mutex_unlock(&osys->lock);
+ return;
+ }
+
+ /* Emulate double-click if needed */
+ if (!vd->info.has_double_click &&
+ vlc_mouse_HasPressed(&osys->mouse.state, &m, MOUSE_BUTTON_LEFT)) {
+ const mtime_t i_date = mdate();
+
+ if (i_date - osys->mouse.last_pressed < osys->mouse.double_click_timeout ) {
+ m.b_double_click = true;
+ osys->mouse.last_pressed = 0;
+ } else {
+ osys->mouse.last_pressed = mdate();
+ }
+ }
+
+ /* */
+ osys->mouse.state = m;
+
+ /* */
+ osys->mouse.ch_activity = true;
+ if (!vd->info.has_hide_mouse)
+ osys->mouse.last_moved = mdate();
+
+ /* */
+ vout_SendEventMouseVisible(osys->vout);
+#ifdef ALLOW_DUMMY_VOUT
+ DummyVoutSendDisplayEventMouse(osys->vout, &osys->vout_mouse, &m);
+#else
+ vout_SendDisplayEventMouse(osys->vout, &m);
+#endif
+ vlc_mutex_unlock(&osys->lock);
+}
+
+static void *VoutDisplayEventKeyDispatch(void *data)
+{
+ vout_display_owner_sys_t *osys = data;
+
+ for (;;) {
+ block_t *event = block_FifoGet(osys->event.fifo);
+
+ int cancel = vlc_savecancel();
+
+ int key;
+ memcpy(&key, event->p_buffer, sizeof(key));
+ vout_SendEventKey(osys->vout, key);
+ block_Release(event);
+
+ vlc_restorecancel(cancel);
+ }
+}
+
+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,
+ osys, 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);
+ }
+}
+
+static void VoutDisplayEvent(vout_display_t *vd, int event, va_list args)
+{
+ vout_display_owner_sys_t *osys = vd->owner.sys;
+
+ switch (event) {
+ case VOUT_DISPLAY_EVENT_CLOSE: {
+ msg_Dbg(vd, "VoutDisplayEvent 'close'");
+ vout_SendEventClose(osys->vout);
+ break;
+ }
+ case VOUT_DISPLAY_EVENT_KEY: {
+ const int key = (int)va_arg(args, int);
+ msg_Dbg(vd, "VoutDisplayEvent 'key' 0x%2.2x", key);
+ if (vd->info.has_event_thread)
+ vout_SendEventKey(osys->vout, key);
+ else
+ VoutDisplayEventKey(vd, key);
+ break;
+ }
+ case VOUT_DISPLAY_EVENT_MOUSE_STATE:
+ case VOUT_DISPLAY_EVENT_MOUSE_MOVED:
+ case VOUT_DISPLAY_EVENT_MOUSE_PRESSED:
+ case VOUT_DISPLAY_EVENT_MOUSE_RELEASED:
+ case VOUT_DISPLAY_EVENT_MOUSE_DOUBLE_CLICK:
+ VoutDisplayEventMouse(vd, event, args);
+ break;
+