On Wed, 2012-04-18 at 15:00 +1000, Peter Hutterer wrote:
> WFALLBACK_NONE and WFALLBACK_GENERIC are more expressive than 0/1.
> 
> Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net>

Signed-off-by: Bastien Nocera <had...@hadess.net>

> ---
>  libwacom/libwacom.c |    6 +++---
>  libwacom/libwacom.h |    9 +++++++--
>  2 files changed, 10 insertions(+), 5 deletions(-)
> 
> diff --git a/libwacom/libwacom.c b/libwacom/libwacom.c
> index e54175d..29ce625 100644
> --- a/libwacom/libwacom.c
> +++ b/libwacom/libwacom.c
> @@ -241,7 +241,7 @@ libwacom_new (WacomDeviceDatabase *db, int vendor_id, int 
> product_id, WacomBusTy
>  }
>  
>  WacomDevice*
> -libwacom_new_from_path(WacomDeviceDatabase *db, const char *path, int 
> fallback, WacomError *error)
> +libwacom_new_from_path(WacomDeviceDatabase *db, const char *path, 
> WacomFallbackFlags fallback, WacomError *error)
>  {
>       int vendor_id, product_id;
>       WacomBusType bus;
> @@ -266,10 +266,10 @@ libwacom_new_from_path(WacomDeviceDatabase *db, const 
> char *path, int fallback,
>       device = libwacom_new (db, vendor_id, product_id, bus, error);
>       if (device != NULL)
>               ret = libwacom_copy(device);
> -     else if (!fallback)
> +     else if (fallback == WFALLBACK_NONE)
>               goto bail;
>  
> -     if (device == NULL && fallback) {
> +     if (device == NULL && fallback == WFALLBACK_GENERIC) {
>               device = libwacom_get_device(db, "generic");
>               if (device == NULL)
>                       goto bail;
> diff --git a/libwacom/libwacom.h b/libwacom/libwacom.h
> index 6ba96eb..d44eb89 100644
> --- a/libwacom/libwacom.h
> +++ b/libwacom/libwacom.h
> @@ -54,7 +54,7 @@
>  
>        db = libwacom_database_new();
>        error = libwacom_error_new();
> -      device = libwacom_new_from_path(db, "/dev/input/event0", 0, error);
> +      device = libwacom_new_from_path(db, "/dev/input/event0", 
> WFALLBACK_NONE, error);
>        if (!device)
>             return; // should check for error here
>  
> @@ -161,6 +161,11 @@ typedef enum {
>       WACOM_BUTTON_TOUCHSTRIPS_MODESWITCH = 
> (WACOM_BUTTON_TOUCHSTRIP_MODESWITCH | WACOM_BUTTON_TOUCHSTRIP2_MODESWITCH),
>  } WacomButtonFlags;
>  
> +typedef enum {
> +     WFALLBACK_NONE = 0,
> +     WFALLBACK_GENERIC = 1
> +} WacomFallbackFlags;
> +
>  /**
>   * Allocate a new structure for error reporting.
>   *
> @@ -225,7 +230,7 @@ void libwacom_database_destroy(WacomDeviceDatabase *db);
>   *
>   * @return A new reference to this device or NULL on errror.
>   */
> -WacomDevice* libwacom_new_from_path(WacomDeviceDatabase *db, const char 
> *path, int fallback, WacomError *error);
> +WacomDevice* libwacom_new_from_path(WacomDeviceDatabase *db, const char 
> *path, WacomFallbackFlags fallback, WacomError *error);
>  
>  /**
>   * Create a new device reference from the given vendor/product IDs.



------------------------------------------------------------------------------
Better than sec? Nothing is better than sec when it comes to
monitoring Big Data applications. Try Boundary one-second 
resolution app monitoring today. Free.
http://p.sf.net/sfu/Boundary-dev2dev
_______________________________________________
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to