[prev in list] [next in list] [prev in thread] [next in thread] 

List:       freedesktop-xorg
Subject:    Re: [compiz] status of input redirection
From:       David Reveman <davidr () novell ! com>
Date:       2007-06-05 18:41:59
Message-ID: 1181068919.6823.9.camel () ion ! ximian
[Download RAW message or body]

On Tue, 2007-06-05 at 00:17 +0300, Daniel Stone wrote: 
> On Mon, Jun 04, 2007 at 05:06:20PM -0400, David Reveman wrote:
> > On Sat, 2007-06-02 at 04:29 +0300, Daniel Stone wrote:
> > > On Fri, Jun 01, 2007 at 03:47:17PM -0400, David Reveman wrote:
> > > > +	switch (events[i].u.u.type) {
> > > > +	case MotionNotify:
> > > > +	case ButtonPress:
> > > > +	case ButtonRelease:
> > > > +	case KeyPress:
> > > > +	case KeyRelease:
> > > > +	case EnterNotify:
> > > > +	case LeaveNotify:
> > > 
> > > Hi,
> > > This needs to be aware of Xi events.
> > 
> > Yea, I forgot about that. Will the attached patch work or are those
> > device events not using the keyButtonPointer structure?
> 
> Unfortunately, they're not using keyButtonPointer, and you can't put it
> in a case, as the event numbers are non-constant.  They use
> deviceKeyButtonPointer, but you also need to check deviceValuator.  See
> dix/getevents.c, and mi/mieq.c.

I've adjusted the patch for deviceKeyButtonPointer. Like in my previous
patch, device events are checked for in the default so that they are not
constant should already be handled fine. Not sure exactly what to do
about deviceValuator events yet.

-David

["xserver-input-transform-xi-2.patch" (xserver-input-transform-xi-2.patch)]

--- a/dix/events.c
+++ b/dix/events.c
@@ -4686,8 +4686,9 @@ WriteEventsToClient(ClientPtr pClient, int count, xEvent *events)
 
     for (i = 0; i < count; i++)
     {
-	WindowPtr pWin;
-	int	  x, y, dx, dy;
+	deviceKeyButtonPointer *deviceEvent;
+	WindowPtr	       pWin;
+	int		       x, y, dx, dy;
 
 	switch (events[i].u.u.type) {
 	case MotionNotify:
@@ -4720,6 +4721,34 @@ WriteEventsToClient(ClientPtr pClient, int count, xEvent *events)
 		events[i].u.keyButtonPointer.eventY += dy;
 	    }
 	    break;
+	default:
+	    if (events[i].u.u.type == DeviceMotionNotify  ||
+		events[i].u.u.type == DeviceButtonPress	  ||
+		events[i].u.u.type == DeviceButtonRelease ||
+		events[i].u.u.type == DeviceKeyPress	  ||
+		events[i].u.u.type == DeviceKeyRelease)
+	    {
+		deviceEvent = (deviceKeyButtonPointer *) &events[i];
+
+		pWin = LookupIDByType (deviceEvent->event, RT_WINDOW);
+		if (pWin)
+		{
+		    x = deviceEvent->root_x;
+		    y = deviceEvent->root_y;
+
+		    CompositeXYScreenToWindowRootCoordinate (pWin, x, y,
+							     &x, &y);
+
+		    dx = x - deviceEvent->root_x;
+		    dy = y - deviceEvent->root_y;
+
+		    deviceEvent->root_x  += dx;
+		    deviceEvent->root_y  += dy;
+		    deviceEvent->event_x += dx;
+		    deviceEvent->event_y += dy;
+		}
+	    }
+	    break;
 	}
     }
 #endif


_______________________________________________
xorg mailing list
xorg@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/xorg

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic