Board.KolibriOS.org
http://board.kolibrios.org/

User activity syscalls (for screen saver)
http://board.kolibrios.org/viewtopic.php?f=35&t=4212
Page 1 of 1

Author:  dunkaist [ Mon May 11, 2020 9:17 am ]
Post subject:  User activity syscalls (for screen saver)

Screen savers in KolibriOS lack information about keyboard input because pressed keys are sent to the active window only.
Therefore it happens that a screen saver starts when you are editing text or playing snake game, i.e. not using mouse.

One could think that a possible solutions could be to allow inactive windows to get keyboard input via another event mask bit (like it's done for mouse).
But this is a true key logger.

Actually, the screen saver doesn't need to know each key that was pressed.
It needs to know the timestamp of the latest user input.

And the kernel could track and provide this information via a new syscall:
  • Add variable [user_activity_timestamp].
  • For each keyboard and mouse input update [user_activity_timestamp] from [timer_ticks].
  • Return [user_activity_timestamp] when the new syscall is called.

- Yet another syscall.
- Overhead of updating [user_activity_timestamp] at each user input.
+ Now the screen saver receives and handles each mouse input. With the new syscall this overhead is eliminated.


Next, sometimes the screen saver starts when you are watching a movie, i.e. not touching a computer at all.
In this case I can think of three approaches:
  • The user touches a mouse from time to time. No way.
  • The screen saver has a white list of proc names that prevent its start. This doesn't work too, e.g. if fplay (white listed) is on pause or playing audio.
  • Applications can inform the kernel to update [user_activity_timestamp]. Needs another syscall and additional effort from the apps but finally works.

- Yet another syscall.
- Needs modification of applications.
+ Nothing breaks when apps are not modified.
+ Screen saver finally works as expected.


Total:
  • A syscall to read activity timestamp (say, 26.7);
  • A syscall to update activity timestamp (say, 26.8);
  • Kernel modification to update the timestamp on each user input;
  • Apps modification to ask the kernel to update the timestamp.

Any better idea? Objections?

Kernel side and scrsaver are on me.

Author:  Leency [ Mon May 11, 2020 11:00 am ]
Post subject:  Re: User activity syscalls (for screen saver)

Idea seems to be fine, no objections from my side.

Author:  Pathoswithin [ Mon May 11, 2020 1:01 pm ]
Post subject:  Re: User activity syscalls (for screen saver)

Screensaver... Does anyone need it nowadays? I'd rather disable it by default.

Author:  CleverMouse [ Wed May 13, 2020 7:23 pm ]
Post subject:  Re: User activity syscalls (for screen saver)

> A syscall to update activity timestamp (say, 26.8 )
I think it is better to introduce a syscall to begin/end a timespan when the screensaver should be inactive. It requires extra tracking at the kernel side for correct handling of unexpected exits/crashes, but makes it simpler for programs like movie players. For the screensaver, the kernel can return that bit of information as is, or the kernel can return the current timestamp as last-active time during the defined timespan.

Page 1 of 1 All times are UTC+03:00
Powered by phpBB® Forum Software © phpBB Limited
https://www.phpbb.com/