mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-18 15:51:11 +00:00
waylandsink: cleanup GstWlWindow a bit after the overlaying semantics change
* own_surface is not needed anymore * gst_wl_window_from_surface is not used externally anymore * many initializations to 0 are not needed (GObject does them)
This commit is contained in:
parent
39c5a9ce13
commit
61e077155b
2 changed files with 30 additions and 45 deletions
|
@ -74,33 +74,54 @@ gst_wl_window_finalize (GObject * gobject)
|
||||||
{
|
{
|
||||||
GstWlWindow *self = GST_WL_WINDOW (gobject);
|
GstWlWindow *self = GST_WL_WINDOW (gobject);
|
||||||
|
|
||||||
wl_viewport_destroy (self->viewport);
|
|
||||||
|
|
||||||
if (self->shell_surface) {
|
if (self->shell_surface) {
|
||||||
wl_shell_surface_destroy (self->shell_surface);
|
wl_shell_surface_destroy (self->shell_surface);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (self->own_surface) {
|
|
||||||
wl_surface_destroy (self->surface);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (self->subsurface) {
|
if (self->subsurface) {
|
||||||
wl_subsurface_destroy (self->subsurface);
|
wl_subsurface_destroy (self->subsurface);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wl_viewport_destroy (self->viewport);
|
||||||
|
wl_surface_destroy (self->surface);
|
||||||
|
|
||||||
g_clear_object (&self->display);
|
g_clear_object (&self->display);
|
||||||
|
|
||||||
G_OBJECT_CLASS (gst_wl_window_parent_class)->finalize (gobject);
|
G_OBJECT_CLASS (gst_wl_window_parent_class)->finalize (gobject);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static GstWlWindow *
|
||||||
|
gst_wl_window_new_internal (GstWlDisplay * display, struct wl_surface *surface)
|
||||||
|
{
|
||||||
|
GstWlWindow *window;
|
||||||
|
struct wl_region *region;
|
||||||
|
|
||||||
|
g_return_val_if_fail (surface != NULL, NULL);
|
||||||
|
|
||||||
|
window = g_object_new (GST_TYPE_WL_WINDOW, NULL);
|
||||||
|
window->display = g_object_ref (display);
|
||||||
|
window->surface = surface;
|
||||||
|
|
||||||
|
/* make sure the surface runs on our local queue */
|
||||||
|
wl_proxy_set_queue ((struct wl_proxy *) surface, display->queue);
|
||||||
|
|
||||||
|
window->viewport = wl_scaler_get_viewport (display->scaler, window->surface);
|
||||||
|
|
||||||
|
/* do not accept input */
|
||||||
|
region = wl_compositor_create_region (display->compositor);
|
||||||
|
wl_surface_set_input_region (surface, region);
|
||||||
|
wl_region_destroy (region);
|
||||||
|
|
||||||
|
return window;
|
||||||
|
}
|
||||||
|
|
||||||
GstWlWindow *
|
GstWlWindow *
|
||||||
gst_wl_window_new_toplevel (GstWlDisplay * display, gint width, gint height)
|
gst_wl_window_new_toplevel (GstWlDisplay * display, gint width, gint height)
|
||||||
{
|
{
|
||||||
GstWlWindow *window;
|
GstWlWindow *window;
|
||||||
|
|
||||||
window = gst_wl_window_new_from_surface (display,
|
window = gst_wl_window_new_internal (display,
|
||||||
wl_compositor_create_surface (display->compositor));
|
wl_compositor_create_surface (display->compositor));
|
||||||
window->own_surface = TRUE;
|
|
||||||
|
|
||||||
gst_wl_window_set_size (window, 0, 0, width, height);
|
gst_wl_window_set_size (window, 0, 0, width, height);
|
||||||
|
|
||||||
|
@ -127,9 +148,8 @@ gst_wl_window_new_in_surface (GstWlDisplay * display,
|
||||||
{
|
{
|
||||||
GstWlWindow *window;
|
GstWlWindow *window;
|
||||||
|
|
||||||
window = gst_wl_window_new_from_surface (display,
|
window = gst_wl_window_new_internal (display,
|
||||||
wl_compositor_create_surface (display->compositor));
|
wl_compositor_create_surface (display->compositor));
|
||||||
window->own_surface = TRUE;
|
|
||||||
|
|
||||||
window->subsurface = wl_subcompositor_get_subsurface (display->subcompositor,
|
window->subsurface = wl_subcompositor_get_subsurface (display->subcompositor,
|
||||||
window->surface, parent);
|
window->surface, parent);
|
||||||
|
@ -138,38 +158,6 @@ gst_wl_window_new_in_surface (GstWlDisplay * display,
|
||||||
return window;
|
return window;
|
||||||
}
|
}
|
||||||
|
|
||||||
GstWlWindow *
|
|
||||||
gst_wl_window_new_from_surface (GstWlDisplay * display,
|
|
||||||
struct wl_surface * surface)
|
|
||||||
{
|
|
||||||
GstWlWindow *window;
|
|
||||||
struct wl_region *region;
|
|
||||||
|
|
||||||
g_return_val_if_fail (surface != NULL, NULL);
|
|
||||||
|
|
||||||
window = g_object_new (GST_TYPE_WL_WINDOW, NULL);
|
|
||||||
window->display = g_object_ref (display);
|
|
||||||
window->x = 0;
|
|
||||||
window->y = 0;
|
|
||||||
window->width = 0;
|
|
||||||
window->height = 0;
|
|
||||||
|
|
||||||
window->surface = surface;
|
|
||||||
window->own_surface = FALSE;
|
|
||||||
|
|
||||||
/* make sure the surface runs on our local queue */
|
|
||||||
wl_proxy_set_queue ((struct wl_proxy *) surface, display->queue);
|
|
||||||
|
|
||||||
window->viewport = wl_scaler_get_viewport (display->scaler, window->surface);
|
|
||||||
|
|
||||||
/* do not accept input */
|
|
||||||
region = wl_compositor_create_region (display->compositor);
|
|
||||||
wl_surface_set_input_region (surface, region);
|
|
||||||
wl_region_destroy (region);
|
|
||||||
|
|
||||||
return window;
|
|
||||||
}
|
|
||||||
|
|
||||||
GstWlDisplay *
|
GstWlDisplay *
|
||||||
gst_wl_window_get_display (GstWlWindow * window)
|
gst_wl_window_get_display (GstWlWindow * window)
|
||||||
{
|
{
|
||||||
|
|
|
@ -45,7 +45,6 @@ struct _GstWlWindow
|
||||||
struct wl_viewport *viewport;
|
struct wl_viewport *viewport;
|
||||||
struct wl_shell_surface *shell_surface;
|
struct wl_shell_surface *shell_surface;
|
||||||
gint x, y, width, height;
|
gint x, y, width, height;
|
||||||
gboolean own_surface;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GstWlWindowClass
|
struct _GstWlWindowClass
|
||||||
|
@ -59,8 +58,6 @@ GstWlWindow *gst_wl_window_new_toplevel (GstWlDisplay * display,
|
||||||
gint width, gint height);
|
gint width, gint height);
|
||||||
GstWlWindow *gst_wl_window_new_in_surface (GstWlDisplay * display,
|
GstWlWindow *gst_wl_window_new_in_surface (GstWlDisplay * display,
|
||||||
struct wl_surface * parent);
|
struct wl_surface * parent);
|
||||||
GstWlWindow *gst_wl_window_new_from_surface (GstWlDisplay * display,
|
|
||||||
struct wl_surface * surface);
|
|
||||||
|
|
||||||
GstWlDisplay *gst_wl_window_get_display (GstWlWindow * window);
|
GstWlDisplay *gst_wl_window_get_display (GstWlWindow * window);
|
||||||
struct wl_surface *gst_wl_window_get_wl_surface (GstWlWindow * window);
|
struct wl_surface *gst_wl_window_get_wl_surface (GstWlWindow * window);
|
||||||
|
|
Loading…
Reference in a new issue