Official KolibriOS board
It is currently Sun Jun 20, 2021 4:59 am

All times are UTC+03:00

Post new topic  Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Mon May 11, 2020 9:17 am 
User avatar

Joined: Mon Oct 19, 2009 10:58 am
Posts: 629
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.

  • 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.

PostPosted: Mon May 11, 2020 11:00 am 
User avatar

Joined: Thu Jan 25, 2007 3:33 pm
Posts: 5470
Idea seems to be fine, no objections from my side.

Звиздеть не мешки ворочать

PostPosted: Mon May 11, 2020 1:01 pm 
Mentor/Kernel Developer
User avatar

Joined: Thu Mar 26, 2015 5:16 pm
Posts: 1282
Screensaver... Does anyone need it nowadays? I'd rather disable it by default.

PostPosted: Wed May 13, 2020 7:23 pm 
Kernel Developer
User avatar

Joined: Thu Sep 03, 2009 1:52 pm
Posts: 1625
> 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.

Сделаем мир лучше!

Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 4 posts ] 

All times are UTC+03:00

Who is online

Users browsing this forum: No registered users and 2 guests

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Limited