From kde-commits Sat Sep 15 09:11:02 2018 From: Boudewijn Rempt Date: Sat, 15 Sep 2018 09:11:02 +0000 To: kde-commits Subject: [krita/krita/4.1] libs/ui/input/wintab: Add a workaround for tablets not reporting tablet events in Message-Id: X-MARC-Message: https://marc.info/?l=kde-commits&m=153700267305562 Git commit ea7a7367a7b65c9134781d6a98260bdfc53c73d1 by Boudewijn Rempt, on = behalf of Dmitry Kazakov. Committed on 15/09/2018 at 09:08. Pushed by rempt into branch 'krita/4.1'. Add a workaround for tablets not reporting tablet events in hover mode The bug is caused by the fact that we postpone tablet events by one event (presumably to make it sync with mouse events stream). But some non-wacom tablets do not report tablet move events when the stylus is hovering. It means that the following tablet press event will be positioned incorrectly. This event postponing has come from Qt, and the commit message says it was needed for "relative" mode, which we don't support. I just disabled this postponing, let's check whether it helps people. BUG:363284 M +7 -4 libs/ui/input/wintab/kis_tablet_support_win.cpp M +0 -1 libs/ui/input/wintab/kis_tablet_support_win_p.h https://commits.kde.org/krita/ea7a7367a7b65c9134781d6a98260bdfc53c73d1 diff --git a/libs/ui/input/wintab/kis_tablet_support_win.cpp b/libs/ui/inpu= t/wintab/kis_tablet_support_win.cpp index 53748fa30dc..f981caee422 100644 --- a/libs/ui/input/wintab/kis_tablet_support_win.cpp +++ b/libs/ui/input/wintab/kis_tablet_support_win.cpp @@ -801,10 +801,13 @@ bool QWindowsTabletSupport::translateTabletPacketEven= t() = const int z =3D currentDevice =3D=3D QTabletEvent::FourDMouse ? in= t(packet.pkZ) : 0; = - // This code is to delay the tablet data one cycle to sync with th= e mouse location. - QPointF globalPosF =3D m_oldGlobalPosF / dpr; // Convert from "nat= ive" to "device independent pixels." - m_oldGlobalPosF =3D tabletData.scaleCoordinates(packet.pkX, packet= .pkY, - tabletData.virtualDe= sktopArea); + // NOTE: we shouldn't postpone the tablet events like Qt does, bec= ause we + // don't support mouse mode (which was the reason for introd= ucing this + // postponing). See bug 363284. + QPointF globalPosF =3D + tabletData.scaleCoordinates(packet.pkX, packet.pkY, + tabletData.virtualDesktopArea); + globalPosF /=3D dpr; // Convert from "native" to "device independe= nt pixels." = QPoint globalPos =3D globalPosF.toPoint(); = diff --git a/libs/ui/input/wintab/kis_tablet_support_win_p.h b/libs/ui/inpu= t/wintab/kis_tablet_support_win_p.h index 769720a13eb..fb55f353989 100644 --- a/libs/ui/input/wintab/kis_tablet_support_win_p.h +++ b/libs/ui/input/wintab/kis_tablet_support_win_p.h @@ -124,7 +124,6 @@ private: bool m_tiltSupport; QVector m_devices; int m_currentDevice; - QPointF m_oldGlobalPosF; = = QWidget *targetWidget{0};