summaryrefslogtreecommitdiffstats
path: root/input
diff options
context:
space:
mode:
authorMartin Herkt <lachs0r@srsfckn.biz>2016-02-28 23:31:51 +0100
committerMartin Herkt <lachs0r@srsfckn.biz>2016-02-28 23:31:51 +0100
commit21cd4ff05bb46b375a9ad38c9f0b7f8e71a5d979 (patch)
treeb9679cc1d2c7c3cab0f88c370015f34f6d0b27ca /input
parentd1d6257731866934717353fce484f5f472f845d1 (diff)
parent1f436f65f2ee4df6419ca68bd6426b8283db6d22 (diff)
downloadmpv-21cd4ff05bb46b375a9ad38c9f0b7f8e71a5d979.tar.bz2
mpv-21cd4ff05bb46b375a9ad38c9f0b7f8e71a5d979.tar.xz
Merge branch 'master' into release/current
Diffstat (limited to 'input')
-rw-r--r--input/cmd_list.c2
-rw-r--r--input/cmd_list.h2
-rw-r--r--input/event.c14
-rw-r--r--input/event.h14
-rw-r--r--input/input.c28
-rw-r--r--input/input.h6
-rw-r--r--input/ipc.c16
7 files changed, 53 insertions, 29 deletions
diff --git a/input/cmd_list.c b/input/cmd_list.c
index 2f3bfb994a..b5e29aab0e 100644
--- a/input/cmd_list.c
+++ b/input/cmd_list.c
@@ -180,9 +180,11 @@ const struct mp_cmd_def mp_cmds[] = {
{ MP_CMD_DROP_BUFFERS, "drop-buffers", },
{ MP_CMD_AF, "af", { ARG_STRING, ARG_STRING } },
+ { MP_CMD_AF_COMMAND, "af-command", { ARG_STRING, ARG_STRING, ARG_STRING } },
{ MP_CMD_AO_RELOAD, "ao-reload", },
{ MP_CMD_VF, "vf", { ARG_STRING, ARG_STRING } },
+ { MP_CMD_VF_COMMAND, "vf-command", { ARG_STRING, ARG_STRING, ARG_STRING } },
{ MP_CMD_VO_CMDLINE, "vo-cmdline", { ARG_STRING } },
diff --git a/input/cmd_list.h b/input/cmd_list.h
index c8c0dc3593..4e324bf01c 100644
--- a/input/cmd_list.h
+++ b/input/cmd_list.h
@@ -92,10 +92,12 @@ enum mp_command_type {
/// Audio Filter commands
MP_CMD_AF,
+ MP_CMD_AF_COMMAND,
MP_CMD_AO_RELOAD,
/// Video filter commands
MP_CMD_VF,
+ MP_CMD_VF_COMMAND,
/// Video output commands
MP_CMD_VO_CMDLINE,
diff --git a/input/event.c b/input/event.c
index 2c46978b15..f765342518 100644
--- a/input/event.c
+++ b/input/event.c
@@ -1,18 +1,18 @@
/*
* This file is part of mpv.
*
- * mpv is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
+ * 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 General Public License for more details.
+ * GNU Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along
- * with mpv. If not, see <http://www.gnu.org/licenses/>.
+ * 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 "event.h"
diff --git a/input/event.h b/input/event.h
index e2ce36b329..3a06ce1d1d 100644
--- a/input/event.h
+++ b/input/event.h
@@ -1,18 +1,18 @@
/*
* This file is part of mpv.
*
- * mpv is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
+ * 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 General Public License for more details.
+ * GNU Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along
- * with mpv. If not, see <http://www.gnu.org/licenses/>.
+ * 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 "misc/bstr.h"
diff --git a/input/input.c b/input/input.c
index d1c69a9587..ff7dcea67e 100644
--- a/input/input.c
+++ b/input/input.c
@@ -604,7 +604,8 @@ static void interpret_key(struct input_ctx *ictx, int code, double scale)
mp_input_queue_cmd(ictx, cmd);
}
-static void mp_input_feed_key(struct input_ctx *ictx, int code, double scale)
+static void mp_input_feed_key(struct input_ctx *ictx, int code, double scale,
+ bool force_mouse)
{
struct input_opts *opts = ictx->opts;
@@ -615,7 +616,7 @@ static void mp_input_feed_key(struct input_ctx *ictx, int code, double scale)
release_down_cmd(ictx, false);
return;
}
- if (!opts->enable_mouse_movements && MP_KEY_IS_MOUSE(unmod))
+ if (!opts->enable_mouse_movements && MP_KEY_IS_MOUSE(unmod) && !force_mouse)
return;
if (unmod == MP_KEY_MOUSE_LEAVE || unmod == MP_KEY_MOUSE_ENTER) {
update_mouse_section(ictx);
@@ -643,7 +644,14 @@ static void mp_input_feed_key(struct input_ctx *ictx, int code, double scale)
void mp_input_put_key(struct input_ctx *ictx, int code)
{
input_lock(ictx);
- mp_input_feed_key(ictx, code, 1);
+ mp_input_feed_key(ictx, code, 1, false);
+ input_unlock(ictx);
+}
+
+void mp_input_put_key_artificial(struct input_ctx *ictx, int code)
+{
+ input_lock(ictx);
+ mp_input_feed_key(ictx, code, 1, true);
input_unlock(ictx);
}
@@ -662,7 +670,7 @@ void mp_input_put_axis(struct input_ctx *ictx, int direction, double value)
if (value == 0.0)
return;
input_lock(ictx);
- mp_input_feed_key(ictx, direction, value);
+ mp_input_feed_key(ictx, direction, value, false);
input_unlock(ictx);
}
@@ -699,11 +707,17 @@ bool mp_input_vo_keyboard_enabled(struct input_ctx *ictx)
void mp_input_set_mouse_pos(struct input_ctx *ictx, int x, int y)
{
input_lock(ictx);
+ if (ictx->opts->enable_mouse_movements)
+ mp_input_set_mouse_pos_artificial(ictx, x, y);
+ input_unlock(ictx);
+}
+
+void mp_input_set_mouse_pos_artificial(struct input_ctx *ictx, int x, int y)
+{
+ input_lock(ictx);
MP_DBG(ictx, "mouse move %d/%d\n", x, y);
- if ((ictx->mouse_vo_x == x && ictx->mouse_vo_y == y) ||
- !ictx->opts->enable_mouse_movements)
- {
+ if (ictx->mouse_vo_x == x && ictx->mouse_vo_y == y) {
input_unlock(ictx);
return;
}
diff --git a/input/input.h b/input/input.h
index 6462555326..41432eb54d 100644
--- a/input/input.h
+++ b/input/input.h
@@ -132,6 +132,9 @@ void mp_input_src_feed_cmd_text(struct mp_input_src *src, char *buf, size_t len)
// with modifiers applied. MP_INPUT_RELEASE_ALL is also a valid value.
void mp_input_put_key(struct input_ctx *ictx, int code);
+// Like mp_input_put_key(), but ignore mouse disable option for mouse buttons.
+void mp_input_put_key_artificial(struct input_ctx *ictx, int code);
+
// Like mp_input_put_key(), but process all UTF-8 characters in the given
// string as key events.
void mp_input_put_key_utf8(struct input_ctx *ictx, int mods, struct bstr t);
@@ -143,6 +146,9 @@ void mp_input_put_axis(struct input_ctx *ictx, int direction, double value);
// Update mouse position (in window coordinates).
void mp_input_set_mouse_pos(struct input_ctx *ictx, int x, int y);
+// Like mp_input_set_mouse_pos(), but ignore mouse disable option.
+void mp_input_set_mouse_pos_artificial(struct input_ctx *ictx, int x, int y);
+
void mp_input_get_mouse_pos(struct input_ctx *ictx, int *x, int *y);
// Return whether we want/accept mouse input.
diff --git a/input/ipc.c b/input/ipc.c
index 5ed057edb6..c628fc9ea4 100644
--- a/input/ipc.c
+++ b/input/ipc.c
@@ -1,18 +1,18 @@
/*
* This file is part of mpv.
*
- * mpv is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
+ * 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 General Public License for more details.
+ * GNU Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along
- * with mpv. If not, see <http://www.gnu.org/licenses/>.
+ * 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 <pthread.h>
@@ -740,7 +740,7 @@ static void *ipc_thread(void *p)
int rc;
int ipc_fd;
- struct sockaddr_un ipc_un;
+ struct sockaddr_un ipc_un = {0};
struct mp_ipc_ctx *arg = p;