[Dev] any API to hide the display of mouse cursor for app Window ?

Carsten Haitzler c.haitzler at samsung.com
Tue Dec 20 05:30:01 GMT 2016


On Tue, 20 Dec 2016 05:09:28 +0000
라빈드라 <r.sande at samsung.com> wrote:

> Hi,
> 
>  
> 
> Thanks for response.
> 
>  
> 
> My app is a virtual machine solution; and the system running on this
> VM has its own cursor for virtual mouse. Therefore, I should not show
> the additional cursor coming from the tizen to the user.
> 
>  
> 
> Thanks for pointing about using elm_win_add() and related APIs. I
> have used  ecore_* APIs since I looked up into tizen support code for
> SDL2 library to find how to work with windows on Tizen, and it was
> using ecore_* APIs.
> 
>  
> 
> I will replace in future ecore_wl_window_new() with elm_win_add()
> calls; however at this time, I guess it will involve lot of work
> since a good amount of EGL and keyboard/mouse input event handler
> code are working with ecore_... APIs. Before starting replacement, I

use callbacks on an object - e.g. look at rage. all kbd shortcuts are
just done as key events on the button object that gets the focus. etc.

> want to know (documentation/sample code to illustrate) how EGL APIs
> (e.g. eglCreateWindowSurface, not Evas GL apis) can work with window
> created using elm_win_*() apis.

you cannot. you MUST use evas_gl api's. the same applies for ecore_evas
windows too. the window content is drawn/managed via evas's canvas in
both scenarios. the fact that it may have worked at all would be by
luck, not by design. you would have gotten lucky that things happened to
render.

evas_gl exists to bind egl OR glx to evas and make things work. the
rules are there in order to ensure that gl rendered content AND canvas
managed content (objects) can work together. e.g. use an evas object as
the pointer and the canvas will draw this on top for you without you
having to draw your own cursor. you can overlay other widgets (buttons,
menus, toolbars and so on) alongside gl content and it works. you can
have as many elm glviews as you like and scroll them around in a
scroller along with list items and buttons and it works. that''s the
point of it all. to have everything work together.

> If there is a way to hide mouse by doing something e.g. in mouse
> event handler passed to ecore_event_handler_add(), please let me
> know. I want to use it temporarily.

see the code i pointed to for rage. :)

> Thanks,
> 
> Ravindra Sande
> 
>  
> 
> --------- Original Message ---------
> 
> Sender : Sung-Jin Park <sj76.park at samsung.com> S5/Senior
> Engineer/Tizen Platform Lab./Samsung Electronics
> 
> Date : 2016-12-20 10:43 (GMT+9)
> 
> Title : RE: Re: [Dev] any API to hide the display of mouse cursor for
> app Window ?
> 
>  
> 
> >realistically though - your app shouldnt have to really do this in
> >general. the compositor itself likely should do this automatically.
> >e.g. if you use a mouse device, show the cursor, then when you go
> >idle for a while, hide it. not the policy you want on a pc, but the
> >kind you'd want on a touch screen device or a tv with a remote that
> >may sometimes have mice attached or used.
> 
>  
> 
> +1
> 
>  
> 
> As a maintainer of Tizen window system input, I strongly agree with
> Carsten Haitzler.
> 
> You can change the cursor image for your application when it's on
> your app window,
> 
> but you shouldn't try to hide it as the cursor is not the asset of an
> application but the system global resource.
> 
>  
> 
> I think it must be controlled by the compositor. The compositor
> controls the cursor visibility under the policy.
> 
> If you try to hide it and suppose it's hidden. I think there will be
> confusion for a user
> 
> as he doesn't understand why the cursor is not visible while the
> mouse is moving around.
> 
>  
> 
> Thanks.
> 
> Sung-Jin Park
> 
>  
> 
> --------- Original Message ---------
> 
> Sender : Carsten Haitzler (The Rasterman) <tizen at rasterman.com>
> 
> Date : 2016-12-20 09:58 (GMT+9)
> 
> Title : Re: [Dev] any API to hide the display of mouse cursor for app
> Window ?
> 
>  On Mon, 19 Dec 2016 17:37:12 +0900 Ravindra Sande
> <r.sande at samsung.com> said:
> 
> > Hi,
> > 
> > I am creating window for my native Tizen application using the
> > ecore_wl_window_new() API.
> > I need to hide the display of mouse cursor within the window.
> 
> first... use elm_win_*add(). ecore_evas is basically a low-level
> internal and lots of things are not taken care of for you that the
> elementary window will do instead. using elm's win means also your
> window is portable and will work in wayland, x11, directly on the
> framebuffer (fbcon or drm/kms) etc. "automatically". (environment
> variables will determine the default display system to use, not code
> in your app). you will want all of this also for dnd, copy & paste,
> client side decorations if needed and much more.
> 
> secondly... please look at sample code. i wrote a whole video player
> and mini "media center" app:
> 
> https://git.enlightenment.org/apps/rage.git/
> 
> grab it. compile on your pc (with efl etc. there) and mess around
> with it. it'll index ~/Videos/ if given no cmdline arguments
> otherwise pass in what you want to play on the cmdline much like
> mplayer.
> 
> the point: it blanks the cursor. in win.c
> 
> https://git.enlightenment.org/apps/rage.git/tree/src/bin/win.c#n557
> 
> it creates a button, sets the color to 0 0 0 0 (invisible) and keeps
> it hidden. when it wants to hide the mouse it shows event2 and since
> it is on top this button controls the mousse cursor and the blank
> cursor is used...
> 
> realistically though - your app shouldnt have to really do this in
> general. the compositor itself likely should do this automatically.
> e.g. if you use a mouse device, show the cursor, then when you go
> idle for a while, hide it. not the policy you want on a pc, but the
> kind you'd want on a touch screen device or a tv with a remote that
> may sometimes have mice attached or used.
> 
> > Is there any API to do this ?
> > 
> > Regards,
> > Ravindra Sande
> > 
> > _______________________________________________
> > Dev mailing list
> > Dev at lists.tizen.org
> > https://lists.tizen.org/listinfo/dev
> > 
> 
> 



More information about the Dev mailing list