summaryrefslogtreecommitdiffstats
path: root/player/command.c
diff options
context:
space:
mode:
authorAvi Halachmi (:avih) <avihpit@yahoo.com>2019-12-25 20:52:19 +0200
committeravih <avih@users.noreply.github.com>2020-11-16 20:29:58 +0200
commit58004ea2ef1a14da51b3f46e1c8565c0a3a91ee0 (patch)
tree80801338176bfee806bfd98b6904a804fabec527 /player/command.c
parent0d5055fe93e35770235902e11ff39b3231e6e1b8 (diff)
downloadmpv-58004ea2ef1a14da51b3f46e1c8565c0a3a91ee0.tar.bz2
mpv-58004ea2ef1a14da51b3f46e1c8565c0a3a91ee0.tar.xz
command: mouse-pos property: add field "hover"
Add a third field: "hover", which is updated from input.c after input keys MP_KEY_MOUSE_LEAVE and MP_KEY_MOUSE_ENTER - which are typically sent by the VO. It's part of mouse-pos and not a new property because it's highly tied to mouse-pos - it makes x/y invalid while the cursor doesn't hover the window. Unike mouse-move, no dummy command was generated, so we add dummy command in order for observer notification to work even while nothing is bound. Like mouse-pos, clients could not detect whether the mouse pointer hovers the window because the OSC force-binds the MOUSE_LEAVE key, and now they can using the hover field. The lua mp.get_mouse_pos() wrapper still returns only x, y because that's what osc.lua needs. Other clients can simply read the property.
Diffstat (limited to 'player/command.c')
-rw-r--r--player/command.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/player/command.c b/player/command.c
index ddaf0615f4..ba234ddc9f 100644
--- a/player/command.c
+++ b/player/command.c
@@ -2633,12 +2633,13 @@ static int mp_property_mouse_pos(void *ctx, struct m_property *prop,
case M_PROPERTY_GET: {
struct mpv_node node;
- int x, y;
- mp_input_get_mouse_pos(mpctx->input, &x, &y);
+ int x, y, hover;
+ mp_input_get_mouse_pos(mpctx->input, &x, &y, &hover);
node_init(&node, MPV_FORMAT_NODE_MAP, NULL);
node_map_add_int64(&node, "x", x);
node_map_add_int64(&node, "y", y);
+ node_map_add_flag(&node, "hover", hover);
*(struct mpv_node *)arg = node;
return M_PROPERTY_OK;