Hi,
Patches to move generic area check functions for wcmConfig.c to
wcmCommon.c in the attachment.

I'm looking forward to see fixed commit messages ;-)
--
Przemo
>From f19847502e8a0767693bc54597f779370cfba643 Mon Sep 17 00:00:00 2001
From: Przemo Firszt <[email protected]>
Date: Wed, 9 Dec 2009 19:56:47 +0000
Subject: [PATCH 1/3] Move xf86WcmPointInArea, xf86WcmAreasOverlap & xf86WcmAreaListOverlap

Those 3 functions shouldn't be in wcmConfig.c as they have nothing to do with
configuring the device. wcmCommon.c is much better place for generic
functions.
---
 src/wcmCommon.c |   38 ++++++++++++++++++++++++++++++++++++++
 src/wcmConfig.c |   37 -------------------------------------
 2 files changed, 38 insertions(+), 37 deletions(-)

diff --git a/src/wcmCommon.c b/src/wcmCommon.c
index ea3c937..2694b7c 100644
--- a/src/wcmCommon.c
+++ b/src/wcmCommon.c
@@ -1936,4 +1936,42 @@ void xf86WcmRotateTablet(LocalDevicePtr local, int value)
 		}
 	}
 }
+
+/* xf86WcmPointInArea - check whether the point is within the area */
+
+Bool xf86WcmPointInArea(WacomToolAreaPtr area, int x, int y)
+{
+	if (area->topX <= x && x <= area->bottomX &&
+	    area->topY <= y && y <= area->bottomY)
+		return 1;
+	return 0;
+}
+
+/* xf86WcmAreasOverlap - check if two areas are overlapping */
+
+static Bool xf86WcmAreasOverlap(WacomToolAreaPtr area1, WacomToolAreaPtr area2)
+{
+	if (xf86WcmPointInArea(area1, area2->topX, area2->topY) ||
+	    xf86WcmPointInArea(area1, area2->topX, area2->bottomY) ||
+	    xf86WcmPointInArea(area1, area2->bottomX, area2->topY) ||
+	    xf86WcmPointInArea(area1, area2->bottomX, area2->bottomY))
+		return 1;
+	if (xf86WcmPointInArea(area2, area1->topX, area1->topY) ||
+	    xf86WcmPointInArea(area2, area1->topX, area1->bottomY) ||
+	    xf86WcmPointInArea(area2, area1->bottomX, area1->topY) ||
+	    xf86WcmPointInArea(area2, area1->bottomX, area1->bottomY))
+	        return 1;
+	return 0;
+}
+
+/* xf86WcmAreaListOverlaps - check if the area overlaps any area in the list */
+Bool xf86WcmAreaListOverlap(WacomToolAreaPtr area, WacomToolAreaPtr list)
+{
+	for (; list; list=list->next)	
+		if (area != list && xf86WcmAreasOverlap(list, area))
+			return 1;
+	return 0;
+}
+
+
 /* vim: set noexpandtab shiftwidth=8: */
diff --git a/src/wcmConfig.c b/src/wcmConfig.c
index 352b2d4..cb08625 100644
--- a/src/wcmConfig.c
+++ b/src/wcmConfig.c
@@ -263,43 +263,6 @@ static int xf86WcmAllocateByType(LocalDevicePtr local, const char *type)
 	return rc;
 }
 
-
-/* xf86WcmPointInArea - check whether the point is within the area */
-
-Bool xf86WcmPointInArea(WacomToolAreaPtr area, int x, int y)
-{
-	if (area->topX <= x && x <= area->bottomX &&
-	    area->topY <= y && y <= area->bottomY)
-		return 1;
-	return 0;
-}
-
-/* xf86WcmAreasOverlap - check if two areas are overlapping */
-
-static Bool xf86WcmAreasOverlap(WacomToolAreaPtr area1, WacomToolAreaPtr area2)
-{
-	if (xf86WcmPointInArea(area1, area2->topX, area2->topY) ||
-	    xf86WcmPointInArea(area1, area2->topX, area2->bottomY) ||
-	    xf86WcmPointInArea(area1, area2->bottomX, area2->topY) ||
-	    xf86WcmPointInArea(area1, area2->bottomX, area2->bottomY))
-		return 1;
-	if (xf86WcmPointInArea(area2, area1->topX, area1->topY) ||
-	    xf86WcmPointInArea(area2, area1->topX, area1->bottomY) ||
-	    xf86WcmPointInArea(area2, area1->bottomX, area1->topY) ||
-	    xf86WcmPointInArea(area2, area1->bottomX, area1->bottomY))
-	        return 1;
-	return 0;
-}
-
-/* xf86WcmAreaListOverlaps - check if the area overlaps any area in the list */
-Bool xf86WcmAreaListOverlap(WacomToolAreaPtr area, WacomToolAreaPtr list)
-{
-	for (; list; list=list->next)	
-		if (area != list && xf86WcmAreasOverlap(list, area))
-			return 1;
-	return 0;
-}
-
 /* 
  * Be sure to set vmin appropriately for your device's protocol. You want to
  * read a full packet before returning
-- 
1.6.5.2

>From e645508a49868442da6c2baf68b76ab4f51e5a4c Mon Sep 17 00:00:00 2001
From: Przemo Firszt <[email protected]>
Date: Wed, 9 Dec 2009 20:17:17 +0000
Subject: [PATCH 2/3] Rename xf86Wcm* generic area check functions to Wcm*

(xf86)WcmPointInArea, (xf86)WcmAreasOverlap & (xf86)WcmAreaListOverlaps are not part of X interface, so xf86 prefix is not needed.
---
 src/wcmCommon.c   |   30 +++++++++++++++---------------
 src/wcmXCommand.c |    2 +-
 src/xf86Wacom.c   |    2 +-
 src/xf86Wacom.h   |    4 ++--
 4 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/src/wcmCommon.c b/src/wcmCommon.c
index 2694b7c..df725aa 100644
--- a/src/wcmCommon.c
+++ b/src/wcmCommon.c
@@ -1937,9 +1937,9 @@ void xf86WcmRotateTablet(LocalDevicePtr local, int value)
 	}
 }
 
-/* xf86WcmPointInArea - check whether the point is within the area */
+/* WcmPointInArea - check whether the point is within the area */
 
-Bool xf86WcmPointInArea(WacomToolAreaPtr area, int x, int y)
+Bool WcmPointInArea(WacomToolAreaPtr area, int x, int y)
 {
 	if (area->topX <= x && x <= area->bottomX &&
 	    area->topY <= y && y <= area->bottomY)
@@ -1947,28 +1947,28 @@ Bool xf86WcmPointInArea(WacomToolAreaPtr area, int x, int y)
 	return 0;
 }
 
-/* xf86WcmAreasOverlap - check if two areas are overlapping */
+/* WcmAreasOverlap - check if two areas are overlapping */
 
-static Bool xf86WcmAreasOverlap(WacomToolAreaPtr area1, WacomToolAreaPtr area2)
+static Bool WcmAreasOverlap(WacomToolAreaPtr area1, WacomToolAreaPtr area2)
 {
-	if (xf86WcmPointInArea(area1, area2->topX, area2->topY) ||
-	    xf86WcmPointInArea(area1, area2->topX, area2->bottomY) ||
-	    xf86WcmPointInArea(area1, area2->bottomX, area2->topY) ||
-	    xf86WcmPointInArea(area1, area2->bottomX, area2->bottomY))
+	if (WcmPointInArea(area1, area2->topX, area2->topY) ||
+	    WcmPointInArea(area1, area2->topX, area2->bottomY) ||
+	    WcmPointInArea(area1, area2->bottomX, area2->topY) ||
+	    WcmPointInArea(area1, area2->bottomX, area2->bottomY))
 		return 1;
-	if (xf86WcmPointInArea(area2, area1->topX, area1->topY) ||
-	    xf86WcmPointInArea(area2, area1->topX, area1->bottomY) ||
-	    xf86WcmPointInArea(area2, area1->bottomX, area1->topY) ||
-	    xf86WcmPointInArea(area2, area1->bottomX, area1->bottomY))
+	if (WcmPointInArea(area2, area1->topX, area1->topY) ||
+	    WcmPointInArea(area2, area1->topX, area1->bottomY) ||
+	    WcmPointInArea(area2, area1->bottomX, area1->topY) ||
+	    WcmPointInArea(area2, area1->bottomX, area1->bottomY))
 	        return 1;
 	return 0;
 }
 
-/* xf86WcmAreaListOverlaps - check if the area overlaps any area in the list */
-Bool xf86WcmAreaListOverlap(WacomToolAreaPtr area, WacomToolAreaPtr list)
+/* WcmAreaListOverlaps - check if the area overlaps any area in the list */
+Bool WcmAreaListOverlap(WacomToolAreaPtr area, WacomToolAreaPtr list)
 {
 	for (; list; list=list->next)	
-		if (area != list && xf86WcmAreasOverlap(list, area))
+		if (area != list && WcmAreasOverlap(list, area))
 			return 1;
 	return 0;
 }
diff --git a/src/wcmXCommand.c b/src/wcmXCommand.c
index 0cacb8b..90cf1c7 100644
--- a/src/wcmXCommand.c
+++ b/src/wcmXCommand.c
@@ -317,7 +317,7 @@ int xf86WcmSetProperty(DeviceIntPtr dev, Atom property, XIPropertyValuePtr prop,
         area.bottomX = values[2];
         area.bottomY = values[3];
 
-        if (xf86WcmAreaListOverlap(&area, priv->tool->arealist))
+        if (WcmAreaListOverlap(&area, priv->tool->arealist))
             return BadValue;
 
         if (!checkonly)
diff --git a/src/xf86Wacom.c b/src/xf86Wacom.c
index e5a7354..05851db 100644
--- a/src/xf86Wacom.c
+++ b/src/xf86Wacom.c
@@ -227,7 +227,7 @@ static int xf86WcmInitArea(LocalDevicePtr local)
 	inlist = priv->tool->arealist;
 
 	/* The first one in the list is always valid */
-	if (area != inlist && xf86WcmAreaListOverlap(area, inlist))
+	if (area != inlist && WcmAreaListOverlap(area, inlist))
 	{
 		inlist = priv->tool->arealist;
 
diff --git a/src/xf86Wacom.h b/src/xf86Wacom.h
index 283e0c3..70ce093 100644
--- a/src/xf86Wacom.h
+++ b/src/xf86Wacom.h
@@ -161,8 +161,8 @@ void xf86WcmEvent(WacomCommonPtr common, unsigned int channel, const WacomDevice
 void xf86WcmSendEvents(LocalDevicePtr local, const WacomDeviceState* ds);
 
 /* generic area check for wcmConfig.c, xf86Wacom.c, and wcmCommon.c */
-Bool xf86WcmPointInArea(WacomToolAreaPtr area, int x, int y);
-Bool xf86WcmAreaListOverlap(WacomToolAreaPtr area, WacomToolAreaPtr list);
+Bool WcmPointInArea(WacomToolAreaPtr area, int x, int y);
+Bool WcmAreaListOverlap(WacomToolAreaPtr area, WacomToolAreaPtr list);
 
 /* Change pad's mode according to it core event status */
 int xf86WcmSetPadCoreMode(LocalDevicePtr local);
-- 
1.6.5.2

>From dcdce0a4fe304d8d94ec9d55d3097ae45dd622a3 Mon Sep 17 00:00:00 2001
From: Przemo Firszt <[email protected]>
Date: Wed, 9 Dec 2009 20:26:04 +0000
Subject: [PATCH 3/3] Fix comment describing where are used area check functions.

The comment was irrelevant after WcmPointInArea, WcmAreasOverlap and
AreaListOverlap have been moved to wcmCommon.c in
f19847502e8a0767693bc54597f779370cfba643
---
 src/xf86Wacom.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/xf86Wacom.h b/src/xf86Wacom.h
index 70ce093..ee6fcba 100644
--- a/src/xf86Wacom.h
+++ b/src/xf86Wacom.h
@@ -160,7 +160,7 @@ void xf86WcmEvent(WacomCommonPtr common, unsigned int channel, const WacomDevice
 /* dispatches data to XInput event system */
 void xf86WcmSendEvents(LocalDevicePtr local, const WacomDeviceState* ds);
 
-/* generic area check for wcmConfig.c, xf86Wacom.c, and wcmCommon.c */
+/* generic area check for xf86Wacom.c, wcmCommon.c and wcmXCommand.c */
 Bool WcmPointInArea(WacomToolAreaPtr area, int x, int y);
 Bool WcmAreaListOverlap(WacomToolAreaPtr area, WacomToolAreaPtr list);
 
-- 
1.6.5.2

------------------------------------------------------------------------------
Return on Information:
Google Enterprise Search pays you back
Get the facts.
http://p.sf.net/sfu/google-dev2dev
_______________________________________________
Linuxwacom-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to