From 9b993b266528bee8a4b39c7e93b791ceb417ebff Mon Sep 17 00:00:00 2001 From: Triplelexx Date: Wed, 29 Jun 2016 03:58:17 +0100 Subject: [PATCH] store pointer to event->window()->screen() save the planet! --- .../src/input-plugins/TouchscreenDevice.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/libraries/input-plugins/src/input-plugins/TouchscreenDevice.cpp b/libraries/input-plugins/src/input-plugins/TouchscreenDevice.cpp index 12e990757d..64f02b5df3 100644 --- a/libraries/input-plugins/src/input-plugins/TouchscreenDevice.cpp +++ b/libraries/input-plugins/src/input-plugins/TouchscreenDevice.cpp @@ -76,10 +76,11 @@ void TouchscreenDevice::touchBeginEvent(const QTouchEvent* event) { const QTouchEvent::TouchPoint& point = event->touchPoints().at(0); _firstTouchVec = glm::vec2(point.pos().x(), point.pos().y()); KeyboardMouseDevice::enableTouch(false); - if (_screenDPI != event->window()->screen()->physicalDotsPerInch()) { - _screenDPIScale.x = (float)event->window()->screen()->physicalDotsPerInchX(); - _screenDPIScale.y = (float)event->window()->screen()->physicalDotsPerInchY(); - _screenDPI = event->window()->screen()->physicalDotsPerInch(); + QScreen* eventScreen = event->window()->screen(); + if (_screenDPI != eventScreen->physicalDotsPerInch()) { + _screenDPIScale.x = (float)eventScreen->physicalDotsPerInchX(); + _screenDPIScale.y = (float)eventScreen->physicalDotsPerInchY(); + _screenDPI = eventScreen->physicalDotsPerInch(); } }