summaryrefslogtreecommitdiffstats
path: root/video/out/gl_wayland.c
diff options
context:
space:
mode:
authorAlexander Preisinger <alexander.preisinger@gmail.com>2013-07-18 17:35:28 +0200
committerAlexander Preisinger <alexander.preisinger@gmail.com>2013-07-18 17:52:56 +0200
commit3dc063a3308e2f3e2a1a94f2a6b1c58e64a757bb (patch)
tree9a3fdfb642e6df9128a8a041def4991861321b68 /video/out/gl_wayland.c
parentc5b76714a0c9d57521b08e135f4f3c4e35c8b245 (diff)
downloadmpv-3dc063a3308e2f3e2a1a94f2a6b1c58e64a757bb.tar.bz2
mpv-3dc063a3308e2f3e2a1a94f2a6b1c58e64a757bb.tar.xz
wayland: use a unified struct for the state
This commit removes the pointer to the single different structures for input and window and puts them as anonymous structures inside the wayland_state structure. This has the disadvantage of passing the substructure to the listeners, but the advantage is that we don't have to allocate them and check for NULL pointers. This makes it more reliable and easier to follow.
Diffstat (limited to 'video/out/gl_wayland.c')
-rw-r--r--video/out/gl_wayland.c37
1 files changed, 18 insertions, 19 deletions
diff --git a/video/out/gl_wayland.c b/video/out/gl_wayland.c
index cb5cba0758..ad97d0b27e 100644
--- a/video/out/gl_wayland.c
+++ b/video/out/gl_wayland.c
@@ -44,7 +44,6 @@ static void egl_resize_func(struct vo_wayland_state *wl,
int32_t height,
void *user_data)
{
- struct vo_wayland_window *w = wl->window;
struct egl_context *ctx = user_data;
int32_t minimum_size = 150;
int32_t x, y;
@@ -55,8 +54,8 @@ static void egl_resize_func(struct vo_wayland_state *wl,
/* get the real window size of the window */
wl_egl_window_get_attached_size(ctx->egl_window,
- &w->width,
- &w->height);
+ &wl->window.width,
+ &wl->window.height);
if (width < minimum_size)
width = minimum_size;
@@ -68,7 +67,7 @@ static void egl_resize_func(struct vo_wayland_state *wl,
switch (edges) {
case WL_SHELL_SURFACE_RESIZE_TOP:
case WL_SHELL_SURFACE_RESIZE_BOTTOM:
- width = w->aspect * height;
+ width = wl->window.aspect * height;
break;
case WL_SHELL_SURFACE_RESIZE_LEFT:
case WL_SHELL_SURFACE_RESIZE_RIGHT:
@@ -76,31 +75,31 @@ static void egl_resize_func(struct vo_wayland_state *wl,
case WL_SHELL_SURFACE_RESIZE_TOP_RIGHT:
case WL_SHELL_SURFACE_RESIZE_BOTTOM_LEFT:
case WL_SHELL_SURFACE_RESIZE_BOTTOM_RIGHT:
- height = (1 / w->aspect) * width;
+ height = (1 / wl->window.aspect) * width;
break;
default:
- if (w->aspect < temp_aspect)
- width = w->aspect * height;
+ if (wl->window.aspect < temp_aspect)
+ width = wl->window.aspect * height;
else
- height = (1 / w->aspect) * width;
+ height = (1 / wl->window.aspect) * width;
break;
}
if (edges & WL_SHELL_SURFACE_RESIZE_LEFT)
- x = w->width - width;
+ x = wl->window.width - width;
else
x = 0;
if (edges & WL_SHELL_SURFACE_RESIZE_TOP)
- y = w->height - height;
+ y = wl->window.height - height;
else
y = 0;
wl_egl_window_resize(ctx->egl_window, width, height, x, y);
- w->width = width;
- w->height = height;
+ wl->window.width = width;
+ wl->window.height = height;
/* set size for mplayer */
wl->vo->dwidth = width;
@@ -117,7 +116,7 @@ static bool egl_create_context(struct vo_wayland_state *wl,
GL *gl = ctx->gl;
const char *eglstr = "";
- if (!(egl_ctx->egl.dpy = eglGetDisplay(wl->display->display)))
+ if (!(egl_ctx->egl.dpy = eglGetDisplay(wl->display.display)))
return false;
EGLint config_attribs[] = {
@@ -174,9 +173,9 @@ static void egl_create_window(struct vo_wayland_state *wl,
uint32_t width,
uint32_t height)
{
- egl_ctx->egl_window = wl_egl_window_create(wl->window->surface,
- wl->window->width,
- wl->window->height);
+ egl_ctx->egl_window = wl_egl_window_create(wl->window.surface,
+ wl->window.width,
+ wl->window.height);
egl_ctx->egl_surface = eglCreateWindowSurface(egl_ctx->egl.dpy,
egl_ctx->egl.conf,
@@ -188,7 +187,7 @@ static void egl_create_window(struct vo_wayland_state *wl,
egl_ctx->egl_surface,
egl_ctx->egl.ctx);
- wl_display_dispatch_pending(wl->display->display);
+ wl_display_dispatch_pending(wl->display.display);
}
@@ -202,8 +201,8 @@ static bool config_window_wayland(struct MPGLContext *ctx,
bool enable_alpha = !!(flags & VOFLAG_ALPHA);
bool ret = false;
- wl->window->resize_func = egl_resize_func;
- wl->window->resize_func_data = (void*) egl_ctx;
+ wl->window.resize_func = egl_resize_func;
+ wl->window.resize_func_data = (void*) egl_ctx;
if (!vo_wayland_config(ctx->vo, d_width, d_height, flags))
return false;