[synaptics] Replace hardcoded max number of touches with a define.

Submitted by Peter Hutterer on April 10, 2012, 5:30 a.m.

Details

Message ID 20120410053041.GA30595@yabbi.bne.redhat.com
State Accepted
Commit 8e297cb586ab855dc7c018c6f3f2f42c08db0419
Headers show

Not browsing as part of any series.

Commit Message

Peter Hutterer April 10, 2012, 5:30 a.m.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
---
no visible effect, I just need this for another patch (not ready yet) that
will make use of this.

 src/synaptics.c    |    2 +-
 src/synapticsstr.h |    1 +
 2 files changed, 2 insertions(+), 1 deletions(-)

Patch hide | download patch | download mbox

diff --git a/src/synaptics.c b/src/synaptics.c
index 99b5085..918dc6f 100644
--- a/src/synaptics.c
+++ b/src/synaptics.c
@@ -1186,7 +1186,7 @@  DeviceInitTouch(DeviceIntPtr dev, Atom *axes_labels)
 
     if (priv->has_touch)
     {
-        priv->num_slots = priv->max_touches ? priv->max_touches : 10;
+        priv->num_slots = priv->max_touches ? priv->max_touches : SYNAPTICS_MAX_TOUCHES;
 
         priv->open_slots = malloc(priv->num_slots * sizeof(int));
         if (!priv->open_slots)
diff --git a/src/synapticsstr.h b/src/synapticsstr.h
index 55aab3d..14ae362 100644
--- a/src/synapticsstr.h
+++ b/src/synapticsstr.h
@@ -49,6 +49,7 @@ 
  *					structs, typedefs, #defines, enums
  *****************************************************************************/
 #define SYNAPTICS_MOVE_HISTORY	5
+#define SYNAPTICS_MAX_TOUCHES	10
 
 typedef struct _SynapticsMoveHist
 {

Comments

On 04/09/2012 10:30 PM, Peter Hutterer wrote:
> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
> ---
> no visible effect, I just need this for another patch (not ready yet) that
> will make use of this.
> 
>  src/synaptics.c    |    2 +-
>  src/synapticsstr.h |    1 +
>  2 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/src/synaptics.c b/src/synaptics.c
> index 99b5085..918dc6f 100644
> --- a/src/synaptics.c
> +++ b/src/synaptics.c
> @@ -1186,7 +1186,7 @@ DeviceInitTouch(DeviceIntPtr dev, Atom *axes_labels)
>  
>      if (priv->has_touch)
>      {
> -        priv->num_slots = priv->max_touches ? priv->max_touches : 10;
> +        priv->num_slots = priv->max_touches ? priv->max_touches : SYNAPTICS_MAX_TOUCHES;
>  
>          priv->open_slots = malloc(priv->num_slots * sizeof(int));
>          if (!priv->open_slots)
> diff --git a/src/synapticsstr.h b/src/synapticsstr.h
> index 55aab3d..14ae362 100644
> --- a/src/synapticsstr.h
> +++ b/src/synapticsstr.h
> @@ -49,6 +49,7 @@
>   *					structs, typedefs, #defines, enums
>   *****************************************************************************/
>  #define SYNAPTICS_MOVE_HISTORY	5
> +#define SYNAPTICS_MAX_TOUCHES	10
>  
>  typedef struct _SynapticsMoveHist
>  {

Looks good to me.

Reviewed-by: Chase Douglas <chase.douglas@canonical.com>