From aa7604254ee07a9e95d339652eca0ee1aaf9c2f5 Mon Sep 17 00:00:00 2001 From: Pavel Rojtberg Date: Sun, 6 Mar 2022 02:22:54 +0100 Subject: [PATCH] Bites: also scale button events on OSX --- .../Bites/src/OgreApplicationContextBase.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/Components/Bites/src/OgreApplicationContextBase.cpp b/Components/Bites/src/OgreApplicationContextBase.cpp index 1913f7bda0c..88a2b60cb4b 100644 --- a/Components/Bites/src/OgreApplicationContextBase.cpp +++ b/Components/Bites/src/OgreApplicationContextBase.cpp @@ -345,13 +345,21 @@ void ApplicationContextBase::_destroyWindow(const NativeWindowPair& win) void ApplicationContextBase::_fireInputEvent(const Event& event, uint32_t windowID) const { Event scaled = event; - if (OGRE_PLATFORM == OGRE_PLATFORM_APPLE && event.type == MOUSEMOTION) +#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE + if (event.type == MOUSEMOTION) { // assumes all windows have the same scale float viewScale = getRenderWindow()->getViewPointToPixelScale(); scaled.motion.x *= viewScale; scaled.motion.y *= viewScale; } + else if(event.type == MOUSEBUTTONDOWN || event.type == MOUSEBUTTONUP) + { + float viewScale = getRenderWindow()->getViewPointToPixelScale(); + scaled.button.x *= viewScale; + scaled.button.y *= viewScale; + } +#endif for(InputListenerList::iterator it = mInputListeners.begin(); it != mInputListeners.end(); ++it) @@ -370,10 +378,10 @@ void ApplicationContextBase::_fireInputEvent(const Event& event, uint32_t window l.keyReleased(event.key); break; case MOUSEBUTTONDOWN: - l.mousePressed(event.button); + l.mousePressed(scaled.button); break; case MOUSEBUTTONUP: - l.mouseReleased(event.button); + l.mouseReleased(scaled.button); break; case MOUSEWHEEL: l.mouseWheelRolled(event.wheel);