diff options
author | George Kiagiadakis <george.kiagiadakis@collabora.com> | 2014-05-26 12:54:10 +0300 |
---|---|---|
committer | George Kiagiadakis <george.kiagiadakis@collabora.com> | 2014-06-17 13:51:27 +0200 |
commit | 61e077155b6b11938d91aefcdb9e2d9ae19784b2 (patch) | |
tree | d3b68549c75152acd18ca66ae7db696d09753ec1 | |
parent | 39c5a9ce13a1f2d8156903e1376396c2c8cf5671 (diff) | |
download | gstreamer-plugins-bad-61e077155b6b11938d91aefcdb9e2d9ae19784b2.tar.gz |
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)
-rw-r--r-- | ext/wayland/wlwindow.c | 72 | ||||
-rw-r--r-- | ext/wayland/wlwindow.h | 3 |
2 files changed, 30 insertions, 45 deletions
diff --git a/ext/wayland/wlwindow.c b/ext/wayland/wlwindow.c index c3e513add..6d4588539 100644 --- a/ext/wayland/wlwindow.c +++ b/ext/wayland/wlwindow.c @@ -74,33 +74,54 @@ gst_wl_window_finalize (GObject * gobject) { GstWlWindow *self = GST_WL_WINDOW (gobject); - wl_viewport_destroy (self->viewport); - if (self->shell_surface) { wl_shell_surface_destroy (self->shell_surface); } - if (self->own_surface) { - wl_surface_destroy (self->surface); - } - if (self->subsurface) { wl_subsurface_destroy (self->subsurface); } + wl_viewport_destroy (self->viewport); + wl_surface_destroy (self->surface); + g_clear_object (&self->display); 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 * gst_wl_window_new_toplevel (GstWlDisplay * display, gint width, gint height) { GstWlWindow *window; - window = gst_wl_window_new_from_surface (display, + window = gst_wl_window_new_internal (display, wl_compositor_create_surface (display->compositor)); - window->own_surface = TRUE; gst_wl_window_set_size (window, 0, 0, width, height); @@ -127,9 +148,8 @@ gst_wl_window_new_in_surface (GstWlDisplay * display, { GstWlWindow *window; - window = gst_wl_window_new_from_surface (display, + window = gst_wl_window_new_internal (display, wl_compositor_create_surface (display->compositor)); - window->own_surface = TRUE; window->subsurface = wl_subcompositor_get_subsurface (display->subcompositor, window->surface, parent); @@ -138,38 +158,6 @@ gst_wl_window_new_in_surface (GstWlDisplay * display, 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 * gst_wl_window_get_display (GstWlWindow * window) { diff --git a/ext/wayland/wlwindow.h b/ext/wayland/wlwindow.h index ca30fdad6..51e3d793c 100644 --- a/ext/wayland/wlwindow.h +++ b/ext/wayland/wlwindow.h @@ -45,7 +45,6 @@ struct _GstWlWindow struct wl_viewport *viewport; struct wl_shell_surface *shell_surface; gint x, y, width, height; - gboolean own_surface; }; struct _GstWlWindowClass @@ -59,8 +58,6 @@ GstWlWindow *gst_wl_window_new_toplevel (GstWlDisplay * display, gint width, gint height); GstWlWindow *gst_wl_window_new_in_surface (GstWlDisplay * display, 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); struct wl_surface *gst_wl_window_get_wl_surface (GstWlWindow * window); |