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.
Details
- Set the use_cursor_timer to 1 (disabled by default)
- 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
A few issues with this:
- The timer interval config limits seem arbitrary; is 9.9s really the maximum that a user might want to set?
- 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.
- 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? |
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? |
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,
- Android actually hide the cursor after 5 seconds idle. (in Galaxy phones, by default)
- "unclutter for utuntu". http://manpages.ubuntu.com/manpages/hardy/man1/unclutter.1.html
Please share your opinions.
Thanks.
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.