/*
* This file is part of mpv video player.
*
* mpv is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* mpv is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with mpv. If not, see <http://www.gnu.org/licenses/>.
*/
#include <errno.h>
#include <limits.h>
#include <poll.h>
#include <unistd.h>
#include <linux/input.h>
#include <time.h>
#include "common/msg.h"
#include "options/m_config.h"
#include "input/input.h"
#include "input/keycodes.h"
#include "osdep/io.h"
#include "osdep/timer.h"
#include "win_state.h"
#include "wayland_common.h"
// Generated from xdg-shell.xml
#include "video/out/wayland/xdg-shell.h"
// Generated from idle-inhibit-unstable-v1.xml
#include "video/out/wayland/idle-inhibit-v1.h"
// Generated from xdg-decoration-unstable-v1.xml
#include "video/out/wayland/xdg-decoration-v1.h"
// Generated from presentation-time.xml
#include "video/out/wayland/presentation-time.h"
#define OPT_BASE_STRUCT struct wayland_opts
const struct m_sub_options wayland_conf = {
.opts = (const struct m_option[]) {
OPT_INTRANGE("wayland-frame-wait-offset", frame_offset, 0, -500, 3000),
OPT_FLAG("wayland-disable-vsync", disable_vsync, 0),
OPT_INTRANGE("wayland-edge-pixels-pointer", edge_pixels_pointer, 10, 0, INT_MAX),
OPT_INTRANGE("wayland-edge-pixels-touch", edge_pixels_touch, 64, 0, INT_MAX),
{0},
},
.size = sizeof(struct wayland_opts),
.defaults = &(struct wayland_opts) {
.frame_offset = 1000,
.disable_vsync = false,
.edge_pixels_pointer = 10,
.edge_pixels_touch = 64,
},
};
static void xdg_wm_base_ping(void *data, struct xdg_wm_base *wm_base, uint32_t serial)
{
xdg_wm_base_pong(wm_base, serial);
}
static const struct xdg_wm_base_listener xdg_wm_base_listener = {
xdg_wm_base_ping,
};
static int spawn_cursor(struct vo_wayland_state *wl)
{
if (wl->allocated_cursor_scale == wl->scaling) /* Reuse if size is identical */
return 0;
else if (wl->cursor_theme)
wl_cursor_theme_
|