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

window: add event for fullscreen output devices

This supports adding/changing/removing outputs. The callback semantics
are similar to audio output hot-plug.
parent 9b1ef1ca
......@@ -120,9 +120,12 @@ struct vout_window_callbacks {
void (*state_changed)(vout_window_t *, unsigned state);
void (*windowed)(vout_window_t *);
void (*fullscreened)(vout_window_t *, const char *id);
void (*mouse_event)(vout_window_t *,
const vout_window_mouse_event_t *mouse);
void (*keyboard_event)(vout_window_t *, unsigned key);
void (*output_event)(vout_window_t *, const char *id, const char *desc);
};
typedef struct vout_window_owner {
......@@ -421,5 +424,26 @@ static inline void vout_window_ReportKeyPress(vout_window_t *window, int key)
window->owner.cbs->keyboard_event(window, key);
}
/**
* Adds/removes a fullscreen output.
*
* This notifies the owner of the window that a usable fullscreen output has
* been added, changed or removed.
*
* If an output with the same identifier is already known, its name will be
* updated. Otherwise it will be added.
* If the name parameter is NULL, the output will be removed.
*
* \param id unique nul-terminated identifier for the output
* \param name human-readable name
*/
static inline void vout_window_ReportOutputDevice(vout_window_t *window,
const char *id,
const char *name)
{
if (window->owner.cbs->output_event != NULL)
window->owner.cbs->output_event(window, id, name);
}
/** @} */
#endif /* VLC_VOUT_WINDOW_H */
......@@ -240,6 +240,15 @@ static void vout_display_window_KeyboardEvent(vout_window_t *window,
vout_SendEventKey(vout, key);
}
static void vout_display_window_OutputEvent(vout_window_t *window,
const char *name, const char *desc)
{
if (desc != NULL)
msg_Dbg(window, "fullscreen output %s (%s) added", name, desc);
else
msg_Dbg(window, "fullscreen output %s removed", name);
}
static const struct vout_window_callbacks vout_display_window_cbs = {
.resized = vout_display_window_ResizeNotify,
.closed = vout_display_window_CloseNotify,
......@@ -248,6 +257,7 @@ static const struct vout_window_callbacks vout_display_window_cbs = {
.windowed = vout_display_window_WindowingNotify,
.mouse_event = vout_display_window_MouseEvent,
.keyboard_event = vout_display_window_KeyboardEvent,
.output_event = vout_display_window_OutputEvent,
};
/**
......
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