[PATCH 2/3] Support XINPUT ABI version 23 (threaded input)

Peter Hutterer peter.hutterer at who-t.net
Wed Jun 1 00:28:50 UTC 2016


On Tue, May 31, 2016 at 09:29:49AM -0700, Keith Packard wrote:
> Use input_lock/input_unlock calls instead of SIGIO functions
> 
> Signed-off-by: Keith Packard <keithp at keithp.com>
> ---
>  src/emuMB.c    | 23 ++++++++++++++---------
>  src/emuThird.c |  5 ++---
>  src/evdev.h    |  8 ++++++--
>  3 files changed, 22 insertions(+), 14 deletions(-)
> 
> diff --git a/src/emuMB.c b/src/emuMB.c
> index b25eac8..e6aced5 100644
> --- a/src/emuMB.c
> +++ b/src/emuMB.c
> @@ -184,10 +184,13 @@ int
>  EvdevMBEmuTimer(InputInfoPtr pInfo)
>  {
>      EvdevPtr pEvdev = pInfo->private;
> -    int	sigstate;
>      int id;
>  
> -    sigstate = xf86BlockSIGIO ();
> +#if HAVE_THREADED_INPUT
> +    input_lock();
> +#else
> +    int sigstate = xf86BlockSIGIO();
> +#endif
>  
>      pEvdev->emulateMB.pending = FALSE;
>      if ((id = stateTab[pEvdev->emulateMB.state][4][0]) != 0) {
> @@ -200,7 +203,11 @@ EvdevMBEmuTimer(InputInfoPtr pInfo)
>                      pEvdev->emulateMB.state);
>      }
>  
> -    xf86UnblockSIGIO (sigstate);
> +#if HAVE_THREADED_INPUT
> +    input_unlock();
> +#else
> +    xf86UnblockSIGIO(sigstate);
> +#endif
>      return 0;
>  }
>  
> @@ -261,9 +268,8 @@ EvdevMBEmuFilterEvent(InputInfoPtr pInfo, int button, BOOL press)
>  }
>  
>  
> -void EvdevMBEmuWakeupHandler(pointer data,
> -                             int i,
> -                             pointer LastSelectMask)
> +void EvdevMBEmuWakeupHandler(void *data,
> +                             int i)
>  {
>      InputInfoPtr pInfo = (InputInfoPtr)data;
>      EvdevPtr     pEvdev = (EvdevPtr)pInfo->private;
> @@ -277,9 +283,8 @@ void EvdevMBEmuWakeupHandler(pointer data,
>      }
>  }
>  
> -void EvdevMBEmuBlockHandler(pointer data,
> -                            struct timeval **waitTime,
> -                            pointer LastSelectMask)
> +void EvdevMBEmuBlockHandler(void* data,
> +                            void *waitTime)
>  {

this looks like a rebase gone wrong

>      InputInfoPtr    pInfo = (InputInfoPtr) data;
>      EvdevPtr        pEvdev= (EvdevPtr) pInfo->private;
> diff --git a/src/emuThird.c b/src/emuThird.c
> index 5f14d33..27e1ad7 100644
> --- a/src/emuThird.c
> +++ b/src/emuThird.c
> @@ -89,12 +89,11 @@ Evdev3BEmuTimer(OsTimerPtr timer, CARD32 time, pointer arg)
>      InputInfoPtr      pInfo    = (InputInfoPtr)arg;
>      EvdevPtr          pEvdev   = pInfo->private;
>      struct emulate3B *emu3B    = &pEvdev->emulate3B;
> -    int               sigstate = 0;
>  
> -    sigstate = xf86BlockSIGIO ();
> +    input_lock();

we still need the ifdef here, don't we?

Cheers,
   Peter

>      emu3B->state = EM3B_EMULATING;
>      Evdev3BEmuPostButtonEvent(pInfo, emu3B->button, BUTTON_PRESS);
> -    xf86UnblockSIGIO (sigstate);
> +    input_unlock();
>      return 0;
>  }
>  
> diff --git a/src/evdev.h b/src/evdev.h
> index 4d44d2b..8d3c4cd 100644
> --- a/src/evdev.h
> +++ b/src/evdev.h
> @@ -67,6 +67,10 @@
>  #define LogMessageVerbSigSafe xf86MsgVerb
>  #endif
>  
> +#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 23
> +#define HAVE_THREADED_INPUT	1
> +#endif
> +
>  #define EVDEV_MAXBUTTONS 32
>  #define EVDEV_MAXQUEUE 32
>  
> @@ -260,8 +264,8 @@ unsigned int EvdevUtilButtonEventToButtonNumber(EvdevPtr pEvdev, int code);
>  /* Middle Button emulation */
>  int  EvdevMBEmuTimer(InputInfoPtr);
>  BOOL EvdevMBEmuFilterEvent(InputInfoPtr, int, BOOL);
> -void EvdevMBEmuWakeupHandler(pointer, int, pointer);
> -void EvdevMBEmuBlockHandler(pointer, struct timeval**, pointer);
> +void EvdevMBEmuWakeupHandler(void *, int);
> +void EvdevMBEmuBlockHandler(void *, void *);
>  void EvdevMBEmuPreInit(InputInfoPtr);
>  void EvdevMBEmuOn(InputInfoPtr);
>  void EvdevMBEmuFinalize(InputInfoPtr);
> -- 
> 2.8.1


More information about the xorg-devel mailing list