[vlc-commits] window: add event for fullscreen output devices
Rémi Denis-Courmont
git at videolan.org
Sun May 20 19:52:33 CEST 2018
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun May 20 17:59:10 2018 +0300| [a8c143b55341895d3d53705f9b2885f33818f2e8] | committer: 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.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=a8c143b55341895d3d53705f9b2885f33818f2e8
---
include/vlc_vout_window.h | 24 ++++++++++++++++++++++++
src/video_output/window.c | 10 ++++++++++
2 files changed, 34 insertions(+)
diff --git a/include/vlc_vout_window.h b/include/vlc_vout_window.h
index bc0431d047..7e9866699b 100644
--- a/include/vlc_vout_window.h
+++ b/include/vlc_vout_window.h
@@ -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 */
diff --git a/src/video_output/window.c b/src/video_output/window.c
index 13f5ca89a7..4362ef72b5 100644
--- a/src/video_output/window.c
+++ b/src/video_output/window.c
@@ -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,
};
/**
More information about the vlc-commits
mailing list