Skip to content

OpenToonz - An open-source full-featured 2D animation creation software

C

non-windows: fake mouse right release event

xenogenesi456038b5ce21
diff --git a/toonz/sources/toonz/sceneviewerevents.cpp b/toonz/sources/toonz/sceneviewerevents.cpp
index 833cea9be..cbee6af7f 100644
--- a/toonz/sources/toonz/sceneviewerevents.cpp
+++ b/toonz/sources/toonz/sceneviewerevents.cpp
@@ -957,13 +957,14 @@ using namespace ImageUtils;
void SceneViewer::contextMenuEvent(QContextMenuEvent *e)
{
-
-#ifdef MACOSX
- //cleaning-up mousePressedEvent on MacOSX instead of mouseReleaseEvent called
- m_mouseButton = Qt::NoButton;
- m_tabletEvent = false;
- m_pressure = 0;
- m_buttonClicked = false;
+#ifndef WIN32
+ /* On windows the widget receive the release event before the menu
+ is shown, on linux and osx the release event is lost, never
+ received by the widget */
+ QMouseEvent fakeRelease(QEvent::MouseButtonRelease, e->pos(),
+ Qt::RightButton, Qt::NoButton, Qt::NoModifier);
+
+ QApplication::instance()->sendEvent(this, &fakeRelease);
#endif
if (m_freezedStatus != NO_FREEZED)