Page MenuHome

Trackpad: Fix wrong scroll deltas on the retina
ClosedPublic

Authored by Yevgeny Makarov (jenkm) on Dec 2 2020, 10:07 PM.

Details

Summary

Fix for wrong trackpad scroll deltas on the retina.

Currently the deltas are half as large as they should be. Cursor coordinates
are multiplied by NativePixelSize, deltas must have the same conversion.


There may be something I don't quite understand, but do we really need these calculations?

void GHOST_WindowCocoa::setNativePixelSize(void)
{
  NSView *view = (m_openGLView) ? m_openGLView : m_metalView;
  NSRect backingBounds = [view convertRectToBacking:[view bounds]];

  GHOST_Rect rect;
  getClientBounds(rect);

  m_nativePixelSize = (float)backingBounds.size.width / (float)rect.getWidth();
}

Can't it just be this way?

void GHOST_WindowCocoa::setNativePixelSize(void)
{
  m_nativePixelSize = [m_window backingScaleFactor];
}

Diff Detail

Repository
rB Blender

Event Timeline

Yevgeny Makarov (jenkm) requested review of this revision.Dec 2 2020, 10:07 PM
Yevgeny Makarov (jenkm) created this revision.

Maybe the setNativePixelSize implementation can be simplified, but it's not obvious to me that it is the same, so I'd rather not risk breaking anything to simplify code that has worked well and is not in the way.

This revision is now accepted and ready to land.Dec 7 2020, 2:54 PM