From bb9b6501fda409420acda7e41cec7eb990037f50 Mon Sep 17 00:00:00 2001 From: Alexander Preisinger Date: Thu, 16 May 2013 16:43:34 +0200 Subject: wayland: introduce vo_wayland_config This removes the need for exposing vo_wayland_fullscreen and other functions also this will be usefull for other vos in the future. --- video/out/gl_wayland.c | 9 ++------- video/out/wayland_common.c | 34 +++++++++++++++++++++------------- video/out/wayland_common.h | 7 +------ 3 files changed, 24 insertions(+), 26 deletions(-) (limited to 'video') diff --git a/video/out/gl_wayland.c b/video/out/gl_wayland.c index fab61edb64..7fb9c4d810 100644 --- a/video/out/gl_wayland.c +++ b/video/out/gl_wayland.c @@ -184,13 +184,9 @@ static bool config_window_wayland(struct MPGLContext *ctx, wl->window->resize_func = egl_resize_func; wl->window->resize_func_data = (void*) egl_ctx; - wl->window->width = d_width; - wl->window->height = d_height; - vo_wayland_update_window_title(ctx->vo); - - if ((VOFLAG_FULLSCREEN & flags) && wl->window->type != TYPE_FULLSCREEN) - vo_wayland_fullscreen(ctx->vo); + if (!vo_wayland_config(ctx->vo, d_width, d_height, flags)) + return false; if (!egl_ctx->egl.ctx) { /* Create OpenGL context */ @@ -244,7 +240,6 @@ void mpgl_set_backend_wayland(MPGLContext *ctx) ctx->config_window = config_window_wayland; ctx->releaseGlContext = releaseGlContext_wayland; ctx->swapGlBuffers = swapGlBuffers_wayland; - ctx->check_events = vo_wayland_check_events; ctx->vo_control = vo_wayland_control; ctx->vo_init = vo_wayland_init; ctx->vo_uninit = vo_wayland_uninit; diff --git a/video/out/wayland_common.c b/video/out/wayland_common.c index 2e15703709..7c358ab951 100644 --- a/video/out/wayland_common.c +++ b/video/out/wayland_common.c @@ -64,6 +64,7 @@ static void resize_window(struct vo_wayland_state *wl, int32_t width, int32_t height); +static void vo_wayland_fullscreen (struct vo *vo); /*** wayland interface ***/ @@ -687,8 +688,7 @@ int vo_wayland_init (struct vo *vo) vo->event_fd = wl->display->display_fd; create_window(wl); - vo_wayland_update_window_title(vo); - return 1; + return true; } void vo_wayland_uninit (struct vo *vo) @@ -701,7 +701,7 @@ void vo_wayland_uninit (struct vo *vo) vo->wayland = NULL; } -void vo_wayland_ontop (struct vo *vo) +static void vo_wayland_ontop (struct vo *vo) { struct vo_wayland_state *wl = vo->wayland; @@ -715,7 +715,7 @@ void vo_wayland_ontop (struct vo *vo) wl_shell_surface_set_toplevel(wl->window->shell_surface); } -void vo_wayland_border (struct vo *vo) +static void vo_wayland_border (struct vo *vo) { /* wayland clienst have to do the decorations themself * (client side decorations) but there is no such code implement nor @@ -726,7 +726,7 @@ void vo_wayland_border (struct vo *vo) */ } -void vo_wayland_fullscreen (struct vo *vo) +static void vo_wayland_fullscreen (struct vo *vo) { struct vo_wayland_state *wl = vo->wayland; if (!wl->window || !wl->display->shell) @@ -757,7 +757,7 @@ void vo_wayland_fullscreen (struct vo *vo) } } -int vo_wayland_check_events (struct vo *vo) +static int vo_wayland_check_events (struct vo *vo) { struct vo_wayland_state *wl = vo->wayland; struct wl_display *dp = wl->display->display; @@ -803,7 +803,7 @@ int vo_wayland_check_events (struct vo *vo) return ret; } -void vo_wayland_update_screeninfo (struct vo *vo) +static void vo_wayland_update_screeninfo (struct vo *vo) { struct vo_wayland_state *wl = vo->wayland; struct mp_vo_opts *opts = vo->opts; @@ -856,12 +856,6 @@ void vo_wayland_update_screeninfo (struct vo *vo) aspect_save_screenres(vo, opts->screenwidth, opts->screenheight); } -void vo_wayland_update_window_title(struct vo *vo) -{ - struct vo_wayland_window *w = vo->wayland->window; - wl_shell_surface_set_title(w->shell_surface, vo_get_window_title(vo)); -} - int vo_wayland_control(struct vo *vo, int *events, int request, void *arg) { switch (request) { @@ -885,3 +879,17 @@ int vo_wayland_control(struct vo *vo, int *events, int request, void *arg) } return VO_NOTIMPL; } + +bool vo_wayland_config(struct vo *vo, uint32_t d_width, uint32_t d_height, uint32_t flags) +{ + struct vo_wayland_window *w = vo->wayland->window; + + w->width = d_width; + w->height = d_height; + + if ((VOFLAG_FULLSCREEN & flags) && w->type != TYPE_FULLSCREEN) + vo_wayland_fullscreen(vo); + + wl_shell_surface_set_title(w->shell_surface, vo_get_window_title(vo)); + return true; +} diff --git a/video/out/wayland_common.h b/video/out/wayland_common.h index c3ff0522cb..3b643f8f49 100644 --- a/video/out/wayland_common.h +++ b/video/out/wayland_common.h @@ -124,12 +124,7 @@ struct vo_wayland_state { int vo_wayland_init(struct vo *vo); void vo_wayland_uninit(struct vo *vo); -void vo_wayland_ontop(struct vo *vo); -void vo_wayland_border(struct vo *vo); -void vo_wayland_fullscreen(struct vo *vo); -void vo_wayland_update_screeninfo(struct vo *vo); -int vo_wayland_check_events(struct vo *vo); -void vo_wayland_update_window_title(struct vo *vo); +bool vo_wayland_config(struct vo *vo, uint32_t d_width, uint32_t d_height, uint32_t flags); int vo_wayland_control(struct vo *vo, int *events, int request, void *arg); #endif /* MPLAYER_WAYLAND_COMMON_H */ -- cgit v1.2.3