Page MenuHomePhabricator

add config for enabling cursor_timer which hides the mouse cursor after some interval
AbandonedPublic

Authored by Hermet on Dec 22 2015, 12:18 AM.

Details

Summary

Sometimes we need to hide the cursor image on windows, when user are not actively interacting using pointing devices.
This change makes the mouse cursor hidden using a timer and reappear when the user moves the mouse.
This feature would be useful in TV/mobile profile and is being provided by other OS platforms e.g. android.

Test Plan
  1. Set the use_cursor_timer to 1 (disabled by default)
  2. After some idle time of no mouse action, the cursor will be hidden (invisible).

Diff Detail

Repository
rE core/enlightenment
Branch
work
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 1162
Build 1227: arc lint + arc unit
ohduna updated this revision to Diff 7931.Dec 22 2015, 12:18 AM
ohduna retitled this revision from to add config for enabling cursor_timer which hides the mouse cursor after some interval.
ohduna updated this object.
ohduna edited the test plan for this revision. (Show Details)
ohduna added subscribers: Jeon, input.hacker, cedric.
zmike requested changes to this revision.Dec 23 2015, 11:02 AM
zmike edited edge metadata.

A few issues with this:

  1. The timer interval config limits seem arbitrary; is 9.9s really the maximum that a user might want to set?
  2. More likely you want to trigger the wakeups from the comp canvas mouse/keyboard handlers; the code that you have here will not ensure cursor visibility if the pointer moves over something that is not directly part of a window.
  3. I'm a bit unclear as to why you need to store the cursor E_Client to the global e_comp_wl struct; it seems to me like you should just hide the cursor and let it remain hidden. If another object gets set as the cursor then the state of the previously-hidden cursor becomes irrelevant, and if it remains as the cursor then it can easily be retrieved using normal API functions.
    • The same goes for the hidden flag that you've added.

Additionally, it would be great if you could write a bit more about the operational intent (first line) of this commit so that it will be easier for others to understand the code.

src/bin/e_comp_wl.c
253

You'll need to also call ecore_timer_reset() here to reset the timer in addition to changing the interval.

324

This line is functionally identical to the line above it.

328

The visible flag of clients should not be altered except by protocol-level changes.

357

You'll need to also call ecore_timer_reset() here to reset the timer in addition to changing the interval.

362

This failure case seems impossible.

364

This line is functionally identical to the line above it.

370

Is never unsetting this flag intentional?

src/bin/e_config.c
1540

Why are these limits not ints?

This revision now requires changes to proceed.Dec 23 2015, 11:02 AM
JHyun added a subscriber: JHyun.Dec 29 2015, 6:55 PM
ohduna updated this revision to Diff 8244.Jan 27 2016, 1:15 AM
ohduna edited edge metadata.

I revised according to zmike comments. Please review again. :)
Thanks,

ohduna updated this revision to Diff 8245.Jan 27 2016, 1:59 AM
ohduna edited edge metadata.

Removed po files

ohduna updated this revision to Diff 8246.Jan 27 2016, 2:15 AM

Restore po files.. ;)

ohduna updated this revision to Diff 8247.Jan 27 2016, 2:45 AM
ohduna updated this object.
ohduna edited the test plan for this revision. (Show Details)

Forget about po files.. my mistakes..

ohduna updated this revision to Diff 8248.Jan 27 2016, 2:58 AM

modified code in _e_comp_wl_cursor_reload()

ohduna updated this revision to Diff 8251.Jan 27 2016, 5:26 PM

ignored po files.. Please review this patch, again. :)

ohduna marked 7 inline comments as done.Jan 27 2016, 5:30 PM

Hi, sorry to show up so late to this one.

Wouldn't it be better to handle this sort of thing client side? The client may be in a state where it really makes sense to leave a mouse cursor on screen (like, say, when a menu is visible).

With EFL apps the compositor doesn't know when a menu is popped up, so it would just hide the cursor anyway. And that's just the first example that came to mind, I'm guessing there could be other times when the client knows better than the compositor whether a cursor should be visible or not.

zmike added a comment.Feb 1 2016, 10:36 AM

Hi, sorry to show up so late to this one.

Wouldn't it be better to handle this sort of thing client side? The client may be in a state where it really makes sense to leave a mouse cursor on screen (like, say, when a menu is visible).

With EFL apps the compositor doesn't know when a menu is popped up, so it would just hide the cursor anyway. And that's just the first example that came to mind, I'm guessing there could be other times when the client knows better than the compositor whether a cursor should be visible or not.

Hm that's an interesting thought. Under X11, applications such as mplayer handle this sort of thing internally. Perhaps it would be better to implement this in efl by sending a blank cursor in set_cursor ?

src/bin/e_config.h
442

Shouldn't this be a double?

ohduna added a comment.Feb 2 2016, 7:52 PM
In D3480#58744, @zmike wrote:

Hi, sorry to show up so late to this one.

Wouldn't it be better to handle this sort of thing client side? The client may be in a state where it really makes sense to leave a mouse cursor on screen (like, say, when a menu is visible).

With EFL apps the compositor doesn't know when a menu is popped up, so it would just hide the cursor anyway. And that's just the first example that came to mind, I'm guessing there could be other times when the client knows better than the compositor whether a cursor should be visible or not.

Hm that's an interesting thought. Under X11, applications such as mplayer handle this sort of thing internally. Perhaps it would be better to implement this in efl by sending a blank cursor in set_cursor ?

This cursor_timer is part of server-side job. By setting use_cursor_timer on, users can remove cursor image in all apps.
For example,

  1. Android actually hide the cursor after 5 seconds idle. (in Galaxy phones, by default)
  2. "unclutter for utuntu". http://manpages.ubuntu.com/manpages/hardy/man1/unclutter.1.html

Please share your opinions.
Thanks.

raster edited edge metadata.Oct 21 2016, 2:32 AM

hmmm i'm late to this. i kind of don't think this is too bad as an optional feature. compositor needs to show/hide cursor based on cursor/pointer devices being there or not anyway and having a timeout is not too bad a thing. clients can do their own hiding also (this is what rage does for example). but some details.

also what zmike was saying for code specifics.

src/bin/e_config.h
441

shouldnt it be an unsigned char/eina_bool ?

442

agree. should be double

Glad to hear from you. I'll revise this patch and update soon.
Thanks,

zmike added a comment.May 1 2018, 10:00 AM

Is any work still underway on this?

This revision now requires changes to proceed.May 1 2018, 10:00 AM
Hermet commandeered this revision.Mar 23 2020, 6:47 PM
Hermet added a reviewer: ohduna.
Hermet abandoned this revision.Mar 23 2020, 6:48 PM

Nobody takes care of this. Discards very old patches.