Skip to content

Fix #1620 #1626

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Sources/Plasma/PubUtilLib/plInputCore/plInputDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ bool plMouseDevice::MsgReceive(plMessage* msg)
fXPos = pXMsg->fX;

SetCursorX(fXPos);
fWXPos = pXMsg->fWx * fScale;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change broke macOS. I'll dig into why. Just for background - why didn't this work on Windows?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WM_MOUSEMOVE and friends send coordinates that are already DPI aware, therefore there is no need to scale them. They are already scaled.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That explains it. The input system on macOS does not scale with DPI. Let me consider what to do (including possibly scaling the macOS input by hand) and I'll get back to you shortly.

fWXPos = pXMsg->fWx;
return true;
}

Expand Down Expand Up @@ -529,7 +529,7 @@ bool plMouseDevice::MsgReceive(plMessage* msg)
else
fYPos = pYMsg->fY;

fWYPos = pYMsg->fWy * fScale;
fWYPos = pYMsg->fWy;
SetCursorY(fYPos);

return true;
Expand Down
11 changes: 7 additions & 4 deletions Sources/Plasma/PubUtilLib/plInputCore/plInputManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ You can contact Cyan Worlds, Inc. by email [email protected]
// plInputManager.cpp
#include "HeadSpin.h"
#include "hsWindows.h"
#ifdef WIN32
# include <Windowsx.h>
#endif

#include "plInputManager.h"
#include "plPipeline.h"
Expand Down Expand Up @@ -294,10 +297,10 @@ void plInputManager::HandleWin32ControlEvent(UINT message, WPARAM Wparam, LPARAM
plIMouseYEventMsg* pYMsg = new plIMouseYEventMsg;
plIMouseBEventMsg* pBMsg = new plIMouseBEventMsg;

pXMsg->fWx = LOWORD(Lparam);
pXMsg->fX = (float)LOWORD(Lparam) / (float)rect.right;
pYMsg->fWy = HIWORD(Lparam);
pYMsg->fY = (float)HIWORD(Lparam) / (float)rect.bottom;
pXMsg->fWx = GET_X_LPARAM(Lparam);
pXMsg->fX = (float)GET_X_LPARAM(Lparam) / (float)rect.right;
pYMsg->fWy = GET_Y_LPARAM(Lparam);
pYMsg->fY = (float)GET_Y_LPARAM(Lparam) / (float)rect.bottom;

// Apply mouse scale
// pXMsg->fX *= fMouseScale;
Expand Down