summaryrefslogtreecommitdiffstats
path: root/video/out/wayland_common.c
diff options
context:
space:
mode:
authorPhilip Langdale <philipl@overt.org>2019-11-27 07:36:35 +0800
committerPhilip Langdale <github.philipl@overt.org>2019-11-29 16:56:20 +0800
commit5e3eb03ecfc604652705d56c778c08ccead9e64e (patch)
tree351a508e37467c1074ad55c977d493b90dc71f1b /video/out/wayland_common.c
parent4c179a27c2fe301d51232934275250b63275f86b (diff)
downloadmpv-5e3eb03ecfc604652705d56c778c08ccead9e64e.tar.bz2
mpv-5e3eb03ecfc604652705d56c778c08ccead9e64e.tar.xz
wayland: make the edge grab zone width user configurable
Rather than hard-coding the edge grab zone width, we can make it user configurable. It seems worthwhile to have separate configs for pointer and touch usage as the defaults should be different, and a user might have both input methods in use.
Diffstat (limited to 'video/out/wayland_common.c')
-rw-r--r--video/out/wayland_common.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/video/out/wayland_common.c b/video/out/wayland_common.c
index c9da326b5a..990a3c500f 100644
--- a/video/out/wayland_common.c
+++ b/video/out/wayland_common.c
@@ -47,18 +47,19 @@ 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,
},
};
-#define POINTER_EDGE_PIXELS 5
-#define TOUCH_EDGE_PIXELS 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);
@@ -246,7 +247,7 @@ static void pointer_handle_button(void *data, struct wl_pointer *wl_pointer,
// Implement an edge resize zone if there are no decorations
if (!wl->xdg_toplevel_decoration &&
check_for_resize(wl, wl->mouse_unscaled_x, wl->mouse_unscaled_y,
- POINTER_EDGE_PIXELS, &edges))
+ wl->opts->edge_pixels_pointer, &edges))
xdg_toplevel_resize(wl->xdg_toplevel, wl->seat, serial, edges);
else
window_move(wl, serial);
@@ -291,7 +292,7 @@ static void touch_handle_down(void *data, struct wl_touch *wl_touch,
struct vo_wayland_state *wl = data;
enum xdg_toplevel_resize_edge edge;
- if (check_for_resize(wl, x_w, y_w, TOUCH_EDGE_PIXELS, &edge)) {
+ if (check_for_resize(wl, x_w, y_w, wl->opts->edge_pixels_touch, &edge)) {
wl->touch_entries = 0;
xdg_toplevel_resize(wl->xdg_toplevel, wl->seat, serial, edge);
return;