From: Marko Luukkainen Date: Fri, 9 Aug 2019 14:27:58 +0000 (+0300) Subject: HiDPI fixes X-Git-Tag: v1.43.0~230 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=63f2f953315938928e5a232a619fa9bb5d694580;hp=88a7de6c4dd0a7c601bfffe701e68589ff169ba2;p=simantics%2F3d.git HiDPI fixes gitlab #22 Change-Id: Ib6589309b5b1d9ce3d9f1f369803b262df04ae76 --- diff --git a/vtk.rendering/src/vtk/rendering/swt/vtkSwtInteractorForwarderDecorator.java b/vtk.rendering/src/vtk/rendering/swt/vtkSwtInteractorForwarderDecorator.java index 24ccabe1..56259564 100644 --- a/vtk.rendering/src/vtk/rendering/swt/vtkSwtInteractorForwarderDecorator.java +++ b/vtk.rendering/src/vtk/rendering/swt/vtkSwtInteractorForwarderDecorator.java @@ -13,6 +13,7 @@ import org.eclipse.swt.events.MouseListener; import org.eclipse.swt.events.MouseMoveListener; import org.eclipse.swt.events.MouseTrackListener; import org.eclipse.swt.events.MouseWheelListener; +import org.eclipse.swt.internal.DPIUtil; /** * Decorator class used to implement all Mouse/Key SWT listener and convert them @@ -55,7 +56,7 @@ implements MouseListener, MouseMoveListener, MouseTrackListener, MouseWheelListe if ((e.button == 1) || (e.stateMask & SWT.BUTTON1) != 0) button = java.awt.event.MouseEvent.BUTTON1; else if ((e.button == 2) || (e.stateMask & SWT.BUTTON2) != 0) button = java.awt.event.MouseEvent.BUTTON2; else if ((e.button == 3) || (e.stateMask & SWT.BUTTON3) != 0) button = java.awt.event.MouseEvent.BUTTON3; - return new java.awt.event.MouseEvent(dummyComponent, 0, (long)e.time, convertModifiers(e.button,e.stateMask), e.x, e.y, e.count, false, button); + return new java.awt.event.MouseEvent(dummyComponent, 0, (long)e.time, convertModifiers(e.button,e.stateMask), DPIUtil.autoScaleUp(e.x), DPIUtil.autoScaleUp(e.y), e.count, false, button); } public int convertKeyCode(int swtKeyCode) { @@ -66,7 +67,7 @@ implements MouseListener, MouseMoveListener, MouseTrackListener, MouseWheelListe } public java.awt.event.MouseWheelEvent convertMouseWheelEvent(org.eclipse.swt.events.MouseEvent e) { - return new java.awt.event.MouseWheelEvent(dummyComponent, 0, e.time, convertModifiers(e.button,e.stateMask), e.x, e.y, 0, false, java.awt.event.MouseWheelEvent.WHEEL_UNIT_SCROLL, 1, e.count); + return new java.awt.event.MouseWheelEvent(dummyComponent, 0, e.time, convertModifiers(e.button,e.stateMask), DPIUtil.autoScaleUp(e.x), DPIUtil.autoScaleUp(e.y), 0, false, java.awt.event.MouseWheelEvent.WHEEL_UNIT_SCROLL, 1, e.count); } public void keyPressed(KeyEvent e) { diff --git a/vtk.rendering/src/vtk/rendering/vtkAbstractComponent.java b/vtk.rendering/src/vtk/rendering/vtkAbstractComponent.java index 84f2fb41..c905a72f 100644 --- a/vtk.rendering/src/vtk/rendering/vtkAbstractComponent.java +++ b/vtk.rendering/src/vtk/rendering/vtkAbstractComponent.java @@ -2,6 +2,8 @@ package vtk.rendering; import java.util.concurrent.locks.ReentrantLock; +import org.eclipse.swt.internal.DPIUtil; + import vtk.vtkAxesActor; import vtk.vtkCamera; import vtk.vtkGenericRenderWindowInteractor; @@ -130,7 +132,8 @@ public abstract class vtkAbstractComponent implements vtkComponent { if (renderWindow == null || windowInteractor == null) { return; // Nothing to do we are deleted... } - + w = DPIUtil.autoScaleUp(w); + h = DPIUtil.autoScaleUp(h); try { lock.lockInterruptibly(); renderWindow.SetSize(w, h);