[PATCH wayland 1/2] protocol: replace pointer.attach with pointer.set_cursor

Bill Spitzak spitzak at gmail.com
Mon Jun 18 11:12:11 PDT 2012


Pekka Paalanen wrote:

> I wonder if we could phrase this paragraph even more clearly...
> 
> "The parameters hotspot_x,hotspot_y define the cursor hotspot in the
> cursor surface, given in cursor surface-local coordinates. In other
> words, if x,y is the cursor position on a (window) surface, then the
> top-left corner pixel of the cursor is at the window surface
> coordinates (x - hotspot_x, y - hotspot_y)."
> 
> We are talking about the corner pixel, and not corner, right? There is
> a half-pixel difference between the two definitions.
> 
> I've understood that integer pixel coordinates fall in the middle of a
> pixel, and the border is at +-0.5 pixels from that.

As long as both the pointer and hotspot are defined the same way, both 
either being to the center of a pixel or both to a corner of a pixel, 
the resulting cursor positions are equal. Certainly wayland should not 
provide any interpretation of coordinates that produces a different 
answer than this obvious one. For normal use then the hotspot must be 
integers and they cause the cursor image to move an integer number of 
pixels up/left of where it would be if the hotspot is 0,0.

I would prefer defining the pointer and offset as being integers and 
these are already established as being the corners of pixels.

It may be desirable to define an arbitrary transform from the pointer 
position to the cursor image, allowing rotate and scale. If so, applying 
the same transform to a cursor image as to surface underneath it should 
result in the two images being stuck together with no offset, thus 
requiring such transforms to be defined in the same space as surface 
transforms and thus in a space with integer-sized pixels and 0,0 being 
the top-left corner of the top-left pixel.


More information about the wayland-devel mailing list