[PATCH] Fixes v5: Cursor barriers

Peter Hutterer peter.hutterer at who-t.net
Mon Dec 6 17:26:18 PST 2010


On Mon, Nov 15, 2010 at 05:11:54PM -0500, Adam Jackson wrote:
> Signed-off-by: Adam Jackson <ajax at redhat.com>
> ---
>  COPYING        |    1 +
>  fixesproto.txt |   73 ++++++++++++++++++++++++++++++++++++++++++++++++++++---
>  xfixesproto.h  |   30 +++++++++++++++++++++++
>  xfixeswire.h   |   18 +++++++++++--
>  4 files changed, 115 insertions(+), 7 deletions(-)
> 
> diff --git a/COPYING b/COPYING
> index cdcb1ad..c8114fe 100644
> --- a/COPYING
> +++ b/COPYING
> @@ -1,4 +1,5 @@
>  Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
> +Copyright 2010 Red Hat, Inc.
>  
>  Permission is hereby granted, free of charge, to any person obtaining a
>  copy of this software and associated documentation files (the "Software"),
> diff --git a/fixesproto.txt b/fixesproto.txt
> index 5ef8153..6b1c2fc 100644
> --- a/fixesproto.txt
> +++ b/fixesproto.txt
> @@ -1,7 +1,7 @@
>                          The XFIXES Extension
> -			    Version 4.0
> -			 Document Revision 2
> -			     2006-12-14
> +			    Version 5.0
> +			 Document Revision 1
> +			     2010-11-15
>  			    Keith Packard
>  			  keithp at keithp.com
>  
> @@ -19,7 +19,7 @@ developers, in particular,
>  
>   +	Owen Taylor for describing the issues raised with the XEMBED
>   	mechanisms and SaveSet processing and his initial extension
> -	to handle this issue.
> +	to handle this issue, and for cursor barriers
>  
>   +	Bill Haneman for the design for cursor image tracking.
>  
> @@ -566,6 +566,71 @@ ShowCursor
>  	Servers supporting the X Input Extension Version 2.0 or higher show
>  	all visible cursors in response to a ShowCursor request.
>  
> +************* XFIXES VERSION 5 OR BETTER ***********
> +
> +12. Cursor Barriers

same comment as Owen here, in the protocol spec the term Cursor refers to
the shape displayed at the location of the pointer. the same is true for the
fixes protocol, so "Pointer Barriers" is a better naming scheme.
 
> +
> +Compositing managers and desktop environments may have UI elements in
> +particular screen locations such that for a single-headed display they
> +correspond to easy targets according to Fitt's Law, for example, the top
> +left corner.  For a multiheaded environment these corners should still be
> +semi-impermeable.  Cursor barriers allow the application to define
> +additional constraint on cursor motion so that these regions behave as
> +expected even in the face of multiple displays.
> +
> +WarpPointer and similar requests do not obey these barriers.
> +
> +12.1 Types
> +
> +	BARRIER:	XID
> +
> +	BarrierDirections
> +
> +		BarrierPositiveX:	    1 << 0
> +		BarrierPositiveY:	    1 << 1
> +		BarrierNegativeX:	    1 << 2
> +		BarrierNegativeY:	    1 << 3
> +
> +12.2 Errors
> +
> +	Barrier
> +
> +12.3 Requests
> +
> +CreateCursorBarrier
> +
> +		barrier:		    BARRIER
> +		window:			    WINDOW
> +		x1, y2, x2, y2:		    CARD16
> +		directions:		    CARD32
> +
> +	Creates a cursor barrier along the line specified by the given
> +	coordinates on the screen specified by the given Window.  The
> +	barrier has no spatial extent; it is simply a line along the left
> +	or top edge of the specified pixels.
> +
> +	The coordinates must be axis aligned, either x1 == x2, or
> +	y1 == y2.  If not, BadValue is generated.
> +
> +	Motion is allowed through the barrier in the directions specified.
> +	Nonsensical values (forbidding Y axis travel through a vertical
> +	barrier, for example) and excess set bits are ignored.
> +
> +	Servers supporting the X Input Extension version 2.0 or higher
> +	respect these barriers for any cursor on relative motion events.
> +	Absolute positioning devices do not obey these barriers as there's
> +	no benefit to target acquisition to do so.

Is it worth making it a per-device barrier with the usual XIAllDevices,
XIAllMasterDevices. Though it could be interesting handling a blocked master
device on a non-blocked SD...

> +
> +	Errors: IDChoice, Window, Value
> +
> +DestroyCursorBarrier
> +
> +		barrier:		    BARRIER
> +
> +	Destroys the named barrier.
> +
> +	Errors: Barrier 

Do we need a new error here? BadValue would be sufficient, especially given
that the request has no other value.

> +
>  99. Future compatibility
>  
>  This extension is not expected to remain fixed.  Future changes will
> diff --git a/xfixesproto.h b/xfixesproto.h
> index ed872d1..c2db307 100644
> --- a/xfixesproto.h
> +++ b/xfixesproto.h
> @@ -1,5 +1,6 @@
>  /*
>   * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
> + * Copyright 2010 Red Hat, Inc.
>   *
>   * Permission is hereby granted, free of charge, to any person obtaining a
>   * copy of this software and associated documentation files (the "Software"),
> @@ -500,6 +501,35 @@ typedef struct {
>  
>  #define sz_xXFixesShowCursorReq	sizeof(xXFixesShowCursorReq)
>  
> +/*************** Version 5.0 ******************/
> +
> +#define Barrier CARD32
> +
> +typedef struct {
> +    CARD8   reqType;
> +    CARD8   xfixesReqType;
> +    CARD16  length B16;
> +    Barrier barrier B32;
> +    Window  window B32;
> +    CARD16  x1 B16;
> +    CARD16  y1 B16;
> +    CARD16  x2 B16;
> +    CARD16  y2 B16;
> +    CARD32  directions;
> +} xXFixesCreateCursorBarrierReq;

note that core protocol requests like CreateWindow use INT16, not CARD16 for
the coordinates. 

Cheers,
  Peter


> +
> +#define sz_xXFixesHideCursorReq 24
> +
> +typedef struct {
> +    CARD8   reqType;
> +    CARD8   xfixesReqType;
> +    CARD16  length B16;
> +    Barrier barrier B32;
> +} xXFixesDestroyCursorBarrierReq;
> +
> +#define sz_xXFixesDestroyCursorBarrierReq 8
> +
> +#undef Barrier
>  #undef Region
>  #undef Picture
>  #undef Window
> diff --git a/xfixeswire.h b/xfixeswire.h
> index 7b43f09..06222e1 100644
> --- a/xfixeswire.h
> +++ b/xfixeswire.h
> @@ -1,5 +1,6 @@
>  /*
>   * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
> + * Copyright 2010 Red Hat, Inc.
>   *
>   * Permission is hereby granted, free of charge, to any person obtaining a
>   * copy of this software and associated documentation files (the "Software"),
> @@ -47,7 +48,7 @@
>  #define _XFIXESWIRE_H_
>  
>  #define XFIXES_NAME	"XFIXES"
> -#define XFIXES_MAJOR	4
> +#define XFIXES_MAJOR	5
>  #define XFIXES_MINOR	0
>  
>  /*************** Version 1 ******************/
> @@ -85,8 +86,11 @@
>  /*************** Version 4 ******************/
>  #define X_XFixesHideCursor		    29
>  #define X_XFixesShowCursor		    30
> +/*************** Version 5 ******************/
> +#define X_XFixesCreateCursorBarrier	    31
> +#define X_XFixesDestroyCursorBarrier	    32
>  
> -#define XFixesNumberRequests		    (X_XFixesShowCursor+1)
> +#define XFixesNumberRequests		    (X_XFixesDestroyCursorBarrier+1)
>  
>  /* Selection events share one event number */
>  #define XFixesSelectionNotify		    0
> @@ -111,7 +115,8 @@
>  
>  /* errors */
>  #define BadRegion			    0
> -#define XFixesNumberErrors		    (BadRegion+1)
> +#define BadBarrier			    1
> +#define XFixesNumberErrors		    (BadBarrier+1)
>  
>  #define SaveSetNearest			    0
>  #define SaveSetRoot			    1
> @@ -124,4 +129,11 @@
>  #define WindowRegionBounding		    0
>  #define WindowRegionClip		    1
>  
> +/*************** Version 5 ******************/
> +
> +#define BarrierPositiveX		    (1L << 0)
> +#define BarrierPositiveY		    (1L << 1)
> +#define BarrierNegativeX		    (1L << 2)
> +#define BarrierNegativeY		    (1L << 3)
> +
>  #endif	/* _XFIXESWIRE_H_ */
> -- 
> 1.7.2.3



More information about the xorg-devel mailing list