Skip to content

Commit

Permalink
Fix: Failed to get mouse release event since Blender 3.2 (#116)
Browse files Browse the repository at this point in the history
  • Loading branch information
nutti committed Jun 16, 2022
1 parent 86652b8 commit 3e9ef10
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/screencast_keys/ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -1603,13 +1603,23 @@ def update_hold_mouse_buttons(self, event):
if (event.type != 'MOUSEMOVE') and (event.type not in self.hold_mouse_buttons.keys()):
return

# Note: This is not complete solution.
# Release event is not fired in specific cases (ex. open context menu, mouse drag, ...).
# To solve this issue, use 'MOUSEMOVE' event which will not be fired when
# some mouse key is not pressed.
if event.type == 'MOUSEMOVE':
if event.value == 'RELEASE':
reset = False
if compat.check_version(3, 2, 0) < 0:
if event.value == 'RELEASE':
reset = True
else:
reset = True

if reset:
for k in self.hold_mouse_buttons.keys():
self.hold_mouse_buttons[k] = False
return

if event.value == 'PRESS':
if event.value == 'PRESS' or event.value == 'CLICK_DRAG':
self.hold_mouse_buttons[event.type] = True
elif event.value == 'RELEASE':
self.hold_mouse_buttons[event.type] = False
Expand Down

0 comments on commit 3e9ef10

Please sign in to comment.