Dnia 2010-01-16, sob o godzinie 13:45 -0800, Ping Cheng pisze:
> 2010/1/16 Przemysław Firszt <prz...@firszt.eu>:
> > Dnia 2010-01-14, czw o godzinie 17:43 -0800, Ping pisze:
[..]
> The following lines in the third patch have extra tab-indent:
> 
> +             /* other tilt-enabled devices need to apply round() after this 
> call */
> +             if (tilt_x || tilt_y)
> +                     rotation = ((180.0 * atan2(-tilt_x,tilt_y)) / M_PI) + 
> 180.0;
> +
> +             /* Intuos4 mouse has an (180-5) offset */
> +             ds->rotation = round((360.0 - rotation + 180.0 - 5.0) * 5.0);
> +             ds->rotation %= 1800;
> +
> +             if (ds->rotation >= 900)
> +                     ds->rotation = 1800 - ds->rotation;
> +     else
> +                     ds->rotation = -ds->rotation;
> 
> I will test the set once the above is fixed.
My fault - thanks for tha catch. That version should be OK
--
Przemo

>From 1f3d0371eaca8e06f9d7ff5ffd5636aa686672c0 Mon Sep 17 00:00:00 2001
From: Przemo Firszt <prz...@firszt.eu>
Date: Sun, 17 Jan 2010 11:54:40 +0000
Subject: [PATCH 3/3] Move wcmTilt2Rotation function to wcmFilter.c

wcmTilt2Rotation function is now in wcmFilter.c, so wcmTilt2Rotation.c has
been removed.
Signed-off-by: Przemo Firszt <prz...@firszt.eu>
---
 src/Makefile.am        |    4 +-
 src/wcmFilter.c        |   30 ++++++++++++++++++++++++++
 src/wcmTilt2Rotation.c |   54 ------------------------------------------------
 3 files changed, 32 insertions(+), 56 deletions(-)
 delete mode 100644 src/wcmTilt2Rotation.c

diff --git a/src/Makefile.am b/src/Makefile.am
index 461089f..67938d5 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -35,6 +35,6 @@ INCLUDES=-I$(top_srcdir)/include/
 @driver_n...@_drv_la_sources = xf86Wacom.c xf86Wacom.h \
 	wcmCommon.c wcmConfig.c wcmISDV4.c \
 	wcmFilter.c wcmFilter.h xf86WacomDefs.h \
-	wcmTilt2Rotation.c wcmUSB.c wcmXCommand.c \
-	wcmValidateDevice.c wcmTouchFilter.c
+	wcmUSB.c wcmXCommand.c wcmValidateDevice.c \
+	wcmTouchFilter.c
 
diff --git a/src/wcmFilter.c b/src/wcmFilter.c
index 5b63f37..06a1f8c 100644
--- a/src/wcmFilter.c
+++ b/src/wcmFilter.c
@@ -21,6 +21,8 @@
 #include <config.h>
 #endif
 
+#include <math.h>
+#include "xf86Wacom.h"
 #include "wcmFilter.h"
 
 /*****************************************************************************
@@ -34,6 +36,7 @@ static int filterOnLine(double x0, double y0, double x1, double y1,
 		double a, double b);
 static void filterLine(int* pCurve, int nMax, int x0, int y0, int x1, int y1);
 static void filterIntuosStylus(WacomCommonPtr common, WacomFilterStatePtr state, WacomDeviceStatePtr ds);
+void wcmTilt2R(WacomDeviceStatePtr ds);
 
 /*****************************************************************************
  * wcmSetPressureCurve -- apply user-defined curve to pressure values
@@ -284,4 +287,31 @@ int wcmFilterIntuos(WacomCommonPtr common, WacomChannelPtr pChannel,
 
 	return 0; /* lookin' good */
 }
+
+/*****************************************************************************
+ *  wcmTilt2R -
+ *   Converts tilt X and Y to rotation, for Intuos4 mouse for now. 
+ *   It can be used for other devices when necessary.
+ ****************************************************************************/
+
+void wcmTilt2R(WacomDeviceStatePtr ds)
+{
+	short tilt_x = ds->tiltx;
+	short tilt_y = ds->tilty;
+	double rotation = 0.0;
+
+	/* other tilt-enabled devices need to apply round() after this call */
+	if (tilt_x || tilt_y)
+		rotation = ((180.0 * atan2(-tilt_x,tilt_y)) / M_PI) + 180.0;
+
+	/* Intuos4 mouse has an (180-5) offset */
+	ds->rotation = round((360.0 - rotation + 180.0 - 5.0) * 5.0);
+		ds->rotation %= 1800;
+
+	if (ds->rotation >= 900) 
+		ds->rotation = 1800 - ds->rotation;
+	else
+		ds->rotation = -ds->rotation;
+}
+
 /* vim: set noexpandtab shiftwidth=8: */
diff --git a/src/wcmTilt2Rotation.c b/src/wcmTilt2Rotation.c
deleted file mode 100644
index 1b7d0da..0000000
--- a/src/wcmTilt2Rotation.c
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright 2009 by Ping Cheng, Wacom. <pi...@wacom.com> 
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software 
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <math.h>
-#include "xf86Wacom.h"
-
-void wcmTilt2R(WacomDeviceStatePtr ds);
-
-/*****************************************************************************
- *  wcmTilt2R -
- *   Converts tilt X and Y to rotation, for Intuos4 mouse for now. 
- *   It can be used for other devices when necessary.
- ****************************************************************************/
-
-void wcmTilt2R(WacomDeviceStatePtr ds)
-{
-	short tilt_x = ds->tiltx;
-	short tilt_y = ds->tilty;
-	double rotation = 0.0;
-
-	/* other tilt-enabled devices need to apply round() after this call */
-	if (tilt_x || tilt_y)
-		rotation = ((180.0 * atan2(-tilt_x,tilt_y)) / M_PI) + 180.0;
-
-	/* Intuos4 mouse has an (180-5) offset */
-	ds->rotation = round((360.0 - rotation + 180.0 - 5.0) * 5.0);
-		ds->rotation %= 1800;
-
-	if (ds->rotation >= 900) 
-		ds->rotation = 1800 - ds->rotation;
-	else
-		ds->rotation = -ds->rotation;
-}
-
-/* vim: set noexpandtab shiftwidth=8: */
-- 
1.6.6

------------------------------------------------------------------------------
Throughout its 18-year history, RSA Conference consistently attracts the
world's best and brightest in the field, creating opportunities for Conference
attendees to learn about information security's most important issues through
interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev
_______________________________________________
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to