diff options
| -rw-r--r-- | osd.lua | 19 |
1 files changed, 15 insertions, 4 deletions
@@ -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 |
