summaryrefslogtreecommitdiff
path: root/osd.lua
diff options
context:
space:
mode:
Diffstat (limited to 'osd.lua')
-rw-r--r--osd.lua19
1 files changed, 15 insertions, 4 deletions
diff --git a/osd.lua b/osd.lua
index bbd4ee6..a793286 100644
--- a/osd.lua
+++ b/osd.lua
@@ -793,10 +793,21 @@ function mt:update_mstate(mactive)
end
function mt:set_mpos(mpos)
- -- mpv sends (0, 0) on startup if the mouse hasn't moved yet. don't
- -- trigger display of the button until the mouse has actually moved.
- if not self.mpos and mpos and mpos.x == 0 and mpos.y == 0 then
- return
+ -- when mpv gains hover, it sends the last known coordinates prior to
+ -- losing hover, not the actual coordinates of the mouse. these events
+ -- are dropped to avoid reporting an incorrect mouse state, requiring a
+ -- mouse move before honouring anything dependent on mouse state.
+ --
+ -- mpv also sends coordinates of (0, 0) on startup. no special logic is
+ -- needed for this because it is sent with a hover state of false,
+ -- before a possible second event with a hover state of true.
+ if mpos then
+ if self.mpos_dehover and mpos.x == self.mpos_dehover.x and
+ mpos.y == self.mpos_dehover.y then
+ return
+ end
+
+ self.mpos_dehover = not mpos.hover and mpos or nil
end
self.mpos = mpos