Skip to content
Open
Changes from all 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: 3 additions & 1 deletion Core/GameEngine/Source/GameClient/Input/Mouse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -824,7 +824,9 @@ void Mouse::createStreamMessages()
{
msg = TheMessageStream->appendMessage( GameMessage::MSG_RAW_MOUSE_WHEEL );
msg->appendPixelArgument( m_currMouse.pos );
msg->appendIntegerArgument( m_currMouse.wheelPos / 120 ); // wheel delta
// TheSuperHackers @bugfix Preserve wheel delta sign for touchpad scroll direction detection
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The comment is a bit incomplete. It would be better if it clarified that it now guarantees a non-zero value.

const Int wheelTicks = m_currMouse.wheelPos / MOUSE_WHEEL_DELTA;
msg->appendIntegerArgument( m_currMouse.wheelPos > 0 ? max( 1, wheelTicks ) : min( -1, wheelTicks ) );
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Minor: could be written as.

Int wheelTicks = m_currMouse.wheelPos / MOUSE_WHEEL_DELTA;
wheelTicks = m_currMouse.wheelPos > 0 ? max( 1, wheelTicks ) : min( -1, wheelTicks );
msg->appendIntegerArgument( wheelTicks );

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

It is not clear to me that this fix proposal is the best approach. Perhaps it would be better to make this message argument a float type instead of integer? It looks like it would be possible. Follow all code at MSG_RAW_MOUSE_WHEEL.

msg->appendIntegerArgument( TheKeyboard->getModifierFlags() );
}

Expand Down