[PATCH 2/4] X server: dricursor implementation using the X server as application.

Peter Hutterer peter.hutterer at who-t.net
Mon Jan 5 15:32:26 PST 2009


On Mon, Jan 05, 2009 at 06:59:18PM -0200, Tiago Vignatti wrote:
> This implementation gives two ioctls APIs (DRICursorSetDev, DRICursorHotspot)
> to interface with the DRM modesetting cursors. For now this patch disables
> the pointer acceleration scheme.
> 
> Signed-off-by: Tiago Vignatti <vignatti at c3sl.ufpr.br>
> ---
>  Makefile.am                    |    1 +
>  configure.ac                   |    4 ++-
>  dix/getevents.c                |    2 +
>  dricursor/Makefile.am          |    9 +++++++
>  dricursor/dricursor.c          |   51 ++++++++++++++++++++++++++++++++++++++++
>  hw/xfree86/common/xf86Xinput.c |    8 ++++++
>  hw/xfree86/ramdac/xf86Cursor.c |    3 ++
>  include/Makefile.am            |    1 +
>  include/dricursor.h            |    3 ++
>  9 files changed, 81 insertions(+), 1 deletions(-)
>  create mode 100644 dricursor/Makefile.am
>  create mode 100644 dricursor/dricursor.c
>  create mode 100644 include/dricursor.h
> 

[...]

> diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c
> index 8eaa118..c4f3f30 100644
> --- a/hw/xfree86/common/xf86Xinput.c
> +++ b/hw/xfree86/common/xf86Xinput.c
> @@ -89,6 +89,7 @@
>  #endif
>  
>  #include "os.h"
> +#include "dricursor.h"
>  
>  EventListPtr xf86Events = NULL;
>  
> @@ -471,6 +472,7 @@ NewInputDeviceRequest (InputOption *options, DeviceIntPtr *pdev)
>      DeviceIntPtr dev = NULL;
>      int rval = Success;
>      int is_auto = 0;
> +    char *path;
>  
>      idev = xcalloc(sizeof(*idev), 1);
>      if (!idev)
> @@ -514,6 +516,9 @@ NewInputDeviceRequest (InputOption *options, DeviceIntPtr *pdev)
>              }
>          }
>  
> +        if (strcasecmp(option->key, "path") == 0)
> +            path = xstrdup(option->value);
> +
>          /* Right now, the only automatic config we know of is HAL. */
>          if (strcmp(option->key, "_source") == 0 &&
>              strcmp(option->value, "server/hal") == 0) {
> @@ -582,6 +587,9 @@ NewInputDeviceRequest (InputOption *options, DeviceIntPtr *pdev)
>          (!is_auto || xf86Info.autoEnableDevices))
>          EnableDevice(dev);
>  
> +    if (IsPointerDevice(dev))
> +        DRICursorSetDev(path);
> +
>      /* send enter/leave event, update sprite window */
>      CheckMotion(NULL, dev);
>  

This hunk is wrong, you need to check for attachment of the device, not just
for IsPointerDevice. A device that isn't attached doesn't have a visible
cursor. This would also mean that you'd need to put a hook into AttachDevice
to reset when the attachment changes.

(the two hunks before seem a bit out of place too)

Cheers,
  Peter



More information about the xorg mailing list