The way to use system cursor and custom(client) cursor

Pekka Paalanen ppaalanen at gmail.com
Sun Jun 9 23:02:55 PDT 2013


On Sun, 9 Jun 2013 16:01:48 -0700
Elvis Lee(______) <kwangwoong.lee at lge.com> wrote:

> Hello.
> 
>  
> 
> I feel unnatural to implement custom cursor scenario. Here is a question.
> 
> How does a client request compositor to use system cursor?
> 
>  
> 
> The system cursor means a current default cursor for compositor.
> 
> Currently, client should know about the system cursor in order to use it as
> parameter of wl_pointer.set_cursor.
> 
> Otherwise, cursor surface should be destroyed to request compositor a
> rollback to system cursor from custom cursor.
> 
>  
> 
> I think it¡¯s enough to detach buffer from cursor surface for hiding the
> cursor.
> 
> And set_cursor(null surface) can be used to request to stop using custom
> cursor. (rollback)
> 
>  
> 
> Here are some states and protocols.
> 
>  
> 
> 1.     System cursor -> Custom cursor
> 
> A.     set_cursor(cursor_surface)
> 
> B.      cursor_surface.attach(buffer for custom image)
> 
> C.      cursor_surface.damage
> 
> D.     cursor_surface.commit
> 
>  
> 
> 2.     Custom cursor -> System cursor
> 
> A.     set_cursor(null surface)
> 
>  
> 
> 3.     Custom cursor -> Hide Cursor
> 
> A.     set_cursor(cursor_surface)   (can be omitted if it is already set)
> 
> B.      cursor_surface.attach(null buffer)
> 
> C.      cursor_surface.commit
> 
>  
> 
> 4.     System cursor -> Hide Cursor
> 
> A.     set_cursor(cursor_surface) 
> 
> B.      cursor_surface.attach(null buffer) (can be omitted if it is already
> detached)
> 
> C.      cursor_surface.commit
> 
>  
> 
> I think this can cover up a scenario when pointer enters into a surface of
> client.
> 
> If there is no specific cursor for client to want when pointer enters,
> it¡¯s enough to request set_cursor(null).
> 
>  
> 
> Is this approach possible? I want to listen your opinions.

Hi Elvis,

do I understand right, that you would like to add the concept of a
system cursor?

I guess it would be possible, but why?

It seems the system cursor you propose would be one arbitrary cursor
without any meaning. When and why would applications ever want to use
it?

The compositor usually cannot, and there is no need to, switch to a
system cursor on its own, so it would always be requested by a client.
I can understand applications wanting a specific cursor, or no cursor,
but what would be the purpose of a system cursor?

If you also consider cursor themes, the system cursor would be from one
theme. An application using a system cursor would need to use the same
theme for its other cursors to look consistent.

We already have libwayland-cursor to help you load a cursor theme, so
using a proper cursor should not be too hard.


Thanks,
pq


More information about the wayland-devel mailing list