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

vout: add window owner structure and resize event

parent e0b80918
...@@ -80,6 +80,11 @@ typedef struct { ...@@ -80,6 +80,11 @@ typedef struct {
} vout_window_cfg_t; } vout_window_cfg_t;
typedef struct vout_window_owner {
void *sys;
void (*resized)(vout_window_t *, unsigned width, unsigned height);
} vout_window_owner_t;
/** /**
* FIXME do we need an event system in the window too ? * FIXME do we need an event system in the window too ?
* or the window user will take care of it ? * or the window user will take care of it ?
...@@ -118,6 +123,8 @@ struct vout_window_t { ...@@ -118,6 +123,8 @@ struct vout_window_t {
* A module is free to use it as it wishes. * A module is free to use it as it wishes.
*/ */
vout_window_sys_t *sys; vout_window_sys_t *sys;
vout_window_owner_t owner;
}; };
/** /**
...@@ -128,7 +135,7 @@ struct vout_window_t { ...@@ -128,7 +135,7 @@ struct vout_window_t {
/ vout_display_NewWindow() and vout_display_DeleteWindow() instead. / vout_display_NewWindow() and vout_display_DeleteWindow() instead.
* This enables recycling windows. * This enables recycling windows.
*/ */
VLC_API vout_window_t * vout_window_New(vlc_object_t *, const char *module, const vout_window_cfg_t *); VLC_API vout_window_t * vout_window_New(vlc_object_t *, const char *module, const vout_window_cfg_t *, const vout_window_owner_t *);
/** /**
* Deletes a window created by vout_window_New(). * Deletes a window created by vout_window_New().
...@@ -186,4 +193,11 @@ static inline int vout_window_SetFullScreen(vout_window_t *window, bool full) ...@@ -186,4 +193,11 @@ static inline int vout_window_SetFullScreen(vout_window_t *window, bool full)
return vout_window_Control(window, VOUT_WINDOW_SET_FULLSCREEN, full); return vout_window_Control(window, VOUT_WINDOW_SET_FULLSCREEN, full);
} }
static inline void vout_window_ReportSize(vout_window_t *window,
unsigned width, unsigned height)
{
if (window->owner.resized != NULL)
window->owner.resized(window, width, height);
}
#endif /* VLC_VOUT_WINDOW_H */ #endif /* VLC_VOUT_WINDOW_H */
...@@ -746,7 +746,8 @@ static vout_window_t *VoutDisplayNewWindow(vout_display_t *vd, const vout_window ...@@ -746,7 +746,8 @@ static vout_window_t *VoutDisplayNewWindow(vout_display_t *vd, const vout_window
if (!var_InheritBool(osys->vout, "embedded-video")) if (!var_InheritBool(osys->vout, "embedded-video"))
cfg_override.is_standalone = true; cfg_override.is_standalone = true;
return vout_window_New(VLC_OBJECT(osys->vout), "$window", &cfg_override); return vout_window_New(VLC_OBJECT(osys->vout), "$window",
&cfg_override, NULL);
} }
#endif #endif
return vout_NewDisplayWindow(osys->vout, cfg); return vout_NewDisplayWindow(osys->vout, cfg);
...@@ -1445,7 +1446,7 @@ static vout_window_t *SplitterNewWindow(vout_display_t *vd, const vout_window_cf ...@@ -1445,7 +1446,7 @@ static vout_window_t *SplitterNewWindow(vout_display_t *vd, const vout_window_cf
vout_window_cfg_t cfg = *cfg_ptr; vout_window_cfg_t cfg = *cfg_ptr;
cfg.is_standalone = true; cfg.is_standalone = true;
return vout_window_New(VLC_OBJECT(osys->vout), "$window", &cfg); return vout_window_New(VLC_OBJECT(osys->vout), "$window", &cfg, NULL);
} }
static void SplitterDelWindow(vout_display_t *vd, vout_window_t *window) static void SplitterDelWindow(vout_display_t *vd, vout_window_t *window)
......
...@@ -173,7 +173,8 @@ static vout_thread_t *VoutCreate(vlc_object_t *object, ...@@ -173,7 +173,8 @@ static vout_thread_t *VoutCreate(vlc_object_t *object,
.height = cfg->fmt->i_visible_height, .height = cfg->fmt->i_visible_height,
}; };
vout->p->window = vout_window_New(VLC_OBJECT(vout), "$window", &wcfg); vout->p->window = vout_window_New(VLC_OBJECT(vout), "$window", &wcfg,
NULL);
} else } else
vout->p->window = NULL; vout->p->window = NULL;
......
...@@ -51,9 +51,9 @@ static int vout_window_start(void *func, va_list ap) ...@@ -51,9 +51,9 @@ static int vout_window_start(void *func, va_list ap)
return activate(wnd, cfg); return activate(wnd, cfg);
} }
vout_window_t *vout_window_New(vlc_object_t *obj, vout_window_t *vout_window_New(vlc_object_t *obj, const char *module,
const char *module, const vout_window_cfg_t *cfg,
const vout_window_cfg_t *cfg) const vout_window_owner_t *owner)
{ {
window_t *w = vlc_custom_create(obj, sizeof(*w), "window"); window_t *w = vlc_custom_create(obj, sizeof(*w), "window");
vout_window_t *window = &w->wnd; vout_window_t *window = &w->wnd;
...@@ -62,6 +62,11 @@ vout_window_t *vout_window_New(vlc_object_t *obj, ...@@ -62,6 +62,11 @@ vout_window_t *vout_window_New(vlc_object_t *obj,
window->control = NULL; window->control = NULL;
window->sys = NULL; window->sys = NULL;
if (owner != NULL)
window->owner = *owner;
else
window->owner.resized = NULL;
w->module = vlc_module_load(window, "vout window", module, w->module = vlc_module_load(window, "vout window", module,
module && *module, module && *module,
vout_window_start, window, cfg); vout_window_start, window, cfg);
......
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