Commit 57c428ea authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

window: add callback for key press events

parent db3194e4
......@@ -121,6 +121,7 @@ struct vout_window_callbacks {
void (*closed)(vout_window_t *);
void (*mouse_event)(vout_window_t *,
const vout_window_mouse_event_t *mouse);
void (*keyboard_event)(vout_window_t *, unsigned key);
};
typedef struct vout_window_owner {
......@@ -384,7 +385,8 @@ static inline void vout_window_ReportMouseDoubleClick(vout_window_t *window,
static inline void vout_window_ReportKeyPress(vout_window_t *window, int key)
{
var_SetInteger(window->obj.libvlc, "key-pressed", key);
if (window->owner.cbs->keyboard_event != NULL)
window->owner.cbs->keyboard_event(window, key);
}
/** @} */
......
......@@ -163,10 +163,19 @@ static void vout_display_window_MouseEvent(vout_window_t *window,
vout_WindowMouseEvent(vout, mouse);
}
static void vout_display_window_KeyboardEvent(vout_window_t *window,
unsigned key)
{
vout_thread_t *vout = (vout_thread_t *)window->obj.parent;
vout_SendEventKey(vout, key);
}
static const struct vout_window_callbacks vout_display_window_cbs = {
.resized = vout_display_window_ResizeNotify,
.closed = vout_display_window_CloseNotify,
.mouse_event = vout_display_window_MouseEvent,
.keyboard_event = vout_display_window_KeyboardEvent,
};
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment