[RFC Weston 00/10] Sub-surfaces v2

Bill Spitzak spitzak at gmail.com
Thu Mar 7 13:26:52 PST 2013


On 03/07/2013 02:32 AM, Pekka Paalanen wrote:

>> At the very least, we're going to need flags on enter/leave events to note
>> when the pointer left towards a subsurface.
>
> Why exactly?
>
> The client will receive an enter for the sub-surface as the very next
> thing.
>
> If it is about the race of an app repainting between leave and enter,
> we have the same problem elsewhere, too, and should solve it globally,
> and I'd like krh's input on that. I can imagine we will hit the same
> problem in some shell use cases, too, e.g. keyboard focus entering a
> menu or tooltip surface.

I think this is another example that can be fixed by getting rid of the 
goal of making the server send exactly matching enter/leave events.

If the old and new surface belong to the same client, the server sends 
only the "enter" event to the new surface. The client can figure out 
exactly what happened and at no time is it unsure whether the cursor is 
pointing at one of it's surfaces.

Full proposal:

All pointer motion produces one of three events, somewhat misleadingly 
labelled MOVE, ENTER, LEAVE. All of them have the pointer x/y position 
in the coordinate space of the target surface. MOVE has an accurate 
timestamp as it always matches an actual device event. The others may 
have inaccurate information as they are spontaneously generated by other 
actions by clients.

When a pointer moves, a MOVE event is sent to exactly one surface. 
Normally this is the top-most one with a non-transparent pixel under the 
cursor, but there are grabs and other state that can send it to a 
different surface.

The compositor also knows of all kinds of other reasons a pointer may 
suddenly be "in" a surface even without movement. This includes 
reordering and creation/destruction of surfaces, creation of pointers, 
and changes in grab. In this case it sends an ENTER event to the same 
surface that would have gotten the MOVE event if the movement ended at 
the current pointer position. Compositors can spuriously send ENTER at 
any time so that they do not have to track huge amounts of state, and 
clients must be prepared to handle any number of ENTER events.

The compositor keeps track of the surface it last sent an ENTER or MOVE 
to, and when sending an ENTER or MOVE to a different surface, and they 
belong to different clients, it sends a LEAVE event to the previous 
surface. A LEAVE may also be sent if a pointer is destroyed.



More information about the wayland-devel mailing list