This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

#5186 Remove accumulate fraction DPI calculation

  • Loading branch information...
Jerry (Xinyu Hou)
Jerry (Xinyu Hou) committed Oct 28, 2016
1 parent cf397a0 commit c2372bc9a80c4515db70a272512c0bb4f49f1d2f
Showing with 3 additions and 28 deletions.
  1. +3 −21 src/lib/platform/MSWindowsScreen.cpp
  2. +0 −7 src/lib/platform/MSWindowsScreen.h
@@ -104,7 +104,6 @@ MSWindowsScreen::MSWindowsScreen(
m_xCenter(0), m_yCenter(0),
m_multimon(false),
m_xCursor(0), m_yCursor(0),
- m_xFractionalMove(0.0f), m_yFractionalMove(0.0f),
m_sequenceNumber(0),
m_mark(0),
m_markReceived(0),
@@ -570,21 +569,6 @@ void MSWindowsScreen::saveMousePosition(SInt32 x, SInt32 y) {
LOG((CLOG_DEBUG5 "saved mouse position for next delta: %+d,%+d", x,y));
}
-void MSWindowsScreen::accumulateFractionalMove(float x, float y, SInt32& intX, SInt32& intY)
-{
- // Accumulate together the move into the running total
- m_xFractionalMove += x;
- m_yFractionalMove += y;
-
- // Return the integer part
- intX = (SInt32)m_xFractionalMove;
- intY = (SInt32)m_yFractionalMove;
-
- // And keep only the fractional part
- m_xFractionalMove -= intX;
- m_yFractionalMove -= intY;
-}
-
UInt32
MSWindowsScreen::registerHotKey(KeyID key, KeyModifierMask mask)
{
@@ -1365,8 +1349,8 @@ MSWindowsScreen::onMouseMove(SInt32 mx, SInt32 my)
{
// compute motion delta (relative to the last known
// mouse position)
- float x = (float)mx - m_xCursor;
- float y = (float)my - m_yCursor;
+ SInt32 x = mx - m_xCursor;
+ SInt32 y = my - m_yCursor;
LOG((CLOG_DEBUG3
"mouse move - motion delta: %+d=(%+d - %+d),%+d=(%+d - %+d)",
@@ -1416,9 +1400,7 @@ MSWindowsScreen::onMouseMove(SInt32 mx, SInt32 my)
}
else {
// send motion
- SInt32 ix, iy;
- accumulateFractionalMove(x, y, ix, iy);
- sendEvent(m_events->forIPrimaryScreen().motionOnSecondary(), MotionInfo::alloc(ix, iy));
+ sendEvent(m_events->forIPrimaryScreen().motionOnSecondary(), MotionInfo::alloc(x, y));
}
}
@@ -216,10 +216,6 @@ class MSWindowsScreen : public PlatformScreen {
// save last position of mouse to compute next delta movement
void saveMousePosition(SInt32 x, SInt32 y);
- // accumulates together a series of fractional pixel moves, each time
- // taking away and returning just the integer part of the running total.
- void accumulateFractionalMove(float x, float y, SInt32& intX, SInt32& intY);
-
// check if it is a modifier key repeating message
bool isModifierRepeat(KeyModifierMask oldState,
KeyModifierMask state, WPARAM wParam) const;
@@ -270,9 +266,6 @@ class MSWindowsScreen : public PlatformScreen {
// last mouse position
SInt32 m_xCursor, m_yCursor;
- // accumulated fractional pixel moves
- float m_xFractionalMove, m_yFractionalMove;
-
// last clipboard
UInt32 m_sequenceNumber;

0 comments on commit c2372bc

Please sign in to comment.