mirror of
https://github.com/mpv-player/mpv
synced 2025-02-17 21:27:08 +00:00
wayland: don't create our own log context
This was more problematic than useful ([vo/wayland/wayland])
This commit is contained in:
parent
5895d6c24f
commit
beab54506e
@ -27,7 +27,6 @@
|
|||||||
#include "gl_common.h"
|
#include "gl_common.h"
|
||||||
|
|
||||||
struct egl_context {
|
struct egl_context {
|
||||||
struct mp_log *log;
|
|
||||||
EGLSurface egl_surface;
|
EGLSurface egl_surface;
|
||||||
|
|
||||||
struct wl_egl_window *egl_window;
|
struct wl_egl_window *egl_window;
|
||||||
@ -53,10 +52,10 @@ static void egl_resize(struct vo_wayland_state *wl,
|
|||||||
&wl->window.width,
|
&wl->window.width,
|
||||||
&wl->window.height);
|
&wl->window.height);
|
||||||
|
|
||||||
MP_VERBOSE(ctx, "resizing %dx%d -> %dx%d\n", wl->window.width,
|
MP_DBG(wl->vo, "resizing %dx%d -> %dx%d\n", wl->window.width,
|
||||||
wl->window.height,
|
wl->window.height,
|
||||||
width,
|
width,
|
||||||
height);
|
height);
|
||||||
|
|
||||||
if (x != 0)
|
if (x != 0)
|
||||||
x = wl->window.width - width;
|
x = wl->window.width - width;
|
||||||
@ -105,7 +104,7 @@ static bool egl_create_context(struct vo_wayland_state *wl,
|
|||||||
if (eglInitialize(egl_ctx->egl.dpy, &major, &minor) != EGL_TRUE)
|
if (eglInitialize(egl_ctx->egl.dpy, &major, &minor) != EGL_TRUE)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
MP_VERBOSE(egl_ctx, "EGL version %d.%d\n", major, minor);
|
MP_VERBOSE(wl->vo, "EGL version %d.%d\n", major, minor);
|
||||||
|
|
||||||
EGLint context_attribs[] = {
|
EGLint context_attribs[] = {
|
||||||
EGL_CONTEXT_MAJOR_VERSION_KHR,
|
EGL_CONTEXT_MAJOR_VERSION_KHR,
|
||||||
@ -183,8 +182,6 @@ static bool config_window_wayland(struct MPGLContext *ctx,
|
|||||||
bool enable_alpha = !!(flags & VOFLAG_ALPHA);
|
bool enable_alpha = !!(flags & VOFLAG_ALPHA);
|
||||||
bool ret = false;
|
bool ret = false;
|
||||||
|
|
||||||
egl_ctx->log = mp_log_new(egl_ctx, wl->log, "EGL");
|
|
||||||
|
|
||||||
if (!vo_wayland_config(ctx->vo, d_width, d_height, flags))
|
if (!vo_wayland_config(ctx->vo, d_width, d_height, flags))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -220,13 +220,13 @@ static void keyboard_handle_keymap(void *data,
|
|||||||
close(fd);
|
close(fd);
|
||||||
|
|
||||||
if (!wl->input.xkb.keymap) {
|
if (!wl->input.xkb.keymap) {
|
||||||
MP_ERR(wl, "failed to compile keymap\n");
|
MP_ERR(wl->vo, "failed to compile keymap\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
wl->input.xkb.state = xkb_state_new(wl->input.xkb.keymap);
|
wl->input.xkb.state = xkb_state_new(wl->input.xkb.keymap);
|
||||||
if (!wl->input.xkb.state) {
|
if (!wl->input.xkb.state) {
|
||||||
MP_ERR(wl, "failed to create XKB state\n");
|
MP_ERR(wl->vo, "failed to create XKB state\n");
|
||||||
xkb_map_unref(wl->input.xkb.keymap);
|
xkb_map_unref(wl->input.xkb.keymap);
|
||||||
wl->input.xkb.keymap = NULL;
|
wl->input.xkb.keymap = NULL;
|
||||||
return;
|
return;
|
||||||
@ -628,7 +628,7 @@ static bool create_window (struct vo_wayland_state *wl)
|
|||||||
wl->window.surface);
|
wl->window.surface);
|
||||||
|
|
||||||
if (!wl->window.shell_surface) {
|
if (!wl->window.shell_surface) {
|
||||||
MP_ERR(wl, "creating shell surface failed\n");
|
MP_ERR(wl->vo, "creating shell surface failed\n");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -678,7 +678,7 @@ static bool create_input (struct vo_wayland_state *wl)
|
|||||||
wl->input.xkb.context = xkb_context_new(0);
|
wl->input.xkb.context = xkb_context_new(0);
|
||||||
|
|
||||||
if (!wl->input.xkb.context) {
|
if (!wl->input.xkb.context) {
|
||||||
MP_ERR(wl, "failed to initialize input\n");
|
MP_ERR(wl->vo, "failed to initialize input\n");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -706,14 +706,13 @@ int vo_wayland_init (struct vo *vo)
|
|||||||
vo->wayland = talloc_zero(NULL, struct vo_wayland_state);
|
vo->wayland = talloc_zero(NULL, struct vo_wayland_state);
|
||||||
struct vo_wayland_state *wl = vo->wayland;
|
struct vo_wayland_state *wl = vo->wayland;
|
||||||
wl->vo = vo;
|
wl->vo = vo;
|
||||||
wl->log = mp_log_new(wl, vo->log, "wayland");
|
|
||||||
|
|
||||||
if (!create_input(wl)
|
if (!create_input(wl)
|
||||||
|| !create_display(wl)
|
|| !create_display(wl)
|
||||||
|| !create_window(wl)
|
|| !create_window(wl)
|
||||||
|| !create_cursor(wl))
|
|| !create_cursor(wl))
|
||||||
{
|
{
|
||||||
MP_ERR(wl, "failed to initialize backend\n");
|
MP_ERR(wl->vo, "failed to initialize backend\n");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -763,7 +762,7 @@ static void vo_wayland_fullscreen (struct vo *vo)
|
|||||||
struct wl_output *fs_output = wl->display.fs_output;
|
struct wl_output *fs_output = wl->display.fs_output;
|
||||||
|
|
||||||
if (vo->opts->fullscreen) {
|
if (vo->opts->fullscreen) {
|
||||||
MP_VERBOSE(wl, "going fullscreen\n");
|
MP_VERBOSE(wl->vo, "going fullscreen\n");
|
||||||
wl->window.p_width = wl->window.width;
|
wl->window.p_width = wl->window.width;
|
||||||
wl->window.p_height = wl->window.height;
|
wl->window.p_height = wl->window.height;
|
||||||
wl_shell_surface_set_fullscreen(wl->window.shell_surface,
|
wl_shell_surface_set_fullscreen(wl->window.shell_surface,
|
||||||
@ -772,7 +771,7 @@ static void vo_wayland_fullscreen (struct vo *vo)
|
|||||||
}
|
}
|
||||||
|
|
||||||
else {
|
else {
|
||||||
MP_VERBOSE(wl, "leaving fullscreen\n");
|
MP_VERBOSE(wl->vo, "leaving fullscreen\n");
|
||||||
wl_shell_surface_set_toplevel(wl->window.shell_surface);
|
wl_shell_surface_set_toplevel(wl->window.shell_surface);
|
||||||
shedule_resize(wl, 0, wl->window.p_width, wl->window.p_height);
|
shedule_resize(wl, 0, wl->window.p_width, wl->window.p_height);
|
||||||
}
|
}
|
||||||
@ -799,7 +798,7 @@ static int vo_wayland_check_events (struct vo *vo)
|
|||||||
* are events to read from the file descriptor through poll */
|
* are events to read from the file descriptor through poll */
|
||||||
if (poll(&fd, 1, 0) > 0) {
|
if (poll(&fd, 1, 0) > 0) {
|
||||||
if (fd.revents & POLLERR || fd.revents & POLLHUP)
|
if (fd.revents & POLLERR || fd.revents & POLLHUP)
|
||||||
MP_ERR(wl, "error occurred on the display fd\n");
|
MP_ERR(wl->vo, "error occurred on the display fd\n");
|
||||||
if (fd.revents & POLLIN)
|
if (fd.revents & POLLIN)
|
||||||
wl_display_dispatch(dp);
|
wl_display_dispatch(dp);
|
||||||
if (fd.revents & POLLOUT)
|
if (fd.revents & POLLOUT)
|
||||||
@ -842,7 +841,7 @@ static void vo_wayland_update_screeninfo (struct vo *vo)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!mode_received) {
|
if (!mode_received) {
|
||||||
MP_ERR(wl, "no output mode detected\n");
|
MP_ERR(wl->vo, "no output mode detected\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,7 +43,6 @@ struct vo_wayland_output {
|
|||||||
|
|
||||||
struct vo_wayland_state {
|
struct vo_wayland_state {
|
||||||
struct vo *vo;
|
struct vo *vo;
|
||||||
struct mp_log* log;
|
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
int fd;
|
int fd;
|
||||||
|
Loading…
Reference in New Issue
Block a user