pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/editors/xournalpp xournalpp: Add smooth curves and dev...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/2d5112ad26ac
branches:  trunk
changeset: 416958:2d5112ad26ac
user:      nia <nia%pkgsrc.org@localhost>
date:      Sat Nov 02 14:44:15 2019 +0000

description:
xournalpp: Add smooth curves and device manager patches, from wip/xournalpp-git

diffstat:

 editors/xournalpp/Makefile                                          |   4 +-
 editors/xournalpp/distinfo                                          |   4 +-
 editors/xournalpp/patches/patch-src_control_tools_StrokeHandler.cpp |  46 ++++++++++
 editors/xournalpp/patches/patch-src_util_DeviceListHelper.cpp       |  17 +++
 4 files changed, 68 insertions(+), 3 deletions(-)

diffs (98 lines):

diff -r e6aadab708ba -r 2d5112ad26ac editors/xournalpp/Makefile
--- a/editors/xournalpp/Makefile        Sat Nov 02 14:43:37 2019 +0000
+++ b/editors/xournalpp/Makefile        Sat Nov 02 14:44:15 2019 +0000
@@ -1,7 +1,7 @@
-# $NetBSD: Makefile,v 1.3 2019/10/20 11:10:48 nia Exp $
+# $NetBSD: Makefile,v 1.4 2019/11/02 14:44:15 nia Exp $
 
 DISTNAME=      xournalpp-1.0.15
-PKGREVISION=   1
+PKGREVISION=   2
 CATEGORIES=    editors
 MASTER_SITES=  ${MASTER_SITE_GITHUB:=xournalpp/}
 GITHUB_PROJECT=        xournalpp
diff -r e6aadab708ba -r 2d5112ad26ac editors/xournalpp/distinfo
--- a/editors/xournalpp/distinfo        Sat Nov 02 14:43:37 2019 +0000
+++ b/editors/xournalpp/distinfo        Sat Nov 02 14:44:15 2019 +0000
@@ -1,7 +1,9 @@
-$NetBSD: distinfo,v 1.1 2019/10/16 13:34:08 nia Exp $
+$NetBSD: distinfo,v 1.2 2019/11/02 14:44:15 nia Exp $
 
 SHA1 (xournalpp-1.0.15.tar.gz) = 6934c8de1260ca580988c421c55c2a44999a235c
 RMD160 (xournalpp-1.0.15.tar.gz) = 8f53fd4b74507e28e28a4fffa9fe4d8c5f434c45
 SHA512 (xournalpp-1.0.15.tar.gz) = 7a015c1d48e26eed313f994aa293f6d2ab711ac6970568edef4ba10dcf1551c87279daa2b361731ac58ef236e1dd59e0eebf41e4739fba9db954a718450d5b79
 Size (xournalpp-1.0.15.tar.gz) = 14938798 bytes
 SHA1 (patch-CMakeLists.txt) = 52b9a70a3242b618f8092b94a21c276c522e749d
+SHA1 (patch-src_control_tools_StrokeHandler.cpp) = 80df57a9776a9919a95a04bf6c057dc021fc789e
+SHA1 (patch-src_util_DeviceListHelper.cpp) = 8f3534c80c79ec49dd9562c3ed4e3ff7c36b2ecb
diff -r e6aadab708ba -r 2d5112ad26ac editors/xournalpp/patches/patch-src_control_tools_StrokeHandler.cpp
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/editors/xournalpp/patches/patch-src_control_tools_StrokeHandler.cpp       Sat Nov 02 14:44:15 2019 +0000
@@ -0,0 +1,46 @@
+$NetBSD: patch-src_control_tools_StrokeHandler.cpp,v 1.1 2019/11/02 14:44:15 nia Exp $
+
+On NetBSD, absolute coordinate changes are reported as an X value followed by a Y value,
+which (when moving quickly) leads to a "stepping" effect. Using a Bezier curve fitting
+for the points yields a smooth curve in most cases, and does not seem to adversely affect
+the user experience (even with a conventional mouse).
+
+--- ./src/control/tools/StrokeHandler.cpp.orig 2019-09-10 05:47:36.000000000 +0000
++++ ./src/control/tools/StrokeHandler.cpp
+@@ -115,9 +115,36 @@ bool StrokeHandler::onMotionNotifyEvent(
+       }
+       else
+       {
++#if defined(__NetBSD__) || defined(__OpenBSD__)
++              if (pointCount > 1)
++#else
+               if (pointCount > 0)
++#endif
+               {
+                       Point prevPoint(stroke->getPoint(pointCount - 1));
++#if defined(__NetBSD__) || defined(__OpenBSD__)
++                      double length, prevLength, t, x, y;
++                      Point pprevPoint(stroke->getPoint(pointCount - 2));
++
++                      // treat this point as an end point
++                      // treat the previous point as a control point and recalculate the "actual" point
++                      prevLength = prevPoint.lineLengthTo(pprevPoint);
++                      length = prevLength + currentPoint.lineLengthTo(prevPoint);
++                      if (length != 0)
++                      {
++                              t = prevLength/length;
++                              // Bezier curve fitting
++                              x = (1-t)*(1-t)*pprevPoint.x + 2*t*(1-t)*prevPoint.x + t*t*currentPoint.x;
++                              y = (1-t)*(1-t)*pprevPoint.y + 2*t*(1-t)*prevPoint.y + t*t*currentPoint.y;
++                              
++                              prevPoint = Point(x,y,prevPoint.z);
++                              stroke->deletePointsFrom(pointCount-1);
++                              stroke->addPoint(prevPoint);
++                              stroke->addPoint(currentPoint);
++                              currentPoint = prevPoint;
++                              prevPoint = pprevPoint;
++                      }
++#endif
+ 
+                       Stroke lastSegment;
+ 
diff -r e6aadab708ba -r 2d5112ad26ac editors/xournalpp/patches/patch-src_util_DeviceListHelper.cpp
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/editors/xournalpp/patches/patch-src_util_DeviceListHelper.cpp     Sat Nov 02 14:44:15 2019 +0000
@@ -0,0 +1,17 @@
+$NetBSD: patch-src_util_DeviceListHelper.cpp,v 1.1 2019/11/02 14:44:15 nia Exp $
+
+This check seems to skip devices that are reasonable to include (on NetBSD), so rather
+list all devices and let the user manage them.
+
+--- src/util/DeviceListHelper.cpp.orig 2019-08-13 08:34:36.000000000 +0000
++++ src/util/DeviceListHelper.cpp
+@@ -31,7 +31,8 @@ void addDevicesToList(std::vector<InputD
+                       devList = devList->next;
+                       continue;
+               }
+-              if (gdk_device_get_vendor_id(dev) == nullptr && gdk_device_get_product_id(dev) == nullptr)
++              // if (gdk_device_get_vendor_id(dev) == nullptr && gdk_device_get_product_id(dev) == nullptr)
++              if (gdk_device_get_device_type(dev) == GDK_DEVICE_TYPE_MASTER)
+               {
+                       // Skip core pointer
+                       devList = devList->next;



Home | Main Index | Thread Index | Old Index