[RFC PATCH v2] fixesproto v6: Pointer barrier improvements.

christopher.halse.rogers at canonical.com christopher.halse.rogers at canonical.com
Thu Jan 26 16:49:33 PST 2012


From: Christopher James Halse Rogers <raof at ubuntu.com>

Adds a velocity-gated pointer barrier, events to notify a client when barriers
are hit, and a mechanism for clients to temporarily allow movement through
a barrier.

Signed-off-by: Christopher James Halse Rogers <christopher.halse.rogers at canonical.com>
---

After further prototyping with DX it became clear that, apart from the
initial block, the logic really needed to be client-side.  Which, fortunately,
makes for a nicer protocol.  Yay!

 fixesproto.txt |   86 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 xfixesproto.h  |   44 ++++++++++++++++++++++++++++
 xfixeswire.h   |   24 +++++++++++++--
 3 files changed, 150 insertions(+), 4 deletions(-)

diff --git a/fixesproto.txt b/fixesproto.txt
index 5903ac9..5e680f0 100644
--- a/fixesproto.txt
+++ b/fixesproto.txt
@@ -650,6 +650,92 @@ DestroyPointerBarrier
 
 	Errors: Barrier 
 
+************* XFIXES VERSION 6 OR BETTER ***********
+
+13. Pointer Barriers Expansion
+
+This update extends pointer barriers to optionally allow the pointer through
+when a threshold is reached.  This can be useful for desktop environments that
+wish to use a large region of the screen, such as an entire edge, to provide a
+casual target while allowing determined movement to pass through.
+
+13.1 Types
+
+	BarrierThresholdKind:		{None, Velocity, HitCount}
+	BarrierEvent:			{Hit, ThresholdExceeded}
+
+13.2 Events
+
+BarrierNotify
+
+		subtype:		BarrierEvent
+		window:			WINDOW
+		barrier:		BARRIER
+		kind:			BarrierThresholdKind
+		threshold:		CARD32
+		timestamp:		Timestamp
+		value:			CARD32
+		x, y:			INT16
+
+13.3 Requests
+
+SelectBarrierInput
+
+		window:			WINDOW
+		event-mask:		SETofBarrierEvent
+
+
+	This request directs barrier events to the named window.  Subtype
+	indicates the trigger of the event, which is Hit when the barrier has
+	prevented pointer movement and ThresholdExceeded when the barrier has
+	been hit but has not prevented pointer movement due to the threshold
+	being exceeded.
+	
+	Barrier is the barrier on which the event was triggered, which has a
+	threshold type of "kind" and threshold value "threshold". The value of
+	the property which is compared against the threshold was "value".
+	
+	(x,y) contain the coordinates of the pointer after restriction by any
+	applicable barriers.
+
+	In the case of multiple overlapping barriers an event is sent for each.
+
+CreatePointerBarrierThreshold
+
+		barrier:		    BARRIER
+		drawable:		    DRAWABLE
+		x1, y2, x2, y2:		    INT16
+		directions:		    CARD32
+		type:			    BarrierThresholdKind
+		threshold:		    CARD32
+		devices:		    LISTofDEVICEID
+
+	Creates a pointer barrier along the line specified by the given
+	coordinates on the screen associated with the given drawable. This
+	has identical semantics to CreatePointerBarrier, except that the
+	barrier created will not block the pointer if the threshold is
+	exceeded.
+	
+	Type can be None, in which case behaviour is identical to
+	CreatePointerBarrier and threshold is ignored.
+
+	Type can be Velocity, in which case the pointer will pass through the
+	barrier if the instantaneous velocity perpendicular to the barrier
+	in px/sec is greater than threshold.
+	
+	Type can be HitCount, in which case the pointer will pass through the
+	barrier once the barrier has been hit threshold times.  The count is
+	not automatically reset, so once the threshold has been reached the
+	barrier will not block any further pointer movement.
+
+	If type is not one of these values, BadValue is generated.
+
+	In the case of overlapping barriers each one is tested against, even
+	after the first one blocks the pointer.
+
+	Errors: IDChoice, Window, Value, Device
+
+
 99. Future compatibility
 
 This extension is not expected to remain fixed.  Future changes will
diff --git a/xfixesproto.h b/xfixesproto.h
index fcf409a..d4d657c 100644
--- a/xfixesproto.h
+++ b/xfixesproto.h
@@ -532,6 +532,50 @@ typedef struct {
 
 #define sz_xXFixesDestroyPointerBarrierReq 8
 
+/*************** Version 6.0 ******************/
+
+typedef struct {
+  CARD8 type;
+  CARD8 subtype;
+  CARD16  sequenceNumber B16;
+  Window window; B32;
+  CARD32  directions;
+  Barrier barrier;
+  INT16 x B16;
+  INT16 y B16;
+  CARD32 velocity B32;
+  Time timestamp B32;
+} xXFixesBarrierNotifyEvent;
+
+typedef struct {
+    CARD8   reqType;
+    CARD8   xfixesReqType;
+    CARD16  length B16;
+    Barrier barrier B32;
+    Window  window B32;
+    INT16   x1 B16;
+    INT16   y1 B16;
+    INT16   x2 B16;
+    INT16   y2 B16;
+    CARD32  directions;
+    CARD32  velocity;
+    CARD16  pad B16;
+    CARD16  num_devices B16;
+    /* array of CARD16 devices */
+} xXFixesCreatePointerBarrierVelocityReq;
+
+#define sz_xXFixesCreatePointerBarrierVelocityReq 32
+
+typedef struct {
+    CARD8   reqType;
+    CARD8   xfixesReqType;
+    CARD16  length B16;
+    Window  window B32;
+    CARD32  eventMask B32;
+} xXFixesSelectBarrierInputReq;
+
+#define sz_xXFixesSelectBarrierInputReq	12    
+
 #undef Barrier
 #undef Region
 #undef Picture
diff --git a/xfixeswire.h b/xfixeswire.h
index 432349a..bc07131 100644
--- a/xfixeswire.h
+++ b/xfixeswire.h
@@ -48,7 +48,7 @@
 #define _XFIXESWIRE_H_
 
 #define XFIXES_NAME	"XFIXES"
-#define XFIXES_MAJOR	5
+#define XFIXES_MAJOR	6
 #define XFIXES_MINOR	0
 
 /*************** Version 1 ******************/
@@ -89,8 +89,11 @@
 /*************** Version 5 ******************/
 #define X_XFixesCreatePointerBarrier	    31
 #define X_XFixesDestroyPointerBarrier	    32
+/*************** Version 6 ******************/
+#define X_XFixesCreatePointerBarrierVelocity 33
+#define X_XFixesSelectBarrierInput          34
 
-#define XFixesNumberRequests		    (X_XFixesDestroyPointerBarrier+1)
+#define XFixesNumberRequests		    (X_XFixesSelectBarrierInput+1)
 
 /* Selection events share one event number */
 #define XFixesSelectionNotify		    0
@@ -111,8 +114,6 @@
 
 #define XFixesDisplayCursorNotifyMask	    (1L << 0)
 
-#define XFixesNumberEvents		    (2)
-
 /* errors */
 #define BadRegion			    0
 #define BadBarrier			    1
@@ -136,4 +137,19 @@
 #define BarrierNegativeX		    (1L << 2)
 #define BarrierNegativeY		    (1L << 3)
 
+/*************** Version 6 ******************/
+
+/* Only one Barrier event */
+#define XFixesBarrierNotify                 2
+
+#define XFixesBarrierHitNotify			0
+#define XFixesBarrierThresholdExceededNotify	1
+
+#define XFixesBarrierHitNotifyMask			(1L << 0)
+#define XFixesBarrierThresholdExceededNotifyMask	(1L << 1)
+
+#define XFixesNumberEvents		    (XFixesBarrierNotify+1)
+
+
+
 #endif	/* _XFIXESWIRE_H_ */
-- 
1.7.8.3



More information about the xorg-devel mailing list